@wistia/ui 0.8.13 → 0.8.14-beta.2385e790.bd3e5c4
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 +562 -511
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +42 -27
- package/dist/index.d.ts +42 -27
- package/dist/index.mjs +393 -343
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -21
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.8.
|
|
3
|
+
* @license @wistia/ui v0.8.14-beta.2385e790.bd3e5c4
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -105,7 +105,7 @@ __export(index_exports, {
|
|
|
105
105
|
Table: () => Table,
|
|
106
106
|
TableBody: () => TableBody,
|
|
107
107
|
TableCell: () => TableCell,
|
|
108
|
-
|
|
108
|
+
TableFoot: () => TableFoot,
|
|
109
109
|
TableHead: () => TableHead,
|
|
110
110
|
TableRow: () => TableRow,
|
|
111
111
|
Tabs: () => Tabs,
|
|
@@ -126,6 +126,7 @@ __export(index_exports, {
|
|
|
126
126
|
useActiveMq: () => useActiveMq,
|
|
127
127
|
useAriaLive: () => useAriaLive,
|
|
128
128
|
useBoolean: () => useBoolean,
|
|
129
|
+
useClipboard: () => useClipboard,
|
|
129
130
|
useFilePicker: () => import_use_file_picker.useFilePicker,
|
|
130
131
|
useFocusTrap: () => useFocusTrap,
|
|
131
132
|
useFormState: () => useFormState,
|
|
@@ -2100,20 +2101,287 @@ var useBoolean = (initialValue = false) => {
|
|
|
2100
2101
|
return [value, toggle, setTrue, setFalse, setValue];
|
|
2101
2102
|
};
|
|
2102
2103
|
|
|
2104
|
+
// src/hooks/useClipboard/useClipboard.ts
|
|
2105
|
+
var import_react7 = require("react");
|
|
2106
|
+
|
|
2107
|
+
// src/private/hooks/useTimedToggle/useTimedToggle.ts
|
|
2108
|
+
var import_react6 = require("react");
|
|
2109
|
+
var useTimedToggle = (initialValue) => {
|
|
2110
|
+
const [value, setValue] = (0, import_react6.useState)(false);
|
|
2111
|
+
const timeoutRef = (0, import_react6.useRef)();
|
|
2112
|
+
const initialValueRef = (0, import_react6.useRef)(initialValue);
|
|
2113
|
+
const toggleValue = (timeout) => {
|
|
2114
|
+
clearTimeout(timeoutRef.current);
|
|
2115
|
+
setValue(!initialValueRef.current);
|
|
2116
|
+
timeoutRef.current = window.setTimeout(() => setValue(initialValueRef.current), timeout);
|
|
2117
|
+
};
|
|
2118
|
+
(0, import_react6.useEffect)(() => () => clearTimeout(timeoutRef.current), []);
|
|
2119
|
+
return [value, toggleValue];
|
|
2120
|
+
};
|
|
2121
|
+
|
|
2122
|
+
// src/hooks/useClipboard/useClipboard.ts
|
|
2123
|
+
var useClipboard = (textToCopy, timeout = 1500) => {
|
|
2124
|
+
const [hasCopied, toggleHasCopied] = useTimedToggle(false);
|
|
2125
|
+
const [failedToCopy, toggleFailedToCopy] = useTimedToggle(false);
|
|
2126
|
+
const onCopy = (0, import_react7.useCallback)(async () => {
|
|
2127
|
+
try {
|
|
2128
|
+
await copyToClipboard(textToCopy);
|
|
2129
|
+
if (timeout && timeout > 0) {
|
|
2130
|
+
toggleHasCopied(timeout);
|
|
2131
|
+
}
|
|
2132
|
+
} catch (error) {
|
|
2133
|
+
if (error instanceof Error) {
|
|
2134
|
+
toggleFailedToCopy(timeout);
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
}, [textToCopy, timeout, toggleHasCopied, toggleFailedToCopy]);
|
|
2138
|
+
return [onCopy, hasCopied, failedToCopy];
|
|
2139
|
+
};
|
|
2140
|
+
|
|
2103
2141
|
// src/hooks/useFilePicker/index.ts
|
|
2104
2142
|
var import_use_file_picker = require("use-file-picker");
|
|
2105
2143
|
var import_validators = require("use-file-picker/validators");
|
|
2106
2144
|
|
|
2145
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2146
|
+
var import_react8 = require("react");
|
|
2147
|
+
var import_type_guards7 = require("@wistia/type-guards");
|
|
2148
|
+
|
|
2149
|
+
// src/hooks/useFocusTrap/helpers.ts
|
|
2150
|
+
var FOCUSABLE_ELEMENT_SELECTORS = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, [tabindex="0"], [contenteditable]';
|
|
2151
|
+
var coerceToString = (value) => value === null || value === void 0 ? "" : String(value);
|
|
2152
|
+
var isHiddenElement = (element) => {
|
|
2153
|
+
const { display, visibility } = window.getComputedStyle(element);
|
|
2154
|
+
const isHidden = display === "none" || element.style.display === "none" || visibility === "none" || element.style.visibility === "hidden";
|
|
2155
|
+
return element.offsetWidth <= 0 && element.offsetHeight <= 0 || isHidden;
|
|
2156
|
+
};
|
|
2157
|
+
var isVisibleElement = (element) => {
|
|
2158
|
+
let parentElement = element;
|
|
2159
|
+
while (parentElement) {
|
|
2160
|
+
if (parentElement === document.body) {
|
|
2161
|
+
break;
|
|
2162
|
+
}
|
|
2163
|
+
if (isHiddenElement(parentElement)) {
|
|
2164
|
+
return false;
|
|
2165
|
+
}
|
|
2166
|
+
parentElement = parentElement.parentNode;
|
|
2167
|
+
}
|
|
2168
|
+
return true;
|
|
2169
|
+
};
|
|
2170
|
+
var getElementTabIndex = (element) => {
|
|
2171
|
+
const tabIndex = element.getAttribute("tabindex");
|
|
2172
|
+
return Number.parseInt(tabIndex ?? void 0, 10);
|
|
2173
|
+
};
|
|
2174
|
+
var isTabIndexNaN = (element) => {
|
|
2175
|
+
const tabIndex = getElementTabIndex(element);
|
|
2176
|
+
return Number.isNaN(tabIndex);
|
|
2177
|
+
};
|
|
2178
|
+
var isFocusableElement = (element) => {
|
|
2179
|
+
const tabbableNodeRegEx = /input|select|textarea|button|object/;
|
|
2180
|
+
const nodeName = element.nodeName.toLowerCase();
|
|
2181
|
+
const isTabIndexNotNaN = !isTabIndexNaN(element);
|
|
2182
|
+
const isFocusable = (
|
|
2183
|
+
// @ts-expect-error - Disabled is specific to buttons and inputs, but we could be dealing with any number of types here. Disabled would be undefined for those, so ignoring.
|
|
2184
|
+
tabbableNodeRegEx.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN)
|
|
2185
|
+
);
|
|
2186
|
+
return Boolean(isFocusable) && isVisibleElement(element);
|
|
2187
|
+
};
|
|
2188
|
+
var isTabbableElement = (element) => {
|
|
2189
|
+
const tabIndex = getElementTabIndex(element);
|
|
2190
|
+
return (isTabIndexNaN(element) || tabIndex >= 0) && isFocusableElement(element);
|
|
2191
|
+
};
|
|
2192
|
+
var findTabbableDescendants = (element) => Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter(
|
|
2193
|
+
isTabbableElement
|
|
2194
|
+
);
|
|
2195
|
+
var focusLaterElements = [];
|
|
2196
|
+
var focusElement = null;
|
|
2197
|
+
var needToFocus = false;
|
|
2198
|
+
var handleBlur = () => {
|
|
2199
|
+
needToFocus = true;
|
|
2200
|
+
};
|
|
2201
|
+
var handleFocus = () => {
|
|
2202
|
+
if (needToFocus) {
|
|
2203
|
+
needToFocus = false;
|
|
2204
|
+
if (!focusElement) {
|
|
2205
|
+
return;
|
|
2206
|
+
}
|
|
2207
|
+
if (focusElement.contains(document.activeElement)) {
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
const element = findTabbableDescendants(focusElement)[0] ?? focusElement;
|
|
2211
|
+
element.focus();
|
|
2212
|
+
}
|
|
2213
|
+
};
|
|
2214
|
+
var markForFocusLater = () => {
|
|
2215
|
+
const element = document.activeElement;
|
|
2216
|
+
if (element !== null) {
|
|
2217
|
+
focusLaterElements.push(element);
|
|
2218
|
+
}
|
|
2219
|
+
};
|
|
2220
|
+
var returnFocus = () => {
|
|
2221
|
+
let toFocus = null;
|
|
2222
|
+
try {
|
|
2223
|
+
toFocus = focusLaterElements.pop();
|
|
2224
|
+
if (toFocus) {
|
|
2225
|
+
toFocus.focus();
|
|
2226
|
+
}
|
|
2227
|
+
} catch {
|
|
2228
|
+
console.warn(
|
|
2229
|
+
`You tried to return focus to ${coerceToString(toFocus)} but it is not in the DOM anymore`
|
|
2230
|
+
);
|
|
2231
|
+
}
|
|
2232
|
+
};
|
|
2233
|
+
var setupScopedFocus = (element) => {
|
|
2234
|
+
focusElement = element;
|
|
2235
|
+
document.addEventListener("focusout", handleBlur, false);
|
|
2236
|
+
document.addEventListener("focusin", handleFocus, true);
|
|
2237
|
+
};
|
|
2238
|
+
var teardownScopedFocus = () => {
|
|
2239
|
+
focusElement = null;
|
|
2240
|
+
document.removeEventListener("focusout", handleBlur);
|
|
2241
|
+
document.removeEventListener("focusin", handleFocus);
|
|
2242
|
+
};
|
|
2243
|
+
var scopeTab = (node, event) => {
|
|
2244
|
+
const tabbable = findTabbableDescendants(node);
|
|
2245
|
+
if (!tabbable.length) {
|
|
2246
|
+
event.preventDefault();
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
|
|
2250
|
+
const leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
|
|
2251
|
+
if (!leavingFinalTabbable) {
|
|
2252
|
+
return;
|
|
2253
|
+
}
|
|
2254
|
+
event.preventDefault();
|
|
2255
|
+
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
|
|
2256
|
+
if (target) {
|
|
2257
|
+
target.focus();
|
|
2258
|
+
}
|
|
2259
|
+
};
|
|
2260
|
+
var createAriaHider = (containerNode, selector) => {
|
|
2261
|
+
selector ??= "body > :not(script)";
|
|
2262
|
+
const rootNodes = Array.from(document.querySelectorAll(selector)).map((node) => {
|
|
2263
|
+
if (node.contains(containerNode)) {
|
|
2264
|
+
return void 0;
|
|
2265
|
+
}
|
|
2266
|
+
const ariaHidden = node.getAttribute("aria-hidden");
|
|
2267
|
+
if (ariaHidden === null || ariaHidden === "false") {
|
|
2268
|
+
node.setAttribute("aria-hidden", "true");
|
|
2269
|
+
}
|
|
2270
|
+
return {
|
|
2271
|
+
node,
|
|
2272
|
+
ariaHidden
|
|
2273
|
+
};
|
|
2274
|
+
});
|
|
2275
|
+
return () => {
|
|
2276
|
+
rootNodes.forEach((item) => {
|
|
2277
|
+
if (!item) {
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
2280
|
+
if (item.ariaHidden === null) {
|
|
2281
|
+
item.node.removeAttribute("aria-hidden");
|
|
2282
|
+
} else {
|
|
2283
|
+
item.node.setAttribute("aria-hidden", item.ariaHidden);
|
|
2284
|
+
}
|
|
2285
|
+
});
|
|
2286
|
+
};
|
|
2287
|
+
};
|
|
2288
|
+
|
|
2289
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2290
|
+
var isRef = (val) => {
|
|
2291
|
+
return val !== null && typeof val === "object" && "current" in val;
|
|
2292
|
+
};
|
|
2293
|
+
var useFocusTrap = (active = true, options = {}) => {
|
|
2294
|
+
const ref = (0, import_react8.useRef)(null);
|
|
2295
|
+
const restoreAriaRef = (0, import_react8.useRef)(null);
|
|
2296
|
+
const setRef = (0, import_react8.useCallback)(
|
|
2297
|
+
(node) => {
|
|
2298
|
+
if (restoreAriaRef.current !== null) {
|
|
2299
|
+
restoreAriaRef.current();
|
|
2300
|
+
}
|
|
2301
|
+
if (ref.current) {
|
|
2302
|
+
returnFocus();
|
|
2303
|
+
teardownScopedFocus();
|
|
2304
|
+
}
|
|
2305
|
+
if (active && node !== null && node !== void 0) {
|
|
2306
|
+
setupScopedFocus(node);
|
|
2307
|
+
markForFocusLater();
|
|
2308
|
+
const processNode = (node2) => {
|
|
2309
|
+
restoreAriaRef.current = !(options.disableAriaHider ?? false) ? createAriaHider(node2) : null;
|
|
2310
|
+
let focusElement2 = null;
|
|
2311
|
+
if ((0, import_type_guards7.isNotUndefined)(options.focusSelector)) {
|
|
2312
|
+
if (isRef(options.focusSelector)) {
|
|
2313
|
+
focusElement2 = options.focusSelector.current;
|
|
2314
|
+
} else {
|
|
2315
|
+
focusElement2 = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
if (!focusElement2) {
|
|
2319
|
+
const children = Array.from(
|
|
2320
|
+
node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)
|
|
2321
|
+
);
|
|
2322
|
+
focusElement2 = // Prefer tabbable elements, But fallback to any focusable element
|
|
2323
|
+
children.find(isTabbableElement) ?? // But fallback to any focusable element
|
|
2324
|
+
children.find(isFocusableElement) ?? // Nothing found
|
|
2325
|
+
null;
|
|
2326
|
+
if (!focusElement2 && isFocusableElement(node2)) {
|
|
2327
|
+
focusElement2 = node2;
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
if (focusElement2) {
|
|
2331
|
+
focusElement2.focus();
|
|
2332
|
+
}
|
|
2333
|
+
if (!focusElement2 && process.env["NODE_ENV"] === "development") {
|
|
2334
|
+
console.warn(
|
|
2335
|
+
'[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.',
|
|
2336
|
+
node2
|
|
2337
|
+
);
|
|
2338
|
+
}
|
|
2339
|
+
};
|
|
2340
|
+
setTimeout(() => {
|
|
2341
|
+
if (node.ownerDocument) {
|
|
2342
|
+
processNode(node);
|
|
2343
|
+
}
|
|
2344
|
+
if (!node.ownerDocument && process.env["NODE_ENV"] === "development") {
|
|
2345
|
+
console.warn(
|
|
2346
|
+
"[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.",
|
|
2347
|
+
node
|
|
2348
|
+
);
|
|
2349
|
+
}
|
|
2350
|
+
});
|
|
2351
|
+
ref.current = node;
|
|
2352
|
+
} else {
|
|
2353
|
+
ref.current = null;
|
|
2354
|
+
}
|
|
2355
|
+
},
|
|
2356
|
+
[active, options.focusSelector, options.disableAriaHider]
|
|
2357
|
+
);
|
|
2358
|
+
(0, import_react8.useEffect)(() => {
|
|
2359
|
+
if (!active) {
|
|
2360
|
+
return void 0;
|
|
2361
|
+
}
|
|
2362
|
+
const handleKeyDown = (event) => {
|
|
2363
|
+
if (event.key === "Tab" && ref.current) {
|
|
2364
|
+
scopeTab(ref.current, event);
|
|
2365
|
+
}
|
|
2366
|
+
};
|
|
2367
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2368
|
+
return () => {
|
|
2369
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2370
|
+
};
|
|
2371
|
+
}, [active]);
|
|
2372
|
+
return setRef;
|
|
2373
|
+
};
|
|
2374
|
+
|
|
2107
2375
|
// src/hooks/useKey/useKey.ts
|
|
2108
|
-
var
|
|
2376
|
+
var import_react10 = require("react");
|
|
2109
2377
|
|
|
2110
2378
|
// src/private/hooks/useEvent/useEvent.ts
|
|
2111
|
-
var
|
|
2379
|
+
var import_react9 = require("react");
|
|
2112
2380
|
|
|
2113
2381
|
// src/private/helpers/isValidRef/isValidRef.ts
|
|
2114
|
-
var
|
|
2382
|
+
var import_type_guards8 = require("@wistia/type-guards");
|
|
2115
2383
|
var isValidRef = (value) => {
|
|
2116
|
-
return (0,
|
|
2384
|
+
return (0, import_type_guards8.isNotNil)(value) && (0, import_type_guards8.isRecord)(value) && "current" in value;
|
|
2117
2385
|
};
|
|
2118
2386
|
|
|
2119
2387
|
// src/private/helpers/noOpFn/noOpFn.ts
|
|
@@ -2127,15 +2395,15 @@ var isEventTargetSupported = (eventTarget) => (
|
|
|
2127
2395
|
!!(typeof eventTarget === "object" && eventTarget?.addEventListener)
|
|
2128
2396
|
);
|
|
2129
2397
|
var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}) => {
|
|
2130
|
-
const savedEventHandler = (0,
|
|
2131
|
-
const savedEventOptions = (0,
|
|
2132
|
-
(0,
|
|
2398
|
+
const savedEventHandler = (0, import_react9.useRef)();
|
|
2399
|
+
const savedEventOptions = (0, import_react9.useRef)();
|
|
2400
|
+
(0, import_react9.useEffect)(() => {
|
|
2133
2401
|
savedEventHandler.current = eventHandler;
|
|
2134
2402
|
}, [eventHandler]);
|
|
2135
|
-
(0,
|
|
2403
|
+
(0, import_react9.useEffect)(() => {
|
|
2136
2404
|
savedEventOptions.current = eventOptions;
|
|
2137
2405
|
}, [eventOptions]);
|
|
2138
|
-
(0,
|
|
2406
|
+
(0, import_react9.useEffect)(() => {
|
|
2139
2407
|
const target = isValidRef(eventTarget) ? eventTarget.current : eventTarget;
|
|
2140
2408
|
if (!eventName || !isEventTargetSupported(target)) {
|
|
2141
2409
|
return;
|
|
@@ -2155,7 +2423,7 @@ var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}
|
|
|
2155
2423
|
|
|
2156
2424
|
// src/hooks/useKey/useKey.ts
|
|
2157
2425
|
var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOptions } = {}) => {
|
|
2158
|
-
const memoizedEventHandler = (0,
|
|
2426
|
+
const memoizedEventHandler = (0, import_react10.useCallback)(
|
|
2159
2427
|
(handlerEvent) => {
|
|
2160
2428
|
if (["INPUT", "TEXTAREA", "SELECT"].includes(document.activeElement?.nodeName ?? "") || document.activeElement?.isContentEditable) {
|
|
2161
2429
|
return;
|
|
@@ -2180,9 +2448,9 @@ var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOpti
|
|
|
2180
2448
|
};
|
|
2181
2449
|
|
|
2182
2450
|
// src/hooks/useLocalStorage/useLocalStorage.ts
|
|
2183
|
-
var
|
|
2451
|
+
var import_react11 = require("react");
|
|
2184
2452
|
var useLocalStorage = (key, initialValue, storage = window.localStorage) => {
|
|
2185
|
-
const [storedValue, setStoredValue] = (0,
|
|
2453
|
+
const [storedValue, setStoredValue] = (0, import_react11.useState)(() => {
|
|
2186
2454
|
try {
|
|
2187
2455
|
const item = storage.getItem(key);
|
|
2188
2456
|
return item !== null && !!item ? JSON.parse(item) : initialValue;
|
|
@@ -2208,9 +2476,9 @@ var useLocalStorage = (key, initialValue, storage = window.localStorage) => {
|
|
|
2208
2476
|
};
|
|
2209
2477
|
|
|
2210
2478
|
// src/hooks/useLockBodyScroll/useLockBodyScroll.ts
|
|
2211
|
-
var
|
|
2479
|
+
var import_react12 = require("react");
|
|
2212
2480
|
var useLockBodyScroll = (locked) => {
|
|
2213
|
-
(0,
|
|
2481
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
2214
2482
|
if (locked) {
|
|
2215
2483
|
const originalStyle = window.getComputedStyle(document.body).overflow;
|
|
2216
2484
|
document.body.style.overflow = "hidden";
|
|
@@ -2222,40 +2490,11 @@ var useLockBodyScroll = (locked) => {
|
|
|
2222
2490
|
}, [locked]);
|
|
2223
2491
|
};
|
|
2224
2492
|
|
|
2225
|
-
// src/hooks/useOnClickOutside/useOnClickOutside.ts
|
|
2226
|
-
var import_react10 = require("react");
|
|
2227
|
-
var useOnClickOutside = (ref, handler, eventTypes = ["mousedown", "touchend"]) => {
|
|
2228
|
-
(0, import_react10.useEffect)(() => {
|
|
2229
|
-
const listener = (event) => {
|
|
2230
|
-
if (!ref.current || ref.current.contains(event.target)) {
|
|
2231
|
-
return;
|
|
2232
|
-
}
|
|
2233
|
-
handler(event);
|
|
2234
|
-
};
|
|
2235
|
-
if (Array.isArray(eventTypes)) {
|
|
2236
|
-
eventTypes.forEach((eventType) => {
|
|
2237
|
-
document.addEventListener(eventType, listener);
|
|
2238
|
-
});
|
|
2239
|
-
} else {
|
|
2240
|
-
document.addEventListener(eventTypes, listener);
|
|
2241
|
-
}
|
|
2242
|
-
return () => {
|
|
2243
|
-
if (Array.isArray(eventTypes)) {
|
|
2244
|
-
eventTypes.forEach((eventType) => {
|
|
2245
|
-
document.removeEventListener(eventType, listener);
|
|
2246
|
-
});
|
|
2247
|
-
} else {
|
|
2248
|
-
document.removeEventListener(eventTypes, listener);
|
|
2249
|
-
}
|
|
2250
|
-
};
|
|
2251
|
-
}, [ref, handler, eventTypes]);
|
|
2252
|
-
};
|
|
2253
|
-
|
|
2254
2493
|
// src/hooks/useMq/useMq.ts
|
|
2255
|
-
var
|
|
2494
|
+
var import_type_guards9 = require("@wistia/type-guards");
|
|
2256
2495
|
|
|
2257
2496
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
2258
|
-
var
|
|
2497
|
+
var import_react13 = require("react");
|
|
2259
2498
|
var import_throttle_debounce = require("throttle-debounce");
|
|
2260
2499
|
|
|
2261
2500
|
// src/private/helpers/isClient/isClient.ts
|
|
@@ -2263,11 +2502,11 @@ var isClient = () => typeof window !== "undefined" && typeof document !== "undef
|
|
|
2263
2502
|
|
|
2264
2503
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
2265
2504
|
var useWindowSize = (interval = 0) => {
|
|
2266
|
-
const [dimensions, setDimensions] = (0,
|
|
2505
|
+
const [dimensions, setDimensions] = (0, import_react13.useState)({
|
|
2267
2506
|
width: isClient() ? window.innerWidth : 0,
|
|
2268
2507
|
height: isClient() ? window.innerHeight : 0
|
|
2269
2508
|
});
|
|
2270
|
-
(0,
|
|
2509
|
+
(0, import_react13.useLayoutEffect)(() => {
|
|
2271
2510
|
const handleResize = (0, import_throttle_debounce.debounce)(
|
|
2272
2511
|
interval,
|
|
2273
2512
|
() => setDimensions({
|
|
@@ -2314,21 +2553,50 @@ var useActiveMq = () => {
|
|
|
2314
2553
|
const keys = Object.keys(mq2);
|
|
2315
2554
|
return keys.filter((key) => {
|
|
2316
2555
|
const value = mq2[key];
|
|
2317
|
-
return (0,
|
|
2556
|
+
return (0, import_type_guards9.isBoolean)(value) && value;
|
|
2318
2557
|
});
|
|
2319
2558
|
};
|
|
2320
2559
|
|
|
2560
|
+
// src/hooks/useOnClickOutside/useOnClickOutside.ts
|
|
2561
|
+
var import_react14 = require("react");
|
|
2562
|
+
var useOnClickOutside = (ref, handler, eventTypes = ["mousedown", "touchend"]) => {
|
|
2563
|
+
(0, import_react14.useEffect)(() => {
|
|
2564
|
+
const listener = (event) => {
|
|
2565
|
+
if (!ref.current || ref.current.contains(event.target)) {
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2568
|
+
handler(event);
|
|
2569
|
+
};
|
|
2570
|
+
if (Array.isArray(eventTypes)) {
|
|
2571
|
+
eventTypes.forEach((eventType) => {
|
|
2572
|
+
document.addEventListener(eventType, listener);
|
|
2573
|
+
});
|
|
2574
|
+
} else {
|
|
2575
|
+
document.addEventListener(eventTypes, listener);
|
|
2576
|
+
}
|
|
2577
|
+
return () => {
|
|
2578
|
+
if (Array.isArray(eventTypes)) {
|
|
2579
|
+
eventTypes.forEach((eventType) => {
|
|
2580
|
+
document.removeEventListener(eventType, listener);
|
|
2581
|
+
});
|
|
2582
|
+
} else {
|
|
2583
|
+
document.removeEventListener(eventTypes, listener);
|
|
2584
|
+
}
|
|
2585
|
+
};
|
|
2586
|
+
}, [ref, handler, eventTypes]);
|
|
2587
|
+
};
|
|
2588
|
+
|
|
2321
2589
|
// src/hooks/useToast/useToast.tsx
|
|
2322
|
-
var
|
|
2590
|
+
var import_react16 = require("react");
|
|
2323
2591
|
var import_sonner2 = require("sonner");
|
|
2324
2592
|
|
|
2325
2593
|
// src/private/components/Toast/Toast.tsx
|
|
2326
|
-
var
|
|
2594
|
+
var import_react15 = require("react");
|
|
2327
2595
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
2328
|
-
var
|
|
2596
|
+
var import_type_guards11 = require("@wistia/type-guards");
|
|
2329
2597
|
|
|
2330
2598
|
// src/components/Ellipsis/Ellipsis.tsx
|
|
2331
|
-
var
|
|
2599
|
+
var import_type_guards10 = require("@wistia/type-guards");
|
|
2332
2600
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
2333
2601
|
|
|
2334
2602
|
// src/css/lineClampCss.tsx
|
|
@@ -2372,7 +2640,7 @@ var ellipsisFlexParentStyle = import_styled_components14.css`
|
|
|
2372
2640
|
var EllipsisComponent = import_styled_components14.default.span`
|
|
2373
2641
|
${ellipsisStyle};
|
|
2374
2642
|
${({ $lines }) => {
|
|
2375
|
-
if ((0,
|
|
2643
|
+
if ((0, import_type_guards10.isNotNil)($lines)) {
|
|
2376
2644
|
return lineClampCss($lines);
|
|
2377
2645
|
}
|
|
2378
2646
|
return void 0;
|
|
@@ -2561,302 +2829,70 @@ var StyledToast = import_styled_components16.default.div`
|
|
|
2561
2829
|
}
|
|
2562
2830
|
`;
|
|
2563
2831
|
var Action = ({ actionButton }) => {
|
|
2564
|
-
if ((0,
|
|
2565
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionWrapper, { children: (0,
|
|
2832
|
+
if ((0, import_type_guards11.isNotNil)(actionButton) && (0, import_react15.isValidElement)(actionButton)) {
|
|
2833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionWrapper, { children: (0, import_react15.cloneElement)(actionButton, {
|
|
2566
2834
|
variant: "soft",
|
|
2567
2835
|
// force Button variant
|
|
2568
2836
|
size: "sm"
|
|
2569
2837
|
// force Button size
|
|
2570
|
-
}) });
|
|
2571
|
-
}
|
|
2572
|
-
return null;
|
|
2573
|
-
};
|
|
2574
|
-
var Toast = ({
|
|
2575
|
-
action,
|
|
2576
|
-
message,
|
|
2577
|
-
colorScheme = "inherit",
|
|
2578
|
-
icon,
|
|
2579
|
-
...props
|
|
2580
|
-
}) => {
|
|
2581
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2582
|
-
StyledToast,
|
|
2583
|
-
{
|
|
2584
|
-
...props,
|
|
2585
|
-
$colorScheme: colorScheme,
|
|
2586
|
-
children: [
|
|
2587
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(MessageWrapper, { children: [
|
|
2588
|
-
(0,
|
|
2589
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Message, { lines: 3, children: message })
|
|
2590
|
-
] }),
|
|
2591
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Action, { actionButton: action })
|
|
2592
|
-
]
|
|
2593
|
-
}
|
|
2594
|
-
);
|
|
2595
|
-
};
|
|
2596
|
-
Toast.displayName = "Toast";
|
|
2597
|
-
|
|
2598
|
-
// src/hooks/useToast/useToast.tsx
|
|
2599
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2600
|
-
var useToast = () => {
|
|
2601
|
-
return (0, import_react13.useCallback)(
|
|
2602
|
-
({ message, action, colorScheme, icon, position = "bottom-left", duration = 3e3 }) => {
|
|
2603
|
-
import_sonner2.toast.custom(
|
|
2604
|
-
() => {
|
|
2605
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2606
|
-
Toast,
|
|
2607
|
-
{
|
|
2608
|
-
action,
|
|
2609
|
-
colorScheme,
|
|
2610
|
-
icon,
|
|
2611
|
-
message
|
|
2612
|
-
}
|
|
2613
|
-
);
|
|
2614
|
-
},
|
|
2615
|
-
{ position, duration }
|
|
2616
|
-
);
|
|
2617
|
-
},
|
|
2618
|
-
[]
|
|
2619
|
-
);
|
|
2620
|
-
};
|
|
2621
|
-
|
|
2622
|
-
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2623
|
-
var import_react14 = require("react");
|
|
2624
|
-
var import_type_guards11 = require("@wistia/type-guards");
|
|
2625
|
-
|
|
2626
|
-
// src/hooks/useFocusTrap/helpers.ts
|
|
2627
|
-
var FOCUSABLE_ELEMENT_SELECTORS = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, [tabindex="0"], [contenteditable]';
|
|
2628
|
-
var coerceToString = (value) => value === null || value === void 0 ? "" : String(value);
|
|
2629
|
-
var isHiddenElement = (element) => {
|
|
2630
|
-
const { display, visibility } = window.getComputedStyle(element);
|
|
2631
|
-
const isHidden = display === "none" || element.style.display === "none" || visibility === "none" || element.style.visibility === "hidden";
|
|
2632
|
-
return element.offsetWidth <= 0 && element.offsetHeight <= 0 || isHidden;
|
|
2633
|
-
};
|
|
2634
|
-
var isVisibleElement = (element) => {
|
|
2635
|
-
let parentElement = element;
|
|
2636
|
-
while (parentElement) {
|
|
2637
|
-
if (parentElement === document.body) {
|
|
2638
|
-
break;
|
|
2639
|
-
}
|
|
2640
|
-
if (isHiddenElement(parentElement)) {
|
|
2641
|
-
return false;
|
|
2642
|
-
}
|
|
2643
|
-
parentElement = parentElement.parentNode;
|
|
2644
|
-
}
|
|
2645
|
-
return true;
|
|
2646
|
-
};
|
|
2647
|
-
var getElementTabIndex = (element) => {
|
|
2648
|
-
const tabIndex = element.getAttribute("tabindex");
|
|
2649
|
-
return Number.parseInt(tabIndex ?? void 0, 10);
|
|
2650
|
-
};
|
|
2651
|
-
var isTabIndexNaN = (element) => {
|
|
2652
|
-
const tabIndex = getElementTabIndex(element);
|
|
2653
|
-
return Number.isNaN(tabIndex);
|
|
2654
|
-
};
|
|
2655
|
-
var isFocusableElement = (element) => {
|
|
2656
|
-
const tabbableNodeRegEx = /input|select|textarea|button|object/;
|
|
2657
|
-
const nodeName = element.nodeName.toLowerCase();
|
|
2658
|
-
const isTabIndexNotNaN = !isTabIndexNaN(element);
|
|
2659
|
-
const isFocusable = (
|
|
2660
|
-
// @ts-expect-error - Disabled is specific to buttons and inputs, but we could be dealing with any number of types here. Disabled would be undefined for those, so ignoring.
|
|
2661
|
-
tabbableNodeRegEx.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN)
|
|
2662
|
-
);
|
|
2663
|
-
return Boolean(isFocusable) && isVisibleElement(element);
|
|
2664
|
-
};
|
|
2665
|
-
var isTabbableElement = (element) => {
|
|
2666
|
-
const tabIndex = getElementTabIndex(element);
|
|
2667
|
-
return (isTabIndexNaN(element) || tabIndex >= 0) && isFocusableElement(element);
|
|
2668
|
-
};
|
|
2669
|
-
var findTabbableDescendants = (element) => Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter(
|
|
2670
|
-
isTabbableElement
|
|
2671
|
-
);
|
|
2672
|
-
var focusLaterElements = [];
|
|
2673
|
-
var focusElement = null;
|
|
2674
|
-
var needToFocus = false;
|
|
2675
|
-
var handleBlur = () => {
|
|
2676
|
-
needToFocus = true;
|
|
2677
|
-
};
|
|
2678
|
-
var handleFocus = () => {
|
|
2679
|
-
if (needToFocus) {
|
|
2680
|
-
needToFocus = false;
|
|
2681
|
-
if (!focusElement) {
|
|
2682
|
-
return;
|
|
2683
|
-
}
|
|
2684
|
-
if (focusElement.contains(document.activeElement)) {
|
|
2685
|
-
return;
|
|
2686
|
-
}
|
|
2687
|
-
const element = findTabbableDescendants(focusElement)[0] ?? focusElement;
|
|
2688
|
-
element.focus();
|
|
2689
|
-
}
|
|
2690
|
-
};
|
|
2691
|
-
var markForFocusLater = () => {
|
|
2692
|
-
const element = document.activeElement;
|
|
2693
|
-
if (element !== null) {
|
|
2694
|
-
focusLaterElements.push(element);
|
|
2695
|
-
}
|
|
2696
|
-
};
|
|
2697
|
-
var returnFocus = () => {
|
|
2698
|
-
let toFocus = null;
|
|
2699
|
-
try {
|
|
2700
|
-
toFocus = focusLaterElements.pop();
|
|
2701
|
-
if (toFocus) {
|
|
2702
|
-
toFocus.focus();
|
|
2703
|
-
}
|
|
2704
|
-
} catch {
|
|
2705
|
-
console.warn(
|
|
2706
|
-
`You tried to return focus to ${coerceToString(toFocus)} but it is not in the DOM anymore`
|
|
2707
|
-
);
|
|
2708
|
-
}
|
|
2709
|
-
};
|
|
2710
|
-
var setupScopedFocus = (element) => {
|
|
2711
|
-
focusElement = element;
|
|
2712
|
-
document.addEventListener("focusout", handleBlur, false);
|
|
2713
|
-
document.addEventListener("focusin", handleFocus, true);
|
|
2714
|
-
};
|
|
2715
|
-
var teardownScopedFocus = () => {
|
|
2716
|
-
focusElement = null;
|
|
2717
|
-
document.removeEventListener("focusout", handleBlur);
|
|
2718
|
-
document.removeEventListener("focusin", handleFocus);
|
|
2719
|
-
};
|
|
2720
|
-
var scopeTab = (node, event) => {
|
|
2721
|
-
const tabbable = findTabbableDescendants(node);
|
|
2722
|
-
if (!tabbable.length) {
|
|
2723
|
-
event.preventDefault();
|
|
2724
|
-
return;
|
|
2725
|
-
}
|
|
2726
|
-
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
|
|
2727
|
-
const leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
|
|
2728
|
-
if (!leavingFinalTabbable) {
|
|
2729
|
-
return;
|
|
2730
|
-
}
|
|
2731
|
-
event.preventDefault();
|
|
2732
|
-
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
|
|
2733
|
-
if (target) {
|
|
2734
|
-
target.focus();
|
|
2735
|
-
}
|
|
2736
|
-
};
|
|
2737
|
-
var createAriaHider = (containerNode, selector) => {
|
|
2738
|
-
if (selector === void 0) {
|
|
2739
|
-
selector = "body > :not(script)";
|
|
2740
|
-
}
|
|
2741
|
-
const rootNodes = Array.from(document.querySelectorAll(selector)).map((node) => {
|
|
2742
|
-
if (node.contains(containerNode)) {
|
|
2743
|
-
return void 0;
|
|
2744
|
-
}
|
|
2745
|
-
const ariaHidden = node.getAttribute("aria-hidden");
|
|
2746
|
-
if (ariaHidden === null || ariaHidden === "false") {
|
|
2747
|
-
node.setAttribute("aria-hidden", "true");
|
|
2838
|
+
}) });
|
|
2839
|
+
}
|
|
2840
|
+
return null;
|
|
2841
|
+
};
|
|
2842
|
+
var Toast = ({
|
|
2843
|
+
action,
|
|
2844
|
+
message,
|
|
2845
|
+
colorScheme = "inherit",
|
|
2846
|
+
icon,
|
|
2847
|
+
...props
|
|
2848
|
+
}) => {
|
|
2849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2850
|
+
StyledToast,
|
|
2851
|
+
{
|
|
2852
|
+
...props,
|
|
2853
|
+
$colorScheme: colorScheme,
|
|
2854
|
+
children: [
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(MessageWrapper, { children: [
|
|
2856
|
+
(0, import_type_guards11.isNotNil)(icon) ? icon : null,
|
|
2857
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Message, { lines: 3, children: message })
|
|
2858
|
+
] }),
|
|
2859
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Action, { actionButton: action })
|
|
2860
|
+
]
|
|
2748
2861
|
}
|
|
2749
|
-
|
|
2750
|
-
node,
|
|
2751
|
-
ariaHidden
|
|
2752
|
-
};
|
|
2753
|
-
});
|
|
2754
|
-
return () => {
|
|
2755
|
-
rootNodes.forEach((item) => {
|
|
2756
|
-
if (!item) {
|
|
2757
|
-
return;
|
|
2758
|
-
}
|
|
2759
|
-
if (item.ariaHidden === null) {
|
|
2760
|
-
item.node.removeAttribute("aria-hidden");
|
|
2761
|
-
} else {
|
|
2762
|
-
item.node.setAttribute("aria-hidden", item.ariaHidden);
|
|
2763
|
-
}
|
|
2764
|
-
});
|
|
2765
|
-
};
|
|
2862
|
+
);
|
|
2766
2863
|
};
|
|
2864
|
+
Toast.displayName = "Toast";
|
|
2767
2865
|
|
|
2768
|
-
// src/hooks/
|
|
2769
|
-
var
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
teardownScopedFocus();
|
|
2783
|
-
}
|
|
2784
|
-
if (active && node !== null && node !== void 0) {
|
|
2785
|
-
setupScopedFocus(node);
|
|
2786
|
-
markForFocusLater();
|
|
2787
|
-
const processNode = (node2) => {
|
|
2788
|
-
restoreAriaRef.current = !(options.disableAriaHider ?? false) ? createAriaHider(node2) : null;
|
|
2789
|
-
let focusElement2 = null;
|
|
2790
|
-
if ((0, import_type_guards11.isNotUndefined)(options.focusSelector)) {
|
|
2791
|
-
if (isRef(options.focusSelector)) {
|
|
2792
|
-
focusElement2 = options.focusSelector.current;
|
|
2793
|
-
} else {
|
|
2794
|
-
focusElement2 = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
|
|
2795
|
-
}
|
|
2796
|
-
}
|
|
2797
|
-
if (!focusElement2) {
|
|
2798
|
-
const children = Array.from(
|
|
2799
|
-
node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)
|
|
2800
|
-
);
|
|
2801
|
-
focusElement2 = // Prefer tabbable elements, But fallback to any focusable element
|
|
2802
|
-
children.find(isTabbableElement) ?? // But fallback to any focusable element
|
|
2803
|
-
children.find(isFocusableElement) ?? // Nothing found
|
|
2804
|
-
null;
|
|
2805
|
-
if (!focusElement2 && isFocusableElement(node2)) {
|
|
2806
|
-
focusElement2 = node2;
|
|
2866
|
+
// src/hooks/useToast/useToast.tsx
|
|
2867
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2868
|
+
var useToast = () => {
|
|
2869
|
+
return (0, import_react16.useCallback)(
|
|
2870
|
+
({ message, action, colorScheme, icon, position = "bottom-left", duration = 3e3 }) => {
|
|
2871
|
+
import_sonner2.toast.custom(
|
|
2872
|
+
() => {
|
|
2873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2874
|
+
Toast,
|
|
2875
|
+
{
|
|
2876
|
+
action,
|
|
2877
|
+
colorScheme,
|
|
2878
|
+
icon,
|
|
2879
|
+
message
|
|
2807
2880
|
}
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
if (!focusElement2 && process.env["NODE_ENV"] === "development") {
|
|
2813
|
-
console.warn(
|
|
2814
|
-
'[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.',
|
|
2815
|
-
node2
|
|
2816
|
-
);
|
|
2817
|
-
}
|
|
2818
|
-
};
|
|
2819
|
-
setTimeout(() => {
|
|
2820
|
-
if (node.ownerDocument) {
|
|
2821
|
-
processNode(node);
|
|
2822
|
-
}
|
|
2823
|
-
if (!node.ownerDocument && process.env["NODE_ENV"] === "development") {
|
|
2824
|
-
console.warn(
|
|
2825
|
-
"[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.",
|
|
2826
|
-
node
|
|
2827
|
-
);
|
|
2828
|
-
}
|
|
2829
|
-
});
|
|
2830
|
-
ref.current = node;
|
|
2831
|
-
} else {
|
|
2832
|
-
ref.current = null;
|
|
2833
|
-
}
|
|
2881
|
+
);
|
|
2882
|
+
},
|
|
2883
|
+
{ position, duration }
|
|
2884
|
+
);
|
|
2834
2885
|
},
|
|
2835
|
-
[
|
|
2886
|
+
[]
|
|
2836
2887
|
);
|
|
2837
|
-
(0, import_react14.useEffect)(() => {
|
|
2838
|
-
if (!active) {
|
|
2839
|
-
return void 0;
|
|
2840
|
-
}
|
|
2841
|
-
const handleKeyDown = (event) => {
|
|
2842
|
-
if (event.key === "Tab" && ref.current) {
|
|
2843
|
-
scopeTab(ref.current, event);
|
|
2844
|
-
}
|
|
2845
|
-
};
|
|
2846
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
2847
|
-
return () => {
|
|
2848
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
2849
|
-
};
|
|
2850
|
-
}, [active]);
|
|
2851
|
-
return setRef;
|
|
2852
2888
|
};
|
|
2853
2889
|
|
|
2854
2890
|
// src/components/ActionButton/ActionButton.tsx
|
|
2855
|
-
var
|
|
2891
|
+
var import_react20 = require("react");
|
|
2856
2892
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
2857
2893
|
|
|
2858
2894
|
// src/components/Button/Button.tsx
|
|
2859
|
-
var
|
|
2895
|
+
var import_react19 = require("react");
|
|
2860
2896
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2861
2897
|
var import_type_guards15 = require("@wistia/type-guards");
|
|
2862
2898
|
|
|
@@ -6918,13 +6954,13 @@ var iconMap = {
|
|
|
6918
6954
|
|
|
6919
6955
|
// src/private/hooks/useResponsiveProp/useResponsiveProp.ts
|
|
6920
6956
|
var import_type_guards12 = require("@wistia/type-guards");
|
|
6921
|
-
var
|
|
6957
|
+
var import_react17 = require("react");
|
|
6922
6958
|
var isResponsiveObject = (values) => {
|
|
6923
6959
|
return typeof values === "object" && values !== null && !Array.isArray(values) && "base" in values;
|
|
6924
6960
|
};
|
|
6925
6961
|
var useResponsiveProp = (values) => {
|
|
6926
6962
|
const activeMediaQueries = useActiveMq();
|
|
6927
|
-
return (0,
|
|
6963
|
+
return (0, import_react17.useMemo)(() => {
|
|
6928
6964
|
if ((0, import_type_guards12.isRecord)(values) && isResponsiveObject(values)) {
|
|
6929
6965
|
const mq2 = activeMediaQueries.find((key) => key in values);
|
|
6930
6966
|
return (0, import_type_guards12.isNotUndefined)(mq2) && (0, import_type_guards12.isNotUndefined)(values[mq2]) ? values[mq2] : values.base;
|
|
@@ -6991,7 +7027,7 @@ var Icon = ({
|
|
|
6991
7027
|
Icon.displayName = "Icon";
|
|
6992
7028
|
|
|
6993
7029
|
// src/components/Link/Link.tsx
|
|
6994
|
-
var
|
|
7030
|
+
var import_react18 = require("react");
|
|
6995
7031
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
6996
7032
|
var import_react_router_dom = require("react-router-dom");
|
|
6997
7033
|
var import_type_guards14 = require("@wistia/type-guards");
|
|
@@ -7029,7 +7065,7 @@ var StyledLink = import_styled_components20.default.a`
|
|
|
7029
7065
|
}
|
|
7030
7066
|
}
|
|
7031
7067
|
`;
|
|
7032
|
-
var Link = (0,
|
|
7068
|
+
var Link = (0, import_react18.forwardRef)(
|
|
7033
7069
|
({
|
|
7034
7070
|
beforeAction,
|
|
7035
7071
|
children,
|
|
@@ -7170,7 +7206,7 @@ var ButtonContent = ({
|
|
|
7170
7206
|
)
|
|
7171
7207
|
] });
|
|
7172
7208
|
};
|
|
7173
|
-
var Button = (0,
|
|
7209
|
+
var Button = (0, import_react19.forwardRef)(
|
|
7174
7210
|
({
|
|
7175
7211
|
children,
|
|
7176
7212
|
forceState,
|
|
@@ -7349,7 +7385,7 @@ var StyledLabel = import_styled_components22.default.span`
|
|
|
7349
7385
|
grid-row: 2;
|
|
7350
7386
|
text-align: left;
|
|
7351
7387
|
`;
|
|
7352
|
-
var ActionButton = (0,
|
|
7388
|
+
var ActionButton = (0, import_react20.forwardRef)(
|
|
7353
7389
|
({
|
|
7354
7390
|
icon,
|
|
7355
7391
|
colorScheme = "default",
|
|
@@ -7393,7 +7429,7 @@ var ActionButton = (0, import_react18.forwardRef)(
|
|
|
7393
7429
|
ActionButton.displayName = "ActionButton";
|
|
7394
7430
|
|
|
7395
7431
|
// src/components/Avatar/Avatar.tsx
|
|
7396
|
-
var
|
|
7432
|
+
var import_react21 = require("react");
|
|
7397
7433
|
var import_type_guards18 = require("@wistia/type-guards");
|
|
7398
7434
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
7399
7435
|
|
|
@@ -7601,8 +7637,8 @@ var Avatar = ({
|
|
|
7601
7637
|
onImageLoad,
|
|
7602
7638
|
...props
|
|
7603
7639
|
}) => {
|
|
7604
|
-
const [imageLoadState, setImageLoadState] = (0,
|
|
7605
|
-
(0,
|
|
7640
|
+
const [imageLoadState, setImageLoadState] = (0, import_react21.useState)("loading");
|
|
7641
|
+
(0, import_react21.useEffect)(() => {
|
|
7606
7642
|
setImageLoadState("loading");
|
|
7607
7643
|
}, [imageUrl]);
|
|
7608
7644
|
const handleImageLoad = () => {
|
|
@@ -7614,7 +7650,7 @@ var Avatar = ({
|
|
|
7614
7650
|
onImageLoad?.({ state: "error", type: "initials" });
|
|
7615
7651
|
};
|
|
7616
7652
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
7617
|
-
const avatarColor = (0,
|
|
7653
|
+
const avatarColor = (0, import_react21.useMemo)(() => chooseColorScheme(name), [name]);
|
|
7618
7654
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
|
|
7619
7655
|
AvatarWrapper,
|
|
7620
7656
|
{
|
|
@@ -7641,7 +7677,7 @@ var Avatar = ({
|
|
|
7641
7677
|
Avatar.displayName = "Avatar";
|
|
7642
7678
|
|
|
7643
7679
|
// src/components/Badge/Badge.tsx
|
|
7644
|
-
var
|
|
7680
|
+
var import_react22 = require("react");
|
|
7645
7681
|
var import_styled_components26 = __toESM(require("styled-components"));
|
|
7646
7682
|
var import_type_guards19 = require("@wistia/type-guards");
|
|
7647
7683
|
var import_jsx_runtime198 = require("react/jsx-runtime");
|
|
@@ -7665,7 +7701,7 @@ var StyledBadge = import_styled_components26.default.div`
|
|
|
7665
7701
|
width: 12px;
|
|
7666
7702
|
}
|
|
7667
7703
|
`;
|
|
7668
|
-
var Badge = (0,
|
|
7704
|
+
var Badge = (0, import_react22.forwardRef)(
|
|
7669
7705
|
({ colorScheme = "inherit", label, icon, ...props }, ref) => {
|
|
7670
7706
|
const hasIcon = (0, import_type_guards19.isNotNil)(icon);
|
|
7671
7707
|
return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(
|
|
@@ -7686,7 +7722,7 @@ var Badge = (0, import_react20.forwardRef)(
|
|
|
7686
7722
|
Badge.displayName = "Badge";
|
|
7687
7723
|
|
|
7688
7724
|
// src/components/Box/Box.tsx
|
|
7689
|
-
var
|
|
7725
|
+
var import_react23 = require("react");
|
|
7690
7726
|
var import_styled_components27 = __toESM(require("styled-components"));
|
|
7691
7727
|
var import_type_guards20 = require("@wistia/type-guards");
|
|
7692
7728
|
|
|
@@ -7795,13 +7831,13 @@ var StyledBoxComponent = import_styled_components27.default.div`
|
|
|
7795
7831
|
var wrapChildren = (children) => {
|
|
7796
7832
|
if ((0, import_type_guards20.isNotNil)(children)) {
|
|
7797
7833
|
if (typeof children === "object" && isDev) {
|
|
7798
|
-
return
|
|
7834
|
+
return import_react23.Children.map(children, (child) => {
|
|
7799
7835
|
if ((0, import_type_guards20.isNil)(child)) return null;
|
|
7800
7836
|
const elementParams = {};
|
|
7801
7837
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
7802
7838
|
elementParams.hasBoxParent = true;
|
|
7803
7839
|
}
|
|
7804
|
-
return (0,
|
|
7840
|
+
return (0, import_react23.cloneElement)(child, elementParams);
|
|
7805
7841
|
});
|
|
7806
7842
|
}
|
|
7807
7843
|
return children;
|
|
@@ -7809,7 +7845,7 @@ var wrapChildren = (children) => {
|
|
|
7809
7845
|
return null;
|
|
7810
7846
|
};
|
|
7811
7847
|
var DEFAULT_ELEMENT = "div";
|
|
7812
|
-
var BoxComponent = (0,
|
|
7848
|
+
var BoxComponent = (0, import_react23.forwardRef)(
|
|
7813
7849
|
({
|
|
7814
7850
|
alignContent = "stretch",
|
|
7815
7851
|
alignItems = "flex-start",
|
|
@@ -7834,8 +7870,14 @@ var BoxComponent = (0, import_react21.forwardRef)(
|
|
|
7834
7870
|
flexMode,
|
|
7835
7871
|
...props
|
|
7836
7872
|
}, ref) => {
|
|
7873
|
+
const responsiveAlignContent = useResponsiveProp(alignContent);
|
|
7874
|
+
const responsiveAlignItems = useResponsiveProp(alignItems);
|
|
7875
|
+
const responsiveDirection = useResponsiveProp(direction);
|
|
7876
|
+
const responsiveFill = useResponsiveProp(fill);
|
|
7877
|
+
const responsiveGap = useResponsiveProp(gap);
|
|
7878
|
+
const responsiveJustifyContent = useResponsiveProp(justifyContent);
|
|
7837
7879
|
if ((0, import_type_guards20.isNotUndefined)(height)) {
|
|
7838
|
-
if (
|
|
7880
|
+
if (responsiveFill === true || responsiveFill === "vertical") {
|
|
7839
7881
|
throw new Error('Cannot use height prop with fill="vertical" or fill={true}');
|
|
7840
7882
|
}
|
|
7841
7883
|
if (fillViewport === true || fillViewport === "vertical") {
|
|
@@ -7845,7 +7887,7 @@ var BoxComponent = (0, import_react21.forwardRef)(
|
|
|
7845
7887
|
}
|
|
7846
7888
|
}
|
|
7847
7889
|
if ((0, import_type_guards20.isNotUndefined)(width)) {
|
|
7848
|
-
if (
|
|
7890
|
+
if (responsiveFill === true || responsiveFill === "horizontal") {
|
|
7849
7891
|
throw new Error('Cannot use width prop with fill="horizontal" or fill={true}');
|
|
7850
7892
|
}
|
|
7851
7893
|
if (fillViewport === true || fillViewport === "horizontal") {
|
|
@@ -7858,19 +7900,19 @@ var BoxComponent = (0, import_react21.forwardRef)(
|
|
|
7858
7900
|
StyledBoxComponent,
|
|
7859
7901
|
{
|
|
7860
7902
|
ref,
|
|
7861
|
-
$alignContent:
|
|
7862
|
-
$alignItems:
|
|
7903
|
+
$alignContent: responsiveAlignContent,
|
|
7904
|
+
$alignItems: responsiveAlignItems,
|
|
7863
7905
|
$alignSelf: alignSelf,
|
|
7864
7906
|
$basis: basis,
|
|
7865
|
-
$fillBox:
|
|
7907
|
+
$fillBox: responsiveFill,
|
|
7866
7908
|
$fillViewport: fillViewport,
|
|
7867
|
-
$flexDirection:
|
|
7909
|
+
$flexDirection: responsiveDirection,
|
|
7868
7910
|
$flexMode: flexMode,
|
|
7869
|
-
$gap:
|
|
7911
|
+
$gap: responsiveGap,
|
|
7870
7912
|
$grow: grow,
|
|
7871
7913
|
$height: height,
|
|
7872
7914
|
$inline: inline,
|
|
7873
|
-
$justifyContent:
|
|
7915
|
+
$justifyContent: responsiveJustifyContent,
|
|
7874
7916
|
$order: order,
|
|
7875
7917
|
$shrink: shrink,
|
|
7876
7918
|
$width: width,
|
|
@@ -7886,7 +7928,7 @@ BoxComponent.displayName = "Box";
|
|
|
7886
7928
|
var Box = makePolymorphic(BoxComponent);
|
|
7887
7929
|
|
|
7888
7930
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
7889
|
-
var
|
|
7931
|
+
var import_react24 = require("react");
|
|
7890
7932
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
7891
7933
|
var import_jsx_runtime200 = require("react/jsx-runtime");
|
|
7892
7934
|
var StyledBreadcrumbs = import_styled_components28.default.nav`
|
|
@@ -7902,7 +7944,7 @@ var StyledBreadcrumbs = import_styled_components28.default.nav`
|
|
|
7902
7944
|
var BUFFER_WIDTH = 10;
|
|
7903
7945
|
var Breadcrumbs = ({ children, ...props }) => {
|
|
7904
7946
|
const { isXsAndDown } = useMq();
|
|
7905
|
-
let crumbs =
|
|
7947
|
+
let crumbs = import_react24.Children.toArray(children);
|
|
7906
7948
|
if (isXsAndDown) {
|
|
7907
7949
|
crumbs = crumbs.slice(-1);
|
|
7908
7950
|
}
|
|
@@ -8091,7 +8133,7 @@ var Card = ({
|
|
|
8091
8133
|
Card.displayName = "Card";
|
|
8092
8134
|
|
|
8093
8135
|
// src/components/Center/Center.tsx
|
|
8094
|
-
var
|
|
8136
|
+
var import_react25 = require("react");
|
|
8095
8137
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
8096
8138
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
8097
8139
|
var StyledCenter = import_styled_components32.default.div`
|
|
@@ -8106,7 +8148,7 @@ var StyledCenter = import_styled_components32.default.div`
|
|
|
8106
8148
|
align-items: center;
|
|
8107
8149
|
`}
|
|
8108
8150
|
`;
|
|
8109
|
-
var Center = (0,
|
|
8151
|
+
var Center = (0, import_react25.forwardRef)(
|
|
8110
8152
|
({ maxWidth = "100%", gutterWidth = "space-00", intrinsic = false, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
|
|
8111
8153
|
StyledCenter,
|
|
8112
8154
|
{
|
|
@@ -8122,7 +8164,7 @@ var Center = (0, import_react23.forwardRef)(
|
|
|
8122
8164
|
Center.displayName = "Center";
|
|
8123
8165
|
|
|
8124
8166
|
// src/components/Checkbox/Checkbox.tsx
|
|
8125
|
-
var
|
|
8167
|
+
var import_react26 = require("react");
|
|
8126
8168
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
8127
8169
|
var import_type_guards25 = require("@wistia/type-guards");
|
|
8128
8170
|
|
|
@@ -8342,7 +8384,7 @@ var StyledHiddenCheckboxInput = import_styled_components36.default.input`
|
|
|
8342
8384
|
display: block;
|
|
8343
8385
|
}
|
|
8344
8386
|
`;
|
|
8345
|
-
var Checkbox = (0,
|
|
8387
|
+
var Checkbox = (0, import_react26.forwardRef)(
|
|
8346
8388
|
({
|
|
8347
8389
|
checked,
|
|
8348
8390
|
disabled = false,
|
|
@@ -8357,7 +8399,7 @@ var Checkbox = (0, import_react24.forwardRef)(
|
|
|
8357
8399
|
hideLabel = false,
|
|
8358
8400
|
...props
|
|
8359
8401
|
}, ref) => {
|
|
8360
|
-
const generatedId = (0,
|
|
8402
|
+
const generatedId = (0, import_react26.useId)();
|
|
8361
8403
|
const computedId = (0, import_type_guards25.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-${generatedId}`;
|
|
8362
8404
|
return /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)(StyledCheckboxWrapper, { disabled, children: [
|
|
8363
8405
|
/* @__PURE__ */ (0, import_jsx_runtime208.jsx)(
|
|
@@ -8400,9 +8442,9 @@ var Checkbox = (0, import_react24.forwardRef)(
|
|
|
8400
8442
|
Checkbox.displayName = "Checkbox";
|
|
8401
8443
|
|
|
8402
8444
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
8403
|
-
var
|
|
8445
|
+
var import_react27 = require("react");
|
|
8404
8446
|
var ClickRegion = ({ children, targetRef }) => {
|
|
8405
|
-
(0,
|
|
8447
|
+
(0, import_react27.useEffect)(() => {
|
|
8406
8448
|
if (targetRef.current && targetRef.current.tagName === "A") {
|
|
8407
8449
|
targetRef.current.setAttribute("data-click-region-target-link", "");
|
|
8408
8450
|
} else if (targetRef.current && targetRef.current.tagName === "BUTTON") {
|
|
@@ -8410,7 +8452,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8410
8452
|
} else {
|
|
8411
8453
|
}
|
|
8412
8454
|
}, [targetRef]);
|
|
8413
|
-
const handleClick = (0,
|
|
8455
|
+
const handleClick = (0, import_react27.useCallback)(
|
|
8414
8456
|
(event) => {
|
|
8415
8457
|
const node = targetRef.current;
|
|
8416
8458
|
if (event.target instanceof HTMLAnchorElement && !event.target.hasAttribute("data-click-region-target-link") || event.target instanceof HTMLButtonElement && !event.target.hasAttribute("data-click-region-target-button")) {
|
|
@@ -8427,7 +8469,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8427
8469
|
},
|
|
8428
8470
|
[targetRef]
|
|
8429
8471
|
);
|
|
8430
|
-
return (0,
|
|
8472
|
+
return (0, import_react27.cloneElement)(import_react27.Children.only(children), {
|
|
8431
8473
|
"data-click-region": true,
|
|
8432
8474
|
onClick: handleClick
|
|
8433
8475
|
});
|
|
@@ -8460,11 +8502,11 @@ var Collapsible = ({
|
|
|
8460
8502
|
Collapsible.displayName = "Collapsible";
|
|
8461
8503
|
|
|
8462
8504
|
// src/components/Collapsible/CollapsibleTrigger.tsx
|
|
8463
|
-
var
|
|
8505
|
+
var import_react28 = require("react");
|
|
8464
8506
|
var import_react_collapsible2 = require("@radix-ui/react-collapsible");
|
|
8465
8507
|
var import_jsx_runtime210 = require("react/jsx-runtime");
|
|
8466
8508
|
var CollapsibleTrigger = ({ children }) => {
|
|
8467
|
-
|
|
8509
|
+
import_react28.Children.only(children);
|
|
8468
8510
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(import_react_collapsible2.Trigger, { asChild: true, children });
|
|
8469
8511
|
};
|
|
8470
8512
|
|
|
@@ -8491,7 +8533,7 @@ var import_styled_components40 = __toESM(require("styled-components"));
|
|
|
8491
8533
|
var import_type_guards29 = require("@wistia/type-guards");
|
|
8492
8534
|
|
|
8493
8535
|
// src/components/Heading/Heading.tsx
|
|
8494
|
-
var
|
|
8536
|
+
var import_react29 = require("react");
|
|
8495
8537
|
var import_styled_components39 = __toESM(require("styled-components"));
|
|
8496
8538
|
var import_type_guards28 = require("@wistia/type-guards");
|
|
8497
8539
|
var import_jsx_runtime212 = require("react/jsx-runtime");
|
|
@@ -8587,7 +8629,7 @@ var variantElementMap = {
|
|
|
8587
8629
|
heading5: "h5",
|
|
8588
8630
|
heading6: "h6"
|
|
8589
8631
|
};
|
|
8590
|
-
var HeadingComponent = (0,
|
|
8632
|
+
var HeadingComponent = (0, import_react29.forwardRef)(
|
|
8591
8633
|
({
|
|
8592
8634
|
align = "left",
|
|
8593
8635
|
colorScheme = "inherit",
|
|
@@ -8751,7 +8793,7 @@ DataCards.displayName = "DataCards";
|
|
|
8751
8793
|
var import_styled_components43 = __toESM(require("styled-components"));
|
|
8752
8794
|
|
|
8753
8795
|
// src/components/Text/Text.tsx
|
|
8754
|
-
var
|
|
8796
|
+
var import_react30 = require("react");
|
|
8755
8797
|
var import_styled_components42 = __toESM(require("styled-components"));
|
|
8756
8798
|
var import_type_guards30 = require("@wistia/type-guards");
|
|
8757
8799
|
var import_jsx_runtime215 = require("react/jsx-runtime");
|
|
@@ -8926,7 +8968,7 @@ var StyledText = import_styled_components42.default.div`
|
|
|
8926
8968
|
}
|
|
8927
8969
|
`}
|
|
8928
8970
|
`;
|
|
8929
|
-
var TextComponent = (0,
|
|
8971
|
+
var TextComponent = (0, import_react30.forwardRef)(
|
|
8930
8972
|
({
|
|
8931
8973
|
align = "left",
|
|
8932
8974
|
colorScheme = "inherit",
|
|
@@ -9039,7 +9081,7 @@ Divider.displayName = "Divider";
|
|
|
9039
9081
|
|
|
9040
9082
|
// src/components/EditableHeading/EditableHeading.tsx
|
|
9041
9083
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
9042
|
-
var
|
|
9084
|
+
var import_react32 = require("react");
|
|
9043
9085
|
|
|
9044
9086
|
// src/components/Tooltip/Tooltip.tsx
|
|
9045
9087
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
@@ -9137,7 +9179,7 @@ var Tooltip = ({
|
|
|
9137
9179
|
Tooltip.displayName = "Tooltip";
|
|
9138
9180
|
|
|
9139
9181
|
// src/components/Input/Input.tsx
|
|
9140
|
-
var
|
|
9182
|
+
var import_react31 = require("react");
|
|
9141
9183
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
9142
9184
|
var import_type_guards31 = require("@wistia/type-guards");
|
|
9143
9185
|
|
|
@@ -9272,7 +9314,7 @@ var StyledInputContainer = import_styled_components47.default.div`
|
|
|
9272
9314
|
padding-right: 32px;
|
|
9273
9315
|
}
|
|
9274
9316
|
`;
|
|
9275
|
-
var Input = (0,
|
|
9317
|
+
var Input = (0, import_react31.forwardRef)(
|
|
9276
9318
|
({
|
|
9277
9319
|
fullWidth = true,
|
|
9278
9320
|
monospace = false,
|
|
@@ -9282,7 +9324,7 @@ var Input = (0, import_react29.forwardRef)(
|
|
|
9282
9324
|
rightIcon,
|
|
9283
9325
|
...props
|
|
9284
9326
|
}, externalRef) => {
|
|
9285
|
-
const internalRef = (0,
|
|
9327
|
+
const internalRef = (0, import_react31.useRef)();
|
|
9286
9328
|
const ref = (
|
|
9287
9329
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
9288
9330
|
(0, import_type_guards31.isNotNil)(externalRef) && (0, import_type_guards31.isRecord)(externalRef) && "current" in externalRef ? externalRef : internalRef
|
|
@@ -9292,14 +9334,14 @@ var Input = (0, import_react29.forwardRef)(
|
|
|
9292
9334
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(Icon, { type: "search" });
|
|
9293
9335
|
}
|
|
9294
9336
|
if ((0, import_type_guards31.isNotNil)(leftIconToDisplay)) {
|
|
9295
|
-
leftIconToDisplay = (0,
|
|
9337
|
+
leftIconToDisplay = (0, import_react31.cloneElement)(leftIconToDisplay, {
|
|
9296
9338
|
size: "md",
|
|
9297
9339
|
className: "wui-input-left-icon"
|
|
9298
9340
|
});
|
|
9299
9341
|
}
|
|
9300
9342
|
let rightIconToDisplay = rightIcon;
|
|
9301
9343
|
if ((0, import_type_guards31.isNotNil)(rightIconToDisplay)) {
|
|
9302
|
-
rightIconToDisplay = (0,
|
|
9344
|
+
rightIconToDisplay = (0, import_react31.cloneElement)(rightIconToDisplay, {
|
|
9303
9345
|
size: "md",
|
|
9304
9346
|
className: "wui-input-right-icon"
|
|
9305
9347
|
});
|
|
@@ -9391,11 +9433,11 @@ var EditableHeading = ({
|
|
|
9391
9433
|
__forceEditing = false,
|
|
9392
9434
|
editingDisabled = false
|
|
9393
9435
|
}) => {
|
|
9394
|
-
const [isEditing, setIsEditing] = (0,
|
|
9395
|
-
const [value, setValue] = (0,
|
|
9396
|
-
const [previousValue, setPreviousValue] = (0,
|
|
9397
|
-
const [headingHeight, setHeadingHeight] = (0,
|
|
9398
|
-
const headingRef = (0,
|
|
9436
|
+
const [isEditing, setIsEditing] = (0, import_react32.useState)(false);
|
|
9437
|
+
const [value, setValue] = (0, import_react32.useState)(children);
|
|
9438
|
+
const [previousValue, setPreviousValue] = (0, import_react32.useState)(children);
|
|
9439
|
+
const [headingHeight, setHeadingHeight] = (0, import_react32.useState)("60");
|
|
9440
|
+
const headingRef = (0, import_react32.useRef)(null);
|
|
9399
9441
|
const handleSetEditing = (editing) => {
|
|
9400
9442
|
if (editingDisabled) return;
|
|
9401
9443
|
if (editing && headingRef.current) {
|
|
@@ -9474,12 +9516,12 @@ var EditableHeading = ({
|
|
|
9474
9516
|
};
|
|
9475
9517
|
|
|
9476
9518
|
// src/components/Form/Form.tsx
|
|
9477
|
-
var
|
|
9519
|
+
var import_react34 = require("react");
|
|
9478
9520
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
9479
9521
|
var import_type_guards32 = require("@wistia/type-guards");
|
|
9480
9522
|
|
|
9481
9523
|
// src/components/Stack/Stack.tsx
|
|
9482
|
-
var
|
|
9524
|
+
var import_react33 = require("react");
|
|
9483
9525
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
9484
9526
|
var import_jsx_runtime221 = require("react/jsx-runtime");
|
|
9485
9527
|
var DEFAULT_ELEMENT4 = "div";
|
|
@@ -9489,7 +9531,7 @@ var StyledStack = import_styled_components49.default.div`
|
|
|
9489
9531
|
gap: ${({ $gap }) => `var(--wui-${$gap})`};
|
|
9490
9532
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
9491
9533
|
`;
|
|
9492
|
-
var StackComponent = (0,
|
|
9534
|
+
var StackComponent = (0, import_react33.forwardRef)(
|
|
9493
9535
|
({ renderAs, direction = "vertical", gap = "space-02", alignItems = "stretch", ...props }, ref) => {
|
|
9494
9536
|
const responsiveGap = useResponsiveProp(gap);
|
|
9495
9537
|
const responsiveDirection = useResponsiveProp(direction);
|
|
@@ -9518,7 +9560,7 @@ var StyledForm = import_styled_components50.default.form`
|
|
|
9518
9560
|
max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
|
|
9519
9561
|
align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
|
|
9520
9562
|
`;
|
|
9521
|
-
var FormContext = (0,
|
|
9563
|
+
var FormContext = (0, import_react34.createContext)({
|
|
9522
9564
|
values: {},
|
|
9523
9565
|
errors: {},
|
|
9524
9566
|
hasSubmitted: false,
|
|
@@ -9534,11 +9576,11 @@ var FormComponent = ({
|
|
|
9534
9576
|
fullWidth = false,
|
|
9535
9577
|
...props
|
|
9536
9578
|
}, forwardedRef) => {
|
|
9537
|
-
const [errors, setErrors] = (0,
|
|
9538
|
-
const [hasSubmitted, setHasSubmitted] = (0,
|
|
9539
|
-
const innerRef = (0,
|
|
9579
|
+
const [errors, setErrors] = (0, import_react34.useState)({});
|
|
9580
|
+
const [hasSubmitted, setHasSubmitted] = (0, import_react34.useState)(false);
|
|
9581
|
+
const innerRef = (0, import_react34.useRef)();
|
|
9540
9582
|
const ref = forwardedRef ?? innerRef;
|
|
9541
|
-
const autoId = (0,
|
|
9583
|
+
const autoId = (0, import_react34.useId)();
|
|
9542
9584
|
const id = props.id ?? autoId;
|
|
9543
9585
|
const handleValidate = (nextFormData) => {
|
|
9544
9586
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
@@ -9580,7 +9622,7 @@ var FormComponent = ({
|
|
|
9580
9622
|
void action(null);
|
|
9581
9623
|
}
|
|
9582
9624
|
};
|
|
9583
|
-
const context = (0,
|
|
9625
|
+
const context = (0, import_react34.useMemo)(() => {
|
|
9584
9626
|
return {
|
|
9585
9627
|
values,
|
|
9586
9628
|
errors,
|
|
@@ -9609,15 +9651,15 @@ var FormComponent = ({
|
|
|
9609
9651
|
);
|
|
9610
9652
|
};
|
|
9611
9653
|
FormComponent.displayName = "Form";
|
|
9612
|
-
var Form = (0,
|
|
9654
|
+
var Form = (0, import_react34.forwardRef)(FormComponent);
|
|
9613
9655
|
|
|
9614
9656
|
// src/components/Form/useFormState.tsx
|
|
9615
|
-
var
|
|
9657
|
+
var import_react35 = require("react");
|
|
9616
9658
|
var useFormState = (action, initialData = {}) => {
|
|
9617
|
-
const [data, setData] = (0,
|
|
9618
|
-
const [isPending, setIsPending] = (0,
|
|
9619
|
-
const [error, setError] = (0,
|
|
9620
|
-
const formAction = (0,
|
|
9659
|
+
const [data, setData] = (0, import_react35.useState)(initialData);
|
|
9660
|
+
const [isPending, setIsPending] = (0, import_react35.useState)(false);
|
|
9661
|
+
const [error, setError] = (0, import_react35.useState)(null);
|
|
9662
|
+
const formAction = (0, import_react35.useCallback)(
|
|
9621
9663
|
async (nextFormData) => {
|
|
9622
9664
|
if (nextFormData === null) {
|
|
9623
9665
|
setData(initialData);
|
|
@@ -9648,15 +9690,15 @@ var useFormState = (action, initialData = {}) => {
|
|
|
9648
9690
|
};
|
|
9649
9691
|
|
|
9650
9692
|
// src/components/Form/FormErrorSummary.tsx
|
|
9651
|
-
var
|
|
9693
|
+
var import_react36 = require("react");
|
|
9652
9694
|
var import_type_guards33 = require("@wistia/type-guards");
|
|
9653
9695
|
var import_jsx_runtime223 = require("react/jsx-runtime");
|
|
9654
9696
|
var ErrorItem = ({ name, error, formId }) => {
|
|
9655
9697
|
return /* @__PURE__ */ (0, import_jsx_runtime223.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(Link, { href: `#${formId}-${name}`, children: error }) }, name);
|
|
9656
9698
|
};
|
|
9657
9699
|
var FormErrorSummary = ({ description }) => {
|
|
9658
|
-
const ref = (0,
|
|
9659
|
-
const { formId, errors, hasSubmitted } = (0,
|
|
9700
|
+
const ref = (0, import_react36.useRef)(null);
|
|
9701
|
+
const { formId, errors, hasSubmitted } = (0, import_react36.useContext)(FormContext);
|
|
9660
9702
|
const isValid = Object.keys(errors).length === 0;
|
|
9661
9703
|
if (isValid || !hasSubmitted) {
|
|
9662
9704
|
return null;
|
|
@@ -9686,7 +9728,7 @@ var FormErrorSummary = ({ description }) => {
|
|
|
9686
9728
|
};
|
|
9687
9729
|
|
|
9688
9730
|
// src/components/FormField/FormField.tsx
|
|
9689
|
-
var
|
|
9731
|
+
var import_react39 = require("react");
|
|
9690
9732
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
9691
9733
|
var import_type_guards34 = require("@wistia/type-guards");
|
|
9692
9734
|
|
|
@@ -9751,11 +9793,11 @@ var Label = ({
|
|
|
9751
9793
|
Label.displayName = "Label";
|
|
9752
9794
|
|
|
9753
9795
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9754
|
-
var
|
|
9796
|
+
var import_react38 = require("react");
|
|
9755
9797
|
|
|
9756
9798
|
// src/components/FormGroup/FormGroup.tsx
|
|
9757
9799
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
9758
|
-
var
|
|
9800
|
+
var import_react37 = require("react");
|
|
9759
9801
|
var import_jsx_runtime225 = require("react/jsx-runtime");
|
|
9760
9802
|
var StyledFieldset = import_styled_components52.default.fieldset`
|
|
9761
9803
|
border: 0;
|
|
@@ -9764,7 +9806,7 @@ var StyledLegend = import_styled_components52.default.legend`
|
|
|
9764
9806
|
margin-bottom: var(--space-01);
|
|
9765
9807
|
`;
|
|
9766
9808
|
var FormGroup = ({ children, label, ...props }) => {
|
|
9767
|
-
const ref = (0,
|
|
9809
|
+
const ref = (0, import_react37.useRef)();
|
|
9768
9810
|
return /* @__PURE__ */ (0, import_jsx_runtime225.jsxs)(
|
|
9769
9811
|
Stack,
|
|
9770
9812
|
{
|
|
@@ -9789,7 +9831,7 @@ FormGroup.displayName = "FormGroup";
|
|
|
9789
9831
|
|
|
9790
9832
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9791
9833
|
var import_jsx_runtime226 = require("react/jsx-runtime");
|
|
9792
|
-
var CheckboxGroupContext = (0,
|
|
9834
|
+
var CheckboxGroupContext = (0, import_react38.createContext)(null);
|
|
9793
9835
|
var CheckboxGroup = ({
|
|
9794
9836
|
children,
|
|
9795
9837
|
name,
|
|
@@ -9797,7 +9839,7 @@ var CheckboxGroup = ({
|
|
|
9797
9839
|
value,
|
|
9798
9840
|
...props
|
|
9799
9841
|
}) => {
|
|
9800
|
-
const context = (0,
|
|
9842
|
+
const context = (0, import_react38.useMemo)(() => {
|
|
9801
9843
|
return {
|
|
9802
9844
|
name,
|
|
9803
9845
|
onChange
|
|
@@ -9882,8 +9924,8 @@ var FormField = ({
|
|
|
9882
9924
|
value,
|
|
9883
9925
|
...props
|
|
9884
9926
|
}) => {
|
|
9885
|
-
const formState = (0,
|
|
9886
|
-
const checkboxGroup = (0,
|
|
9927
|
+
const formState = (0, import_react39.useContext)(FormContext);
|
|
9928
|
+
const checkboxGroup = (0, import_react39.useContext)(CheckboxGroupContext);
|
|
9887
9929
|
const defaultValue = formState.values[name];
|
|
9888
9930
|
const isIntegratedLabel = children.type === Checkbox;
|
|
9889
9931
|
const computedId = id ?? `${formState.formId}-${name}`;
|
|
@@ -9921,7 +9963,7 @@ var FormField = ({
|
|
|
9921
9963
|
"aria-invalid": (0, import_type_guards34.isNotNil)(error)
|
|
9922
9964
|
};
|
|
9923
9965
|
}
|
|
9924
|
-
|
|
9966
|
+
import_react39.Children.only(children);
|
|
9925
9967
|
return /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(
|
|
9926
9968
|
StyledFormField,
|
|
9927
9969
|
{
|
|
@@ -9930,7 +9972,7 @@ var FormField = ({
|
|
|
9930
9972
|
children: [
|
|
9931
9973
|
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(Label, { htmlFor: computedId, children: label }),
|
|
9932
9974
|
(0, import_type_guards34.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
9933
|
-
(0,
|
|
9975
|
+
(0, import_react39.cloneElement)(children, childProps),
|
|
9934
9976
|
(0, import_type_guards34.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(import_jsx_runtime227.Fragment, { children: [
|
|
9935
9977
|
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)("div", {}),
|
|
9936
9978
|
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
@@ -9948,9 +9990,9 @@ var FormField = ({
|
|
|
9948
9990
|
FormField.displayName = "FormField";
|
|
9949
9991
|
|
|
9950
9992
|
// src/components/FormGroup/RadioGroup.tsx
|
|
9951
|
-
var
|
|
9993
|
+
var import_react40 = require("react");
|
|
9952
9994
|
var import_jsx_runtime228 = require("react/jsx-runtime");
|
|
9953
|
-
var RadioGroupContext = (0,
|
|
9995
|
+
var RadioGroupContext = (0, import_react40.createContext)(null);
|
|
9954
9996
|
var RadioGroup = ({
|
|
9955
9997
|
children,
|
|
9956
9998
|
name,
|
|
@@ -9958,7 +10000,7 @@ var RadioGroup = ({
|
|
|
9958
10000
|
value,
|
|
9959
10001
|
...props
|
|
9960
10002
|
}) => {
|
|
9961
|
-
const context = (0,
|
|
10003
|
+
const context = (0, import_react40.useMemo)(() => {
|
|
9962
10004
|
return {
|
|
9963
10005
|
name,
|
|
9964
10006
|
onChange
|
|
@@ -9969,7 +10011,7 @@ var RadioGroup = ({
|
|
|
9969
10011
|
RadioGroup.displayName = "RadioGroup";
|
|
9970
10012
|
|
|
9971
10013
|
// src/components/IconButton/IconButton.tsx
|
|
9972
|
-
var
|
|
10014
|
+
var import_react41 = require("react");
|
|
9973
10015
|
var import_styled_components54 = __toESM(require("styled-components"));
|
|
9974
10016
|
var import_jsx_runtime229 = require("react/jsx-runtime");
|
|
9975
10017
|
var StyledButton2 = (0, import_styled_components54.default)(Button)`
|
|
@@ -9986,7 +10028,7 @@ var StyledButton2 = (0, import_styled_components54.default)(Button)`
|
|
|
9986
10028
|
align-items: center;
|
|
9987
10029
|
line-height: 1;
|
|
9988
10030
|
`;
|
|
9989
|
-
var IconButton = (0,
|
|
10031
|
+
var IconButton = (0, import_react41.forwardRef)(
|
|
9990
10032
|
({ children, label, size = "md", ...props }, ref) => {
|
|
9991
10033
|
const responsiveSize = useResponsiveProp(size);
|
|
9992
10034
|
return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(
|
|
@@ -9997,7 +10039,7 @@ var IconButton = (0, import_react39.forwardRef)(
|
|
|
9997
10039
|
"aria-label": label,
|
|
9998
10040
|
"data-wistia-ui-icon-button": true,
|
|
9999
10041
|
size: responsiveSize,
|
|
10000
|
-
children: (0,
|
|
10042
|
+
children: (0, import_react41.cloneElement)(import_react41.Children.only(children), {
|
|
10001
10043
|
size: responsiveSize
|
|
10002
10044
|
})
|
|
10003
10045
|
}
|
|
@@ -10008,7 +10050,7 @@ IconButton.displayName = "IconButton";
|
|
|
10008
10050
|
|
|
10009
10051
|
// src/components/InputClickToCopy/InputClickToCopy.tsx
|
|
10010
10052
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
10011
|
-
var
|
|
10053
|
+
var import_react42 = require("react");
|
|
10012
10054
|
var import_type_guards35 = require("@wistia/type-guards");
|
|
10013
10055
|
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
10014
10056
|
var StyledInput2 = (0, import_styled_components55.default)(Input)`
|
|
@@ -10021,10 +10063,10 @@ var StyledInput2 = (0, import_styled_components55.default)(Input)`
|
|
|
10021
10063
|
}
|
|
10022
10064
|
`;
|
|
10023
10065
|
var COPY_SUCCESS_DURATION = 2e3;
|
|
10024
|
-
var InputClickToCopy = (0,
|
|
10066
|
+
var InputClickToCopy = (0, import_react42.forwardRef)(
|
|
10025
10067
|
({ value, onCopy, ...props }, ref) => {
|
|
10026
|
-
const [isCopied, setIsCopied] = (0,
|
|
10027
|
-
(0,
|
|
10068
|
+
const [isCopied, setIsCopied] = (0, import_react42.useState)(false);
|
|
10069
|
+
(0, import_react42.useEffect)(() => {
|
|
10028
10070
|
if (isCopied) {
|
|
10029
10071
|
const timeout = setTimeout(() => {
|
|
10030
10072
|
setIsCopied(false);
|
|
@@ -10074,12 +10116,12 @@ InputClickToCopy.displayName = "InputClickToCopy";
|
|
|
10074
10116
|
var import_styled_components56 = __toESM(require("styled-components"));
|
|
10075
10117
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
10076
10118
|
var import_type_guards36 = require("@wistia/type-guards");
|
|
10077
|
-
var
|
|
10119
|
+
var import_react44 = require("react");
|
|
10078
10120
|
|
|
10079
10121
|
// src/components/Menu/MenuContext.tsx
|
|
10080
|
-
var
|
|
10081
|
-
var MenuContext = (0,
|
|
10082
|
-
var useMenuContext = () => (0,
|
|
10122
|
+
var import_react43 = require("react");
|
|
10123
|
+
var MenuContext = (0, import_react43.createContext)({ compact: false });
|
|
10124
|
+
var useMenuContext = () => (0, import_react43.useContext)(MenuContext);
|
|
10083
10125
|
|
|
10084
10126
|
// src/components/Menu/Menu.tsx
|
|
10085
10127
|
var import_jsx_runtime231 = require("react/jsx-runtime");
|
|
@@ -10183,7 +10225,7 @@ var Menu = ({
|
|
|
10183
10225
|
onInteractOutside,
|
|
10184
10226
|
...props
|
|
10185
10227
|
}) => {
|
|
10186
|
-
const contextValue = (0,
|
|
10228
|
+
const contextValue = (0, import_react44.useMemo)(() => ({ compact }), [compact]);
|
|
10187
10229
|
let controlProps = {
|
|
10188
10230
|
...(0, import_type_guards36.isNotNil)(onOpenChange) && (0, import_type_guards36.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
10189
10231
|
};
|
|
@@ -10257,13 +10299,13 @@ var MenuLabel = ({ children, ...props }) => {
|
|
|
10257
10299
|
MenuLabel.displayName = "MenuLabel";
|
|
10258
10300
|
|
|
10259
10301
|
// src/components/Menu/SubMenu.tsx
|
|
10260
|
-
var
|
|
10302
|
+
var import_react46 = require("react");
|
|
10261
10303
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
10262
10304
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
10263
10305
|
var import_type_guards38 = require("@wistia/type-guards");
|
|
10264
10306
|
|
|
10265
10307
|
// src/components/Menu/MenuItemButton.tsx
|
|
10266
|
-
var
|
|
10308
|
+
var import_react45 = require("react");
|
|
10267
10309
|
var import_styled_components58 = __toESM(require("styled-components"));
|
|
10268
10310
|
var import_type_guards37 = require("@wistia/type-guards");
|
|
10269
10311
|
var import_jsx_runtime233 = require("react/jsx-runtime");
|
|
@@ -10340,7 +10382,7 @@ var StyledBadgeContainer = import_styled_components58.default.div`
|
|
|
10340
10382
|
font-size: var(--wui-typography-label-4-size);
|
|
10341
10383
|
color: var(--wui-color-text-secondary);
|
|
10342
10384
|
`;
|
|
10343
|
-
var MenuItemButton = (0,
|
|
10385
|
+
var MenuItemButton = (0, import_react45.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
10344
10386
|
let { colorScheme, badge } = props;
|
|
10345
10387
|
if (appearance === "dangerous") {
|
|
10346
10388
|
if ((0, import_type_guards37.isNotUndefined)(colorScheme)) {
|
|
@@ -10436,7 +10478,7 @@ var SubMenu = ({
|
|
|
10436
10478
|
...props
|
|
10437
10479
|
}) => {
|
|
10438
10480
|
const { isSmAndUp } = useMq();
|
|
10439
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
10481
|
+
const [isExpanded, setIsExpanded] = (0, import_react46.useState)(false);
|
|
10440
10482
|
const { compact } = useMenuContext();
|
|
10441
10483
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
10442
10484
|
/* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
@@ -10465,10 +10507,10 @@ var SubMenu = ({
|
|
|
10465
10507
|
SubMenu.displayName = "SubMenu";
|
|
10466
10508
|
|
|
10467
10509
|
// src/components/Menu/MenuItem.tsx
|
|
10468
|
-
var
|
|
10510
|
+
var import_react47 = require("react");
|
|
10469
10511
|
var import_react_dropdown_menu4 = require("@radix-ui/react-dropdown-menu");
|
|
10470
10512
|
var import_jsx_runtime236 = require("react/jsx-runtime");
|
|
10471
|
-
var MenuItem = (0,
|
|
10513
|
+
var MenuItem = (0, import_react47.forwardRef)(
|
|
10472
10514
|
({ onSelect = () => null, ...props }, ref) => {
|
|
10473
10515
|
return /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
|
|
10474
10516
|
import_react_dropdown_menu4.DropdownMenuItem,
|
|
@@ -10620,7 +10662,7 @@ var CheckboxMenuItem = ({
|
|
|
10620
10662
|
CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
10621
10663
|
|
|
10622
10664
|
// src/components/Modal/Modal.tsx
|
|
10623
|
-
var
|
|
10665
|
+
var import_react51 = require("react");
|
|
10624
10666
|
var import_styled_components65 = __toESM(require("styled-components"));
|
|
10625
10667
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
10626
10668
|
var import_type_guards41 = require("@wistia/type-guards");
|
|
@@ -10680,19 +10722,19 @@ var ModalHeader = ({
|
|
|
10680
10722
|
};
|
|
10681
10723
|
|
|
10682
10724
|
// src/components/Modal/ModalContent.tsx
|
|
10683
|
-
var
|
|
10725
|
+
var import_react49 = require("react");
|
|
10684
10726
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
10685
10727
|
var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
10686
10728
|
|
|
10687
10729
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
10688
|
-
var
|
|
10730
|
+
var import_react48 = require("react");
|
|
10689
10731
|
var import_type_guards40 = require("@wistia/type-guards");
|
|
10690
10732
|
var useFocusRestore = () => {
|
|
10691
|
-
const previouslyFocusedRef = (0,
|
|
10692
|
-
(0,
|
|
10733
|
+
const previouslyFocusedRef = (0, import_react48.useRef)(null);
|
|
10734
|
+
(0, import_react48.useEffect)(() => {
|
|
10693
10735
|
previouslyFocusedRef.current = document.activeElement;
|
|
10694
10736
|
}, []);
|
|
10695
|
-
(0,
|
|
10737
|
+
(0, import_react48.useEffect)(() => {
|
|
10696
10738
|
return () => {
|
|
10697
10739
|
if ((0, import_type_guards40.isNotNil)(previouslyFocusedRef.current)) {
|
|
10698
10740
|
setTimeout(() => {
|
|
@@ -10746,7 +10788,7 @@ var StyledModalContent = (0, import_styled_components63.default)(import_react_di
|
|
|
10746
10788
|
}
|
|
10747
10789
|
}
|
|
10748
10790
|
`;
|
|
10749
|
-
var ModalContent = (0,
|
|
10791
|
+
var ModalContent = (0, import_react49.forwardRef)(
|
|
10750
10792
|
({ fullHeight, width, children, ...props }, ref) => {
|
|
10751
10793
|
useFocusRestore();
|
|
10752
10794
|
return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
|
|
@@ -10764,7 +10806,7 @@ var ModalContent = (0, import_react47.forwardRef)(
|
|
|
10764
10806
|
);
|
|
10765
10807
|
|
|
10766
10808
|
// src/private/components/Backdrop/Backdrop.tsx
|
|
10767
|
-
var
|
|
10809
|
+
var import_react50 = require("react");
|
|
10768
10810
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
10769
10811
|
var import_jsx_runtime243 = require("react/jsx-runtime");
|
|
10770
10812
|
var backdropAnimationDuration = 150;
|
|
@@ -10802,7 +10844,7 @@ var BackdropComponent = import_styled_components64.default.div`
|
|
|
10802
10844
|
}
|
|
10803
10845
|
}
|
|
10804
10846
|
`;
|
|
10805
|
-
var Backdrop = (0,
|
|
10847
|
+
var Backdrop = (0, import_react50.forwardRef)(
|
|
10806
10848
|
({ alignHorizontal = "center", alignVertical = "center", children, ...otherProps }, ref) => /* @__PURE__ */ (0, import_jsx_runtime243.jsx)(
|
|
10807
10849
|
BackdropComponent,
|
|
10808
10850
|
{
|
|
@@ -10824,7 +10866,7 @@ var ModalBody = import_styled_components65.default.div`
|
|
|
10824
10866
|
display: flex;
|
|
10825
10867
|
order: 2;
|
|
10826
10868
|
`;
|
|
10827
|
-
var Modal = (0,
|
|
10869
|
+
var Modal = (0, import_react51.forwardRef)(
|
|
10828
10870
|
({
|
|
10829
10871
|
children,
|
|
10830
10872
|
fullHeight = false,
|
|
@@ -11038,7 +11080,7 @@ var ProgressBar = ({
|
|
|
11038
11080
|
ProgressBar.displayName = "ProgressBar";
|
|
11039
11081
|
|
|
11040
11082
|
// src/components/Radio/Radio.tsx
|
|
11041
|
-
var
|
|
11083
|
+
var import_react52 = require("react");
|
|
11042
11084
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
11043
11085
|
var import_type_guards44 = require("@wistia/type-guards");
|
|
11044
11086
|
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
@@ -11141,7 +11183,7 @@ var StyledHiddenRadioInput = import_styled_components68.default.input`
|
|
|
11141
11183
|
display: block;
|
|
11142
11184
|
}
|
|
11143
11185
|
`;
|
|
11144
|
-
var Radio = (0,
|
|
11186
|
+
var Radio = (0, import_react52.forwardRef)(
|
|
11145
11187
|
({
|
|
11146
11188
|
checked,
|
|
11147
11189
|
disabled = false,
|
|
@@ -11156,7 +11198,7 @@ var Radio = (0, import_react50.forwardRef)(
|
|
|
11156
11198
|
hideLabel = false,
|
|
11157
11199
|
...props
|
|
11158
11200
|
}, ref) => {
|
|
11159
|
-
const generatedId = (0,
|
|
11201
|
+
const generatedId = (0, import_react52.useId)();
|
|
11160
11202
|
const computedId = (0, import_type_guards44.isNonEmptyString)(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
11161
11203
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(
|
|
11162
11204
|
StyledRadioWrapper,
|
|
@@ -11206,20 +11248,20 @@ var Radio = (0, import_react50.forwardRef)(
|
|
|
11206
11248
|
Radio.displayName = "Radio";
|
|
11207
11249
|
|
|
11208
11250
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
11209
|
-
var
|
|
11251
|
+
var import_react55 = require("react");
|
|
11210
11252
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
11211
11253
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
11212
11254
|
var import_type_guards45 = require("@wistia/type-guards");
|
|
11213
11255
|
|
|
11214
11256
|
// src/components/SegmentedControl/useSelectedItemStyle.tsx
|
|
11215
|
-
var
|
|
11257
|
+
var import_react53 = require("react");
|
|
11216
11258
|
var import_jsx_runtime248 = require("react/jsx-runtime");
|
|
11217
|
-
var SelectedItemStyleContext = (0,
|
|
11259
|
+
var SelectedItemStyleContext = (0, import_react53.createContext)(null);
|
|
11218
11260
|
var SelectedItemStyleProvider = ({
|
|
11219
11261
|
children
|
|
11220
11262
|
}) => {
|
|
11221
|
-
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0,
|
|
11222
|
-
const selectedItemIndicatorStyle = (0,
|
|
11263
|
+
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0, import_react53.useState)(null);
|
|
11264
|
+
const selectedItemIndicatorStyle = (0, import_react53.useMemo)(
|
|
11223
11265
|
() => selectedItemMeasurements != null ? {
|
|
11224
11266
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
11225
11267
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px) translateY(-50%)`,
|
|
@@ -11229,7 +11271,7 @@ var SelectedItemStyleProvider = ({
|
|
|
11229
11271
|
},
|
|
11230
11272
|
[selectedItemMeasurements]
|
|
11231
11273
|
);
|
|
11232
|
-
const contextValue = (0,
|
|
11274
|
+
const contextValue = (0, import_react53.useMemo)(
|
|
11233
11275
|
() => ({
|
|
11234
11276
|
setSelectedItemMeasurements,
|
|
11235
11277
|
selectedItemIndicatorStyle
|
|
@@ -11239,7 +11281,7 @@ var SelectedItemStyleProvider = ({
|
|
|
11239
11281
|
return /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(SelectedItemStyleContext.Provider, { value: contextValue, children });
|
|
11240
11282
|
};
|
|
11241
11283
|
var useSelectedItemStyle = () => {
|
|
11242
|
-
const context = (0,
|
|
11284
|
+
const context = (0, import_react53.useContext)(SelectedItemStyleContext);
|
|
11243
11285
|
if (context === null) {
|
|
11244
11286
|
throw new Error("useSelectedItemStyle must be used within a SelectedItemStyleProvider");
|
|
11245
11287
|
}
|
|
@@ -11250,11 +11292,11 @@ var useSelectedItemStyle = () => {
|
|
|
11250
11292
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
11251
11293
|
|
|
11252
11294
|
// src/components/SegmentedControl/useSegmentedControlValue.tsx
|
|
11253
|
-
var
|
|
11254
|
-
var SegmentedControlValueContext = (0,
|
|
11295
|
+
var import_react54 = require("react");
|
|
11296
|
+
var SegmentedControlValueContext = (0, import_react54.createContext)(null);
|
|
11255
11297
|
var SegmentedControlValueProvider = SegmentedControlValueContext.Provider;
|
|
11256
11298
|
var useSegmentedControlValue = () => {
|
|
11257
|
-
const context = (0,
|
|
11299
|
+
const context = (0, import_react54.useContext)(SegmentedControlValueContext);
|
|
11258
11300
|
if (context === null) {
|
|
11259
11301
|
throw new Error("useSegmentedControlValue must be used within a SegmentedControlValueProvider");
|
|
11260
11302
|
}
|
|
@@ -11300,7 +11342,7 @@ var segmentedControlStyles = import_styled_components70.css`
|
|
|
11300
11342
|
var StyledSegmentedControl = (0, import_styled_components70.default)(import_react_toggle_group.Root)`
|
|
11301
11343
|
${segmentedControlStyles}
|
|
11302
11344
|
`;
|
|
11303
|
-
var SegmentedControl = (0,
|
|
11345
|
+
var SegmentedControl = (0, import_react55.forwardRef)(
|
|
11304
11346
|
({
|
|
11305
11347
|
children,
|
|
11306
11348
|
disabled = false,
|
|
@@ -11335,7 +11377,7 @@ var SegmentedControl = (0, import_react53.forwardRef)(
|
|
|
11335
11377
|
SegmentedControl.displayName = "SegmentedControl";
|
|
11336
11378
|
|
|
11337
11379
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
11338
|
-
var
|
|
11380
|
+
var import_react56 = require("react");
|
|
11339
11381
|
var import_styled_components71 = __toESM(require("styled-components"));
|
|
11340
11382
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
11341
11383
|
var import_type_guards46 = require("@wistia/type-guards");
|
|
@@ -11403,11 +11445,11 @@ var segmentedControlItemStyles = import_styled_components71.css`
|
|
|
11403
11445
|
var StyledSegmentedControlItem = (0, import_styled_components71.default)(import_react_toggle_group2.Item)`
|
|
11404
11446
|
${segmentedControlItemStyles}
|
|
11405
11447
|
`;
|
|
11406
|
-
var SegmentedControlItem = (0,
|
|
11448
|
+
var SegmentedControlItem = (0, import_react56.forwardRef)(
|
|
11407
11449
|
({ disabled, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11408
11450
|
const selectedValue = useSegmentedControlValue();
|
|
11409
11451
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
11410
|
-
const buttonRef = (0,
|
|
11452
|
+
const buttonRef = (0, import_react56.useRef)(null);
|
|
11411
11453
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11412
11454
|
const handleClick = (event) => {
|
|
11413
11455
|
const target = event.target;
|
|
@@ -11416,7 +11458,7 @@ var SegmentedControlItem = (0, import_react54.forwardRef)(
|
|
|
11416
11458
|
event.preventDefault();
|
|
11417
11459
|
}
|
|
11418
11460
|
};
|
|
11419
|
-
(0,
|
|
11461
|
+
(0, import_react56.useEffect)(() => {
|
|
11420
11462
|
const buttonElem = buttonRef.current;
|
|
11421
11463
|
if (!buttonElem) {
|
|
11422
11464
|
return void 0;
|
|
@@ -11462,7 +11504,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
11462
11504
|
|
|
11463
11505
|
// src/components/Select/Select.tsx
|
|
11464
11506
|
var import_react_select = require("@radix-ui/react-select");
|
|
11465
|
-
var
|
|
11507
|
+
var import_react57 = require("react");
|
|
11466
11508
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
11467
11509
|
var import_jsx_runtime252 = require("react/jsx-runtime");
|
|
11468
11510
|
var StyledTrigger = (0, import_styled_components72.default)(import_react_select.Trigger)`
|
|
@@ -11527,7 +11569,7 @@ var StyledContent3 = (0, import_styled_components72.default)(import_react_select
|
|
|
11527
11569
|
max-height: var(--radix-select-content-available-height);
|
|
11528
11570
|
z-index: var(--wui-zindex-select);
|
|
11529
11571
|
`;
|
|
11530
|
-
var Select = (0,
|
|
11572
|
+
var Select = (0, import_react57.forwardRef)(
|
|
11531
11573
|
({
|
|
11532
11574
|
colorScheme = "inherit",
|
|
11533
11575
|
children,
|
|
@@ -11576,7 +11618,7 @@ Select.displayName = "Select";
|
|
|
11576
11618
|
|
|
11577
11619
|
// src/components/Select/SelectOption.tsx
|
|
11578
11620
|
var import_react_select2 = require("@radix-ui/react-select");
|
|
11579
|
-
var
|
|
11621
|
+
var import_react58 = require("react");
|
|
11580
11622
|
var import_styled_components73 = __toESM(require("styled-components"));
|
|
11581
11623
|
var import_type_guards47 = require("@wistia/type-guards");
|
|
11582
11624
|
var import_jsx_runtime253 = require("react/jsx-runtime");
|
|
@@ -11607,7 +11649,7 @@ var StyledItem = (0, import_styled_components73.default)(import_react_select2.It
|
|
|
11607
11649
|
var StyledIconContainer = import_styled_components73.default.span`
|
|
11608
11650
|
width: 12px;
|
|
11609
11651
|
`;
|
|
11610
|
-
var SelectOption = (0,
|
|
11652
|
+
var SelectOption = (0, import_react58.forwardRef)(
|
|
11611
11653
|
({ children, selectedDisplayValue, ...props }, forwardedRef) => {
|
|
11612
11654
|
return /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(
|
|
11613
11655
|
StyledItem,
|
|
@@ -11655,7 +11697,7 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
11655
11697
|
};
|
|
11656
11698
|
|
|
11657
11699
|
// src/components/Switch/Switch.tsx
|
|
11658
|
-
var
|
|
11700
|
+
var import_react59 = require("react");
|
|
11659
11701
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
11660
11702
|
var import_type_guards48 = require("@wistia/type-guards");
|
|
11661
11703
|
var import_jsx_runtime255 = require("react/jsx-runtime");
|
|
@@ -11760,7 +11802,7 @@ var StyledHiddenSwitchInput = import_styled_components75.default.input`
|
|
|
11760
11802
|
}
|
|
11761
11803
|
}
|
|
11762
11804
|
`;
|
|
11763
|
-
var Switch = (0,
|
|
11805
|
+
var Switch = (0, import_react59.forwardRef)(
|
|
11764
11806
|
({
|
|
11765
11807
|
checked,
|
|
11766
11808
|
disabled = false,
|
|
@@ -11775,7 +11817,7 @@ var Switch = (0, import_react57.forwardRef)(
|
|
|
11775
11817
|
hideLabel = false,
|
|
11776
11818
|
...props
|
|
11777
11819
|
}, ref) => {
|
|
11778
|
-
const generatedId = (0,
|
|
11820
|
+
const generatedId = (0, import_react59.useId)();
|
|
11779
11821
|
const computedId = (0, import_type_guards48.isNonEmptyString)(id) ? id : `wistia-ui-switch-${generatedId}`;
|
|
11780
11822
|
return /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)(StyledSwitchWrapper, { $disabled: disabled, children: [
|
|
11781
11823
|
/* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
|
|
@@ -11824,22 +11866,29 @@ var StyledTable = import_styled_components76.default.table`
|
|
|
11824
11866
|
width: 100%;
|
|
11825
11867
|
border-collapse: collapse;
|
|
11826
11868
|
|
|
11869
|
+
${({ $divided }) => $divided && import_styled_components76.css`
|
|
11870
|
+
tr {
|
|
11871
|
+
border-bottom: 1px solid var(--wui-color-border);
|
|
11872
|
+
}
|
|
11873
|
+
`}
|
|
11874
|
+
|
|
11827
11875
|
${({ $striped }) => $striped && import_styled_components76.css`
|
|
11828
11876
|
tbody tr:nth-child(even) {
|
|
11829
11877
|
background-color: var(--wui-color-bg-surface-secondary);
|
|
11830
11878
|
}
|
|
11831
11879
|
`}
|
|
11832
11880
|
|
|
11833
|
-
${({ $
|
|
11834
|
-
|
|
11835
|
-
|
|
11881
|
+
${({ $visuallyHiddenHeader }) => $visuallyHiddenHeader && import_styled_components76.css`
|
|
11882
|
+
thead {
|
|
11883
|
+
${visuallyHiddenStyle}
|
|
11836
11884
|
}
|
|
11837
11885
|
`}
|
|
11838
11886
|
`;
|
|
11839
11887
|
var Table = ({
|
|
11840
11888
|
children,
|
|
11841
|
-
striped = false,
|
|
11842
11889
|
divided = false,
|
|
11890
|
+
striped = false,
|
|
11891
|
+
visuallyHiddenHeader = false,
|
|
11843
11892
|
...props
|
|
11844
11893
|
}) => {
|
|
11845
11894
|
return /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(
|
|
@@ -11847,6 +11896,7 @@ var Table = ({
|
|
|
11847
11896
|
{
|
|
11848
11897
|
$divided: divided,
|
|
11849
11898
|
$striped: striped,
|
|
11899
|
+
$visuallyHiddenHeader: visuallyHiddenHeader,
|
|
11850
11900
|
...props,
|
|
11851
11901
|
children
|
|
11852
11902
|
}
|
|
@@ -11857,18 +11907,18 @@ var Table = ({
|
|
|
11857
11907
|
var import_styled_components77 = __toESM(require("styled-components"));
|
|
11858
11908
|
|
|
11859
11909
|
// src/components/Table/TableSectionContext.ts
|
|
11860
|
-
var
|
|
11861
|
-
var TableSectionContext = (0,
|
|
11910
|
+
var import_react60 = require("react");
|
|
11911
|
+
var TableSectionContext = (0, import_react60.createContext)(null);
|
|
11862
11912
|
|
|
11863
11913
|
// src/components/Table/TableBody.tsx
|
|
11864
11914
|
var import_jsx_runtime257 = require("react/jsx-runtime");
|
|
11865
|
-
var
|
|
11915
|
+
var StyledTableBody = import_styled_components77.default.tbody``;
|
|
11866
11916
|
var TableBody = ({ children, ...props }) => {
|
|
11867
|
-
return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(TableSectionContext.Provider, { value: "body", children: /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
|
|
11917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(TableSectionContext.Provider, { value: "body", children: /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(StyledTableBody, { ...props, children }) });
|
|
11868
11918
|
};
|
|
11869
11919
|
|
|
11870
11920
|
// src/components/Table/TableCell.tsx
|
|
11871
|
-
var
|
|
11921
|
+
var import_react61 = require("react");
|
|
11872
11922
|
var import_styled_components78 = __toESM(require("styled-components"));
|
|
11873
11923
|
var import_jsx_runtime258 = require("react/jsx-runtime");
|
|
11874
11924
|
var sharedStyles = import_styled_components78.css`
|
|
@@ -11889,19 +11939,19 @@ var StyledTd = import_styled_components78.default.td`
|
|
|
11889
11939
|
line-height: var(--wui-typography-body-2-line-height);
|
|
11890
11940
|
`;
|
|
11891
11941
|
var TableCell = ({ children, ...props }) => {
|
|
11892
|
-
const section = (0,
|
|
11942
|
+
const section = (0, import_react61.useContext)(TableSectionContext);
|
|
11893
11943
|
if (section === "head") {
|
|
11894
11944
|
return /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(StyledTh, { ...props, children });
|
|
11895
11945
|
}
|
|
11896
11946
|
return /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(StyledTd, { ...props, children });
|
|
11897
11947
|
};
|
|
11898
11948
|
|
|
11899
|
-
// src/components/Table/
|
|
11949
|
+
// src/components/Table/TableFoot.tsx
|
|
11900
11950
|
var import_styled_components79 = __toESM(require("styled-components"));
|
|
11901
11951
|
var import_jsx_runtime259 = require("react/jsx-runtime");
|
|
11902
|
-
var
|
|
11903
|
-
var
|
|
11904
|
-
return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(TableSectionContext.Provider, { value: "footer", children: /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(
|
|
11952
|
+
var StyledTableFoot = import_styled_components79.default.tfoot``;
|
|
11953
|
+
var TableFoot = ({ children, ...props }) => {
|
|
11954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(TableSectionContext.Provider, { value: "footer", children: /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(StyledTableFoot, { ...props, children }) });
|
|
11905
11955
|
};
|
|
11906
11956
|
|
|
11907
11957
|
// src/components/Table/TableHead.tsx
|
|
@@ -11915,13 +11965,13 @@ var TableHead = ({ children, ...props }) => {
|
|
|
11915
11965
|
// src/components/Table/TableRow.tsx
|
|
11916
11966
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
11917
11967
|
var import_jsx_runtime261 = require("react/jsx-runtime");
|
|
11918
|
-
var
|
|
11968
|
+
var StyledTableRow = import_styled_components81.default.tr``;
|
|
11919
11969
|
var TableRow = ({ children, ...props }) => {
|
|
11920
|
-
return /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
|
|
11970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(StyledTableRow, { ...props, children });
|
|
11921
11971
|
};
|
|
11922
11972
|
|
|
11923
11973
|
// src/components/Tabs/Tabs.tsx
|
|
11924
|
-
var
|
|
11974
|
+
var import_react65 = require("react");
|
|
11925
11975
|
var import_react_tabs4 = require("@radix-ui/react-tabs");
|
|
11926
11976
|
var import_type_guards50 = require("@wistia/type-guards");
|
|
11927
11977
|
var import_styled_components86 = __toESM(require("styled-components"));
|
|
@@ -11976,17 +12026,17 @@ var TabList = ({
|
|
|
11976
12026
|
TabList.displayName = "TabList";
|
|
11977
12027
|
|
|
11978
12028
|
// src/components/Tabs/TabItem.tsx
|
|
11979
|
-
var
|
|
12029
|
+
var import_react63 = require("react");
|
|
11980
12030
|
var import_styled_components84 = __toESM(require("styled-components"));
|
|
11981
12031
|
var import_react_tabs3 = require("@radix-ui/react-tabs");
|
|
11982
12032
|
var import_type_guards49 = require("@wistia/type-guards");
|
|
11983
12033
|
|
|
11984
12034
|
// src/components/Tabs/useTabsValue.tsx
|
|
11985
|
-
var
|
|
11986
|
-
var TabsValueContext = (0,
|
|
12035
|
+
var import_react62 = require("react");
|
|
12036
|
+
var TabsValueContext = (0, import_react62.createContext)(null);
|
|
11987
12037
|
var TabsValueProvider = TabsValueContext.Provider;
|
|
11988
12038
|
var useTabsValue = () => {
|
|
11989
|
-
const context = (0,
|
|
12039
|
+
const context = (0, import_react62.useContext)(TabsValueContext);
|
|
11990
12040
|
if (context === null) {
|
|
11991
12041
|
throw new Error("useTabsValue must be used within a TabsValueProvider");
|
|
11992
12042
|
}
|
|
@@ -12002,13 +12052,13 @@ var StyledTabItem = (0, import_styled_components84.default)(import_react_tabs3.T
|
|
|
12002
12052
|
outline: none;
|
|
12003
12053
|
}
|
|
12004
12054
|
`;
|
|
12005
|
-
var TabItem = (0,
|
|
12055
|
+
var TabItem = (0, import_react63.forwardRef)(
|
|
12006
12056
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
12007
12057
|
const selectedValue = useTabsValue();
|
|
12008
12058
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
12009
|
-
const buttonRef = (0,
|
|
12059
|
+
const buttonRef = (0, import_react63.useRef)(null);
|
|
12010
12060
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
12011
|
-
(0,
|
|
12061
|
+
(0, import_react63.useEffect)(() => {
|
|
12012
12062
|
const buttonElem = buttonRef.current;
|
|
12013
12063
|
if (!buttonElem) {
|
|
12014
12064
|
return void 0;
|
|
@@ -12052,16 +12102,16 @@ var TabItem = (0, import_react61.forwardRef)(
|
|
|
12052
12102
|
TabItem.displayName = "TabItem";
|
|
12053
12103
|
|
|
12054
12104
|
// src/components/Tabs/extractTabItems.ts
|
|
12055
|
-
var
|
|
12105
|
+
var import_react64 = require("react");
|
|
12056
12106
|
var extractTabItems = (children) => {
|
|
12057
12107
|
const tabItems = [];
|
|
12058
|
-
|
|
12059
|
-
if (!(0,
|
|
12108
|
+
import_react64.Children.forEach(children, (child) => {
|
|
12109
|
+
if (!(0, import_react64.isValidElement)(child)) {
|
|
12060
12110
|
return;
|
|
12061
12111
|
}
|
|
12062
12112
|
if (typeof child.type !== "string" && child.type.displayName === "Tab") {
|
|
12063
12113
|
tabItems.push(child);
|
|
12064
|
-
} else if (child.type ===
|
|
12114
|
+
} else if (child.type === import_react64.Fragment) {
|
|
12065
12115
|
const fragmentElement = child;
|
|
12066
12116
|
tabItems.push(...extractTabItems(fragmentElement.props.children));
|
|
12067
12117
|
} else if ((child.props.children ?? null) != null) {
|
|
@@ -12108,7 +12158,7 @@ var StyledTabsRoot = (0, import_styled_components86.default)(import_react_tabs4.
|
|
|
12108
12158
|
flex-direction: column;
|
|
12109
12159
|
height: ${({ $stickyHeaders }) => $stickyHeaders ? "100%" : "auto"};
|
|
12110
12160
|
`;
|
|
12111
|
-
var Tabs = (0,
|
|
12161
|
+
var Tabs = (0, import_react65.forwardRef)(
|
|
12112
12162
|
({
|
|
12113
12163
|
children,
|
|
12114
12164
|
fullWidth = true,
|
|
@@ -12120,7 +12170,7 @@ var Tabs = (0, import_react63.forwardRef)(
|
|
|
12120
12170
|
...props
|
|
12121
12171
|
}, ref) => {
|
|
12122
12172
|
const tabItems = extractTabItems(children);
|
|
12123
|
-
const [internalSelectedValue, setInternalSelectedValue] = (0,
|
|
12173
|
+
const [internalSelectedValue, setInternalSelectedValue] = (0, import_react65.useState)(defaultSelectedValue);
|
|
12124
12174
|
const modeProps = defaultSelectedValue !== void 0 ? {
|
|
12125
12175
|
defaultValue: defaultSelectedValue,
|
|
12126
12176
|
onValueChange: setInternalSelectedValue
|
|
@@ -12206,15 +12256,15 @@ var Tabs = (0, import_react63.forwardRef)(
|
|
|
12206
12256
|
Tabs.displayName = "Tabs";
|
|
12207
12257
|
|
|
12208
12258
|
// src/components/Tabs/Tab.tsx
|
|
12209
|
-
var
|
|
12259
|
+
var import_react66 = require("react");
|
|
12210
12260
|
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
12211
|
-
var Tab = (0,
|
|
12261
|
+
var Tab = (0, import_react66.forwardRef)(({ children }, ref) => {
|
|
12212
12262
|
return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("div", { ref, children });
|
|
12213
12263
|
});
|
|
12214
12264
|
Tab.displayName = "Tab";
|
|
12215
12265
|
|
|
12216
12266
|
// src/components/Tag/Tag.tsx
|
|
12217
|
-
var
|
|
12267
|
+
var import_react67 = require("react");
|
|
12218
12268
|
var import_styled_components87 = __toESM(require("styled-components"));
|
|
12219
12269
|
var import_type_guards51 = require("@wistia/type-guards");
|
|
12220
12270
|
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
@@ -12331,7 +12381,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
12331
12381
|
)
|
|
12332
12382
|
] });
|
|
12333
12383
|
};
|
|
12334
|
-
var Tag = (0,
|
|
12384
|
+
var Tag = (0, import_react67.forwardRef)(
|
|
12335
12385
|
({ onClickRemove, colorScheme = "inherit", href, icon, label, onClickRemoveLabel, ...props }, ref) => {
|
|
12336
12386
|
const hasIcon = (0, import_type_guards51.isNotNil)(icon);
|
|
12337
12387
|
const labelProps = (0, import_type_guards51.isNotNil)(href) && (0, import_type_guards51.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
@@ -12405,7 +12455,7 @@ var ThumbnailBadge = ({ icon, label, ...props }) => {
|
|
|
12405
12455
|
ThumbnailBadge.displayName = "ThumbnailBadge";
|
|
12406
12456
|
|
|
12407
12457
|
// src/components/Thumbnail/Thumbnail.tsx
|
|
12408
|
-
var
|
|
12458
|
+
var import_react68 = require("react");
|
|
12409
12459
|
var import_styled_components90 = __toESM(require("styled-components"));
|
|
12410
12460
|
var import_type_guards54 = require("@wistia/type-guards");
|
|
12411
12461
|
|
|
@@ -12592,7 +12642,7 @@ var StyledThumbnail = import_styled_components90.default.div`
|
|
|
12592
12642
|
border-radius: calc(8% * (9 / 16)) / 8%;
|
|
12593
12643
|
}
|
|
12594
12644
|
`;
|
|
12595
|
-
var Thumbnail = (0,
|
|
12645
|
+
var Thumbnail = (0, import_react68.forwardRef)(
|
|
12596
12646
|
({
|
|
12597
12647
|
gradientBackground = "defaultMidOne",
|
|
12598
12648
|
thumbnailImageType = "square",
|
|
@@ -12628,7 +12678,7 @@ var Thumbnail = (0, import_react66.forwardRef)(
|
|
|
12628
12678
|
Thumbnail.displayName = "Thumbnail";
|
|
12629
12679
|
|
|
12630
12680
|
// src/components/ThumbnailCollage/ThumbnailCollage.tsx
|
|
12631
|
-
var
|
|
12681
|
+
var import_react69 = __toESM(require("react"));
|
|
12632
12682
|
var import_styled_components91 = __toESM(require("styled-components"));
|
|
12633
12683
|
var import_type_guards55 = require("@wistia/type-guards");
|
|
12634
12684
|
var import_jsx_runtime271 = (
|
|
@@ -12708,10 +12758,10 @@ var ThumbnailCollage = ({
|
|
|
12708
12758
|
gradientBackground = "defaultMidOne",
|
|
12709
12759
|
...props
|
|
12710
12760
|
}) => {
|
|
12711
|
-
const thumbnailArray =
|
|
12761
|
+
const thumbnailArray = import_react69.default.Children.toArray(children);
|
|
12712
12762
|
const truncatedThumbnails = thumbnailArray.slice(0, 3);
|
|
12713
12763
|
const thumbnails = (0, import_type_guards55.isNonEmptyArray)(thumbnailArray) ? truncatedThumbnails.map((child) => {
|
|
12714
|
-
return
|
|
12764
|
+
return import_react69.default.cloneElement(child, {
|
|
12715
12765
|
...child.props,
|
|
12716
12766
|
children: void 0
|
|
12717
12767
|
});
|
|
@@ -12928,7 +12978,7 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
12928
12978
|
Table,
|
|
12929
12979
|
TableBody,
|
|
12930
12980
|
TableCell,
|
|
12931
|
-
|
|
12981
|
+
TableFoot,
|
|
12932
12982
|
TableHead,
|
|
12933
12983
|
TableRow,
|
|
12934
12984
|
Tabs,
|
|
@@ -12949,6 +12999,7 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
12949
12999
|
useActiveMq,
|
|
12950
13000
|
useAriaLive,
|
|
12951
13001
|
useBoolean,
|
|
13002
|
+
useClipboard,
|
|
12952
13003
|
useFilePicker,
|
|
12953
13004
|
useFocusTrap,
|
|
12954
13005
|
useFormState,
|