@wistia/ui 0.8.13 → 0.8.14
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 +546 -501
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +24 -16
- package/dist/index.d.ts +24 -16
- package/dist/index.mjs +379 -335
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
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
|
|
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
2838
|
}) });
|
|
2571
2839
|
}
|
|
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");
|
|
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",
|
|
@@ -7886,7 +7922,7 @@ BoxComponent.displayName = "Box";
|
|
|
7886
7922
|
var Box = makePolymorphic(BoxComponent);
|
|
7887
7923
|
|
|
7888
7924
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
7889
|
-
var
|
|
7925
|
+
var import_react24 = require("react");
|
|
7890
7926
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
7891
7927
|
var import_jsx_runtime200 = require("react/jsx-runtime");
|
|
7892
7928
|
var StyledBreadcrumbs = import_styled_components28.default.nav`
|
|
@@ -7902,7 +7938,7 @@ var StyledBreadcrumbs = import_styled_components28.default.nav`
|
|
|
7902
7938
|
var BUFFER_WIDTH = 10;
|
|
7903
7939
|
var Breadcrumbs = ({ children, ...props }) => {
|
|
7904
7940
|
const { isXsAndDown } = useMq();
|
|
7905
|
-
let crumbs =
|
|
7941
|
+
let crumbs = import_react24.Children.toArray(children);
|
|
7906
7942
|
if (isXsAndDown) {
|
|
7907
7943
|
crumbs = crumbs.slice(-1);
|
|
7908
7944
|
}
|
|
@@ -8091,7 +8127,7 @@ var Card = ({
|
|
|
8091
8127
|
Card.displayName = "Card";
|
|
8092
8128
|
|
|
8093
8129
|
// src/components/Center/Center.tsx
|
|
8094
|
-
var
|
|
8130
|
+
var import_react25 = require("react");
|
|
8095
8131
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
8096
8132
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
8097
8133
|
var StyledCenter = import_styled_components32.default.div`
|
|
@@ -8106,7 +8142,7 @@ var StyledCenter = import_styled_components32.default.div`
|
|
|
8106
8142
|
align-items: center;
|
|
8107
8143
|
`}
|
|
8108
8144
|
`;
|
|
8109
|
-
var Center = (0,
|
|
8145
|
+
var Center = (0, import_react25.forwardRef)(
|
|
8110
8146
|
({ maxWidth = "100%", gutterWidth = "space-00", intrinsic = false, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
|
|
8111
8147
|
StyledCenter,
|
|
8112
8148
|
{
|
|
@@ -8122,7 +8158,7 @@ var Center = (0, import_react23.forwardRef)(
|
|
|
8122
8158
|
Center.displayName = "Center";
|
|
8123
8159
|
|
|
8124
8160
|
// src/components/Checkbox/Checkbox.tsx
|
|
8125
|
-
var
|
|
8161
|
+
var import_react26 = require("react");
|
|
8126
8162
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
8127
8163
|
var import_type_guards25 = require("@wistia/type-guards");
|
|
8128
8164
|
|
|
@@ -8342,7 +8378,7 @@ var StyledHiddenCheckboxInput = import_styled_components36.default.input`
|
|
|
8342
8378
|
display: block;
|
|
8343
8379
|
}
|
|
8344
8380
|
`;
|
|
8345
|
-
var Checkbox = (0,
|
|
8381
|
+
var Checkbox = (0, import_react26.forwardRef)(
|
|
8346
8382
|
({
|
|
8347
8383
|
checked,
|
|
8348
8384
|
disabled = false,
|
|
@@ -8357,7 +8393,7 @@ var Checkbox = (0, import_react24.forwardRef)(
|
|
|
8357
8393
|
hideLabel = false,
|
|
8358
8394
|
...props
|
|
8359
8395
|
}, ref) => {
|
|
8360
|
-
const generatedId = (0,
|
|
8396
|
+
const generatedId = (0, import_react26.useId)();
|
|
8361
8397
|
const computedId = (0, import_type_guards25.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-${generatedId}`;
|
|
8362
8398
|
return /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)(StyledCheckboxWrapper, { disabled, children: [
|
|
8363
8399
|
/* @__PURE__ */ (0, import_jsx_runtime208.jsx)(
|
|
@@ -8400,9 +8436,9 @@ var Checkbox = (0, import_react24.forwardRef)(
|
|
|
8400
8436
|
Checkbox.displayName = "Checkbox";
|
|
8401
8437
|
|
|
8402
8438
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
8403
|
-
var
|
|
8439
|
+
var import_react27 = require("react");
|
|
8404
8440
|
var ClickRegion = ({ children, targetRef }) => {
|
|
8405
|
-
(0,
|
|
8441
|
+
(0, import_react27.useEffect)(() => {
|
|
8406
8442
|
if (targetRef.current && targetRef.current.tagName === "A") {
|
|
8407
8443
|
targetRef.current.setAttribute("data-click-region-target-link", "");
|
|
8408
8444
|
} else if (targetRef.current && targetRef.current.tagName === "BUTTON") {
|
|
@@ -8410,7 +8446,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8410
8446
|
} else {
|
|
8411
8447
|
}
|
|
8412
8448
|
}, [targetRef]);
|
|
8413
|
-
const handleClick = (0,
|
|
8449
|
+
const handleClick = (0, import_react27.useCallback)(
|
|
8414
8450
|
(event) => {
|
|
8415
8451
|
const node = targetRef.current;
|
|
8416
8452
|
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 +8463,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8427
8463
|
},
|
|
8428
8464
|
[targetRef]
|
|
8429
8465
|
);
|
|
8430
|
-
return (0,
|
|
8466
|
+
return (0, import_react27.cloneElement)(import_react27.Children.only(children), {
|
|
8431
8467
|
"data-click-region": true,
|
|
8432
8468
|
onClick: handleClick
|
|
8433
8469
|
});
|
|
@@ -8460,11 +8496,11 @@ var Collapsible = ({
|
|
|
8460
8496
|
Collapsible.displayName = "Collapsible";
|
|
8461
8497
|
|
|
8462
8498
|
// src/components/Collapsible/CollapsibleTrigger.tsx
|
|
8463
|
-
var
|
|
8499
|
+
var import_react28 = require("react");
|
|
8464
8500
|
var import_react_collapsible2 = require("@radix-ui/react-collapsible");
|
|
8465
8501
|
var import_jsx_runtime210 = require("react/jsx-runtime");
|
|
8466
8502
|
var CollapsibleTrigger = ({ children }) => {
|
|
8467
|
-
|
|
8503
|
+
import_react28.Children.only(children);
|
|
8468
8504
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(import_react_collapsible2.Trigger, { asChild: true, children });
|
|
8469
8505
|
};
|
|
8470
8506
|
|
|
@@ -8491,7 +8527,7 @@ var import_styled_components40 = __toESM(require("styled-components"));
|
|
|
8491
8527
|
var import_type_guards29 = require("@wistia/type-guards");
|
|
8492
8528
|
|
|
8493
8529
|
// src/components/Heading/Heading.tsx
|
|
8494
|
-
var
|
|
8530
|
+
var import_react29 = require("react");
|
|
8495
8531
|
var import_styled_components39 = __toESM(require("styled-components"));
|
|
8496
8532
|
var import_type_guards28 = require("@wistia/type-guards");
|
|
8497
8533
|
var import_jsx_runtime212 = require("react/jsx-runtime");
|
|
@@ -8587,7 +8623,7 @@ var variantElementMap = {
|
|
|
8587
8623
|
heading5: "h5",
|
|
8588
8624
|
heading6: "h6"
|
|
8589
8625
|
};
|
|
8590
|
-
var HeadingComponent = (0,
|
|
8626
|
+
var HeadingComponent = (0, import_react29.forwardRef)(
|
|
8591
8627
|
({
|
|
8592
8628
|
align = "left",
|
|
8593
8629
|
colorScheme = "inherit",
|
|
@@ -8751,7 +8787,7 @@ DataCards.displayName = "DataCards";
|
|
|
8751
8787
|
var import_styled_components43 = __toESM(require("styled-components"));
|
|
8752
8788
|
|
|
8753
8789
|
// src/components/Text/Text.tsx
|
|
8754
|
-
var
|
|
8790
|
+
var import_react30 = require("react");
|
|
8755
8791
|
var import_styled_components42 = __toESM(require("styled-components"));
|
|
8756
8792
|
var import_type_guards30 = require("@wistia/type-guards");
|
|
8757
8793
|
var import_jsx_runtime215 = require("react/jsx-runtime");
|
|
@@ -8926,7 +8962,7 @@ var StyledText = import_styled_components42.default.div`
|
|
|
8926
8962
|
}
|
|
8927
8963
|
`}
|
|
8928
8964
|
`;
|
|
8929
|
-
var TextComponent = (0,
|
|
8965
|
+
var TextComponent = (0, import_react30.forwardRef)(
|
|
8930
8966
|
({
|
|
8931
8967
|
align = "left",
|
|
8932
8968
|
colorScheme = "inherit",
|
|
@@ -9039,7 +9075,7 @@ Divider.displayName = "Divider";
|
|
|
9039
9075
|
|
|
9040
9076
|
// src/components/EditableHeading/EditableHeading.tsx
|
|
9041
9077
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
9042
|
-
var
|
|
9078
|
+
var import_react32 = require("react");
|
|
9043
9079
|
|
|
9044
9080
|
// src/components/Tooltip/Tooltip.tsx
|
|
9045
9081
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
@@ -9137,7 +9173,7 @@ var Tooltip = ({
|
|
|
9137
9173
|
Tooltip.displayName = "Tooltip";
|
|
9138
9174
|
|
|
9139
9175
|
// src/components/Input/Input.tsx
|
|
9140
|
-
var
|
|
9176
|
+
var import_react31 = require("react");
|
|
9141
9177
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
9142
9178
|
var import_type_guards31 = require("@wistia/type-guards");
|
|
9143
9179
|
|
|
@@ -9272,7 +9308,7 @@ var StyledInputContainer = import_styled_components47.default.div`
|
|
|
9272
9308
|
padding-right: 32px;
|
|
9273
9309
|
}
|
|
9274
9310
|
`;
|
|
9275
|
-
var Input = (0,
|
|
9311
|
+
var Input = (0, import_react31.forwardRef)(
|
|
9276
9312
|
({
|
|
9277
9313
|
fullWidth = true,
|
|
9278
9314
|
monospace = false,
|
|
@@ -9282,7 +9318,7 @@ var Input = (0, import_react29.forwardRef)(
|
|
|
9282
9318
|
rightIcon,
|
|
9283
9319
|
...props
|
|
9284
9320
|
}, externalRef) => {
|
|
9285
|
-
const internalRef = (0,
|
|
9321
|
+
const internalRef = (0, import_react31.useRef)();
|
|
9286
9322
|
const ref = (
|
|
9287
9323
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
9288
9324
|
(0, import_type_guards31.isNotNil)(externalRef) && (0, import_type_guards31.isRecord)(externalRef) && "current" in externalRef ? externalRef : internalRef
|
|
@@ -9292,14 +9328,14 @@ var Input = (0, import_react29.forwardRef)(
|
|
|
9292
9328
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(Icon, { type: "search" });
|
|
9293
9329
|
}
|
|
9294
9330
|
if ((0, import_type_guards31.isNotNil)(leftIconToDisplay)) {
|
|
9295
|
-
leftIconToDisplay = (0,
|
|
9331
|
+
leftIconToDisplay = (0, import_react31.cloneElement)(leftIconToDisplay, {
|
|
9296
9332
|
size: "md",
|
|
9297
9333
|
className: "wui-input-left-icon"
|
|
9298
9334
|
});
|
|
9299
9335
|
}
|
|
9300
9336
|
let rightIconToDisplay = rightIcon;
|
|
9301
9337
|
if ((0, import_type_guards31.isNotNil)(rightIconToDisplay)) {
|
|
9302
|
-
rightIconToDisplay = (0,
|
|
9338
|
+
rightIconToDisplay = (0, import_react31.cloneElement)(rightIconToDisplay, {
|
|
9303
9339
|
size: "md",
|
|
9304
9340
|
className: "wui-input-right-icon"
|
|
9305
9341
|
});
|
|
@@ -9391,11 +9427,11 @@ var EditableHeading = ({
|
|
|
9391
9427
|
__forceEditing = false,
|
|
9392
9428
|
editingDisabled = false
|
|
9393
9429
|
}) => {
|
|
9394
|
-
const [isEditing, setIsEditing] = (0,
|
|
9395
|
-
const [value, setValue] = (0,
|
|
9396
|
-
const [previousValue, setPreviousValue] = (0,
|
|
9397
|
-
const [headingHeight, setHeadingHeight] = (0,
|
|
9398
|
-
const headingRef = (0,
|
|
9430
|
+
const [isEditing, setIsEditing] = (0, import_react32.useState)(false);
|
|
9431
|
+
const [value, setValue] = (0, import_react32.useState)(children);
|
|
9432
|
+
const [previousValue, setPreviousValue] = (0, import_react32.useState)(children);
|
|
9433
|
+
const [headingHeight, setHeadingHeight] = (0, import_react32.useState)("60");
|
|
9434
|
+
const headingRef = (0, import_react32.useRef)(null);
|
|
9399
9435
|
const handleSetEditing = (editing) => {
|
|
9400
9436
|
if (editingDisabled) return;
|
|
9401
9437
|
if (editing && headingRef.current) {
|
|
@@ -9474,12 +9510,12 @@ var EditableHeading = ({
|
|
|
9474
9510
|
};
|
|
9475
9511
|
|
|
9476
9512
|
// src/components/Form/Form.tsx
|
|
9477
|
-
var
|
|
9513
|
+
var import_react34 = require("react");
|
|
9478
9514
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
9479
9515
|
var import_type_guards32 = require("@wistia/type-guards");
|
|
9480
9516
|
|
|
9481
9517
|
// src/components/Stack/Stack.tsx
|
|
9482
|
-
var
|
|
9518
|
+
var import_react33 = require("react");
|
|
9483
9519
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
9484
9520
|
var import_jsx_runtime221 = require("react/jsx-runtime");
|
|
9485
9521
|
var DEFAULT_ELEMENT4 = "div";
|
|
@@ -9489,7 +9525,7 @@ var StyledStack = import_styled_components49.default.div`
|
|
|
9489
9525
|
gap: ${({ $gap }) => `var(--wui-${$gap})`};
|
|
9490
9526
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
9491
9527
|
`;
|
|
9492
|
-
var StackComponent = (0,
|
|
9528
|
+
var StackComponent = (0, import_react33.forwardRef)(
|
|
9493
9529
|
({ renderAs, direction = "vertical", gap = "space-02", alignItems = "stretch", ...props }, ref) => {
|
|
9494
9530
|
const responsiveGap = useResponsiveProp(gap);
|
|
9495
9531
|
const responsiveDirection = useResponsiveProp(direction);
|
|
@@ -9518,7 +9554,7 @@ var StyledForm = import_styled_components50.default.form`
|
|
|
9518
9554
|
max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
|
|
9519
9555
|
align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
|
|
9520
9556
|
`;
|
|
9521
|
-
var FormContext = (0,
|
|
9557
|
+
var FormContext = (0, import_react34.createContext)({
|
|
9522
9558
|
values: {},
|
|
9523
9559
|
errors: {},
|
|
9524
9560
|
hasSubmitted: false,
|
|
@@ -9534,11 +9570,11 @@ var FormComponent = ({
|
|
|
9534
9570
|
fullWidth = false,
|
|
9535
9571
|
...props
|
|
9536
9572
|
}, forwardedRef) => {
|
|
9537
|
-
const [errors, setErrors] = (0,
|
|
9538
|
-
const [hasSubmitted, setHasSubmitted] = (0,
|
|
9539
|
-
const innerRef = (0,
|
|
9573
|
+
const [errors, setErrors] = (0, import_react34.useState)({});
|
|
9574
|
+
const [hasSubmitted, setHasSubmitted] = (0, import_react34.useState)(false);
|
|
9575
|
+
const innerRef = (0, import_react34.useRef)();
|
|
9540
9576
|
const ref = forwardedRef ?? innerRef;
|
|
9541
|
-
const autoId = (0,
|
|
9577
|
+
const autoId = (0, import_react34.useId)();
|
|
9542
9578
|
const id = props.id ?? autoId;
|
|
9543
9579
|
const handleValidate = (nextFormData) => {
|
|
9544
9580
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
@@ -9580,7 +9616,7 @@ var FormComponent = ({
|
|
|
9580
9616
|
void action(null);
|
|
9581
9617
|
}
|
|
9582
9618
|
};
|
|
9583
|
-
const context = (0,
|
|
9619
|
+
const context = (0, import_react34.useMemo)(() => {
|
|
9584
9620
|
return {
|
|
9585
9621
|
values,
|
|
9586
9622
|
errors,
|
|
@@ -9609,15 +9645,15 @@ var FormComponent = ({
|
|
|
9609
9645
|
);
|
|
9610
9646
|
};
|
|
9611
9647
|
FormComponent.displayName = "Form";
|
|
9612
|
-
var Form = (0,
|
|
9648
|
+
var Form = (0, import_react34.forwardRef)(FormComponent);
|
|
9613
9649
|
|
|
9614
9650
|
// src/components/Form/useFormState.tsx
|
|
9615
|
-
var
|
|
9651
|
+
var import_react35 = require("react");
|
|
9616
9652
|
var useFormState = (action, initialData = {}) => {
|
|
9617
|
-
const [data, setData] = (0,
|
|
9618
|
-
const [isPending, setIsPending] = (0,
|
|
9619
|
-
const [error, setError] = (0,
|
|
9620
|
-
const formAction = (0,
|
|
9653
|
+
const [data, setData] = (0, import_react35.useState)(initialData);
|
|
9654
|
+
const [isPending, setIsPending] = (0, import_react35.useState)(false);
|
|
9655
|
+
const [error, setError] = (0, import_react35.useState)(null);
|
|
9656
|
+
const formAction = (0, import_react35.useCallback)(
|
|
9621
9657
|
async (nextFormData) => {
|
|
9622
9658
|
if (nextFormData === null) {
|
|
9623
9659
|
setData(initialData);
|
|
@@ -9648,15 +9684,15 @@ var useFormState = (action, initialData = {}) => {
|
|
|
9648
9684
|
};
|
|
9649
9685
|
|
|
9650
9686
|
// src/components/Form/FormErrorSummary.tsx
|
|
9651
|
-
var
|
|
9687
|
+
var import_react36 = require("react");
|
|
9652
9688
|
var import_type_guards33 = require("@wistia/type-guards");
|
|
9653
9689
|
var import_jsx_runtime223 = require("react/jsx-runtime");
|
|
9654
9690
|
var ErrorItem = ({ name, error, formId }) => {
|
|
9655
9691
|
return /* @__PURE__ */ (0, import_jsx_runtime223.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(Link, { href: `#${formId}-${name}`, children: error }) }, name);
|
|
9656
9692
|
};
|
|
9657
9693
|
var FormErrorSummary = ({ description }) => {
|
|
9658
|
-
const ref = (0,
|
|
9659
|
-
const { formId, errors, hasSubmitted } = (0,
|
|
9694
|
+
const ref = (0, import_react36.useRef)(null);
|
|
9695
|
+
const { formId, errors, hasSubmitted } = (0, import_react36.useContext)(FormContext);
|
|
9660
9696
|
const isValid = Object.keys(errors).length === 0;
|
|
9661
9697
|
if (isValid || !hasSubmitted) {
|
|
9662
9698
|
return null;
|
|
@@ -9686,7 +9722,7 @@ var FormErrorSummary = ({ description }) => {
|
|
|
9686
9722
|
};
|
|
9687
9723
|
|
|
9688
9724
|
// src/components/FormField/FormField.tsx
|
|
9689
|
-
var
|
|
9725
|
+
var import_react39 = require("react");
|
|
9690
9726
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
9691
9727
|
var import_type_guards34 = require("@wistia/type-guards");
|
|
9692
9728
|
|
|
@@ -9751,11 +9787,11 @@ var Label = ({
|
|
|
9751
9787
|
Label.displayName = "Label";
|
|
9752
9788
|
|
|
9753
9789
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9754
|
-
var
|
|
9790
|
+
var import_react38 = require("react");
|
|
9755
9791
|
|
|
9756
9792
|
// src/components/FormGroup/FormGroup.tsx
|
|
9757
9793
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
9758
|
-
var
|
|
9794
|
+
var import_react37 = require("react");
|
|
9759
9795
|
var import_jsx_runtime225 = require("react/jsx-runtime");
|
|
9760
9796
|
var StyledFieldset = import_styled_components52.default.fieldset`
|
|
9761
9797
|
border: 0;
|
|
@@ -9764,7 +9800,7 @@ var StyledLegend = import_styled_components52.default.legend`
|
|
|
9764
9800
|
margin-bottom: var(--space-01);
|
|
9765
9801
|
`;
|
|
9766
9802
|
var FormGroup = ({ children, label, ...props }) => {
|
|
9767
|
-
const ref = (0,
|
|
9803
|
+
const ref = (0, import_react37.useRef)();
|
|
9768
9804
|
return /* @__PURE__ */ (0, import_jsx_runtime225.jsxs)(
|
|
9769
9805
|
Stack,
|
|
9770
9806
|
{
|
|
@@ -9789,7 +9825,7 @@ FormGroup.displayName = "FormGroup";
|
|
|
9789
9825
|
|
|
9790
9826
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9791
9827
|
var import_jsx_runtime226 = require("react/jsx-runtime");
|
|
9792
|
-
var CheckboxGroupContext = (0,
|
|
9828
|
+
var CheckboxGroupContext = (0, import_react38.createContext)(null);
|
|
9793
9829
|
var CheckboxGroup = ({
|
|
9794
9830
|
children,
|
|
9795
9831
|
name,
|
|
@@ -9797,7 +9833,7 @@ var CheckboxGroup = ({
|
|
|
9797
9833
|
value,
|
|
9798
9834
|
...props
|
|
9799
9835
|
}) => {
|
|
9800
|
-
const context = (0,
|
|
9836
|
+
const context = (0, import_react38.useMemo)(() => {
|
|
9801
9837
|
return {
|
|
9802
9838
|
name,
|
|
9803
9839
|
onChange
|
|
@@ -9882,8 +9918,8 @@ var FormField = ({
|
|
|
9882
9918
|
value,
|
|
9883
9919
|
...props
|
|
9884
9920
|
}) => {
|
|
9885
|
-
const formState = (0,
|
|
9886
|
-
const checkboxGroup = (0,
|
|
9921
|
+
const formState = (0, import_react39.useContext)(FormContext);
|
|
9922
|
+
const checkboxGroup = (0, import_react39.useContext)(CheckboxGroupContext);
|
|
9887
9923
|
const defaultValue = formState.values[name];
|
|
9888
9924
|
const isIntegratedLabel = children.type === Checkbox;
|
|
9889
9925
|
const computedId = id ?? `${formState.formId}-${name}`;
|
|
@@ -9921,7 +9957,7 @@ var FormField = ({
|
|
|
9921
9957
|
"aria-invalid": (0, import_type_guards34.isNotNil)(error)
|
|
9922
9958
|
};
|
|
9923
9959
|
}
|
|
9924
|
-
|
|
9960
|
+
import_react39.Children.only(children);
|
|
9925
9961
|
return /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(
|
|
9926
9962
|
StyledFormField,
|
|
9927
9963
|
{
|
|
@@ -9930,7 +9966,7 @@ var FormField = ({
|
|
|
9930
9966
|
children: [
|
|
9931
9967
|
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(Label, { htmlFor: computedId, children: label }),
|
|
9932
9968
|
(0, import_type_guards34.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
9933
|
-
(0,
|
|
9969
|
+
(0, import_react39.cloneElement)(children, childProps),
|
|
9934
9970
|
(0, import_type_guards34.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(import_jsx_runtime227.Fragment, { children: [
|
|
9935
9971
|
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)("div", {}),
|
|
9936
9972
|
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
@@ -9948,9 +9984,9 @@ var FormField = ({
|
|
|
9948
9984
|
FormField.displayName = "FormField";
|
|
9949
9985
|
|
|
9950
9986
|
// src/components/FormGroup/RadioGroup.tsx
|
|
9951
|
-
var
|
|
9987
|
+
var import_react40 = require("react");
|
|
9952
9988
|
var import_jsx_runtime228 = require("react/jsx-runtime");
|
|
9953
|
-
var RadioGroupContext = (0,
|
|
9989
|
+
var RadioGroupContext = (0, import_react40.createContext)(null);
|
|
9954
9990
|
var RadioGroup = ({
|
|
9955
9991
|
children,
|
|
9956
9992
|
name,
|
|
@@ -9958,7 +9994,7 @@ var RadioGroup = ({
|
|
|
9958
9994
|
value,
|
|
9959
9995
|
...props
|
|
9960
9996
|
}) => {
|
|
9961
|
-
const context = (0,
|
|
9997
|
+
const context = (0, import_react40.useMemo)(() => {
|
|
9962
9998
|
return {
|
|
9963
9999
|
name,
|
|
9964
10000
|
onChange
|
|
@@ -9969,7 +10005,7 @@ var RadioGroup = ({
|
|
|
9969
10005
|
RadioGroup.displayName = "RadioGroup";
|
|
9970
10006
|
|
|
9971
10007
|
// src/components/IconButton/IconButton.tsx
|
|
9972
|
-
var
|
|
10008
|
+
var import_react41 = require("react");
|
|
9973
10009
|
var import_styled_components54 = __toESM(require("styled-components"));
|
|
9974
10010
|
var import_jsx_runtime229 = require("react/jsx-runtime");
|
|
9975
10011
|
var StyledButton2 = (0, import_styled_components54.default)(Button)`
|
|
@@ -9986,7 +10022,7 @@ var StyledButton2 = (0, import_styled_components54.default)(Button)`
|
|
|
9986
10022
|
align-items: center;
|
|
9987
10023
|
line-height: 1;
|
|
9988
10024
|
`;
|
|
9989
|
-
var IconButton = (0,
|
|
10025
|
+
var IconButton = (0, import_react41.forwardRef)(
|
|
9990
10026
|
({ children, label, size = "md", ...props }, ref) => {
|
|
9991
10027
|
const responsiveSize = useResponsiveProp(size);
|
|
9992
10028
|
return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(
|
|
@@ -9997,7 +10033,7 @@ var IconButton = (0, import_react39.forwardRef)(
|
|
|
9997
10033
|
"aria-label": label,
|
|
9998
10034
|
"data-wistia-ui-icon-button": true,
|
|
9999
10035
|
size: responsiveSize,
|
|
10000
|
-
children: (0,
|
|
10036
|
+
children: (0, import_react41.cloneElement)(import_react41.Children.only(children), {
|
|
10001
10037
|
size: responsiveSize
|
|
10002
10038
|
})
|
|
10003
10039
|
}
|
|
@@ -10008,7 +10044,7 @@ IconButton.displayName = "IconButton";
|
|
|
10008
10044
|
|
|
10009
10045
|
// src/components/InputClickToCopy/InputClickToCopy.tsx
|
|
10010
10046
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
10011
|
-
var
|
|
10047
|
+
var import_react42 = require("react");
|
|
10012
10048
|
var import_type_guards35 = require("@wistia/type-guards");
|
|
10013
10049
|
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
10014
10050
|
var StyledInput2 = (0, import_styled_components55.default)(Input)`
|
|
@@ -10021,10 +10057,10 @@ var StyledInput2 = (0, import_styled_components55.default)(Input)`
|
|
|
10021
10057
|
}
|
|
10022
10058
|
`;
|
|
10023
10059
|
var COPY_SUCCESS_DURATION = 2e3;
|
|
10024
|
-
var InputClickToCopy = (0,
|
|
10060
|
+
var InputClickToCopy = (0, import_react42.forwardRef)(
|
|
10025
10061
|
({ value, onCopy, ...props }, ref) => {
|
|
10026
|
-
const [isCopied, setIsCopied] = (0,
|
|
10027
|
-
(0,
|
|
10062
|
+
const [isCopied, setIsCopied] = (0, import_react42.useState)(false);
|
|
10063
|
+
(0, import_react42.useEffect)(() => {
|
|
10028
10064
|
if (isCopied) {
|
|
10029
10065
|
const timeout = setTimeout(() => {
|
|
10030
10066
|
setIsCopied(false);
|
|
@@ -10074,12 +10110,12 @@ InputClickToCopy.displayName = "InputClickToCopy";
|
|
|
10074
10110
|
var import_styled_components56 = __toESM(require("styled-components"));
|
|
10075
10111
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
10076
10112
|
var import_type_guards36 = require("@wistia/type-guards");
|
|
10077
|
-
var
|
|
10113
|
+
var import_react44 = require("react");
|
|
10078
10114
|
|
|
10079
10115
|
// src/components/Menu/MenuContext.tsx
|
|
10080
|
-
var
|
|
10081
|
-
var MenuContext = (0,
|
|
10082
|
-
var useMenuContext = () => (0,
|
|
10116
|
+
var import_react43 = require("react");
|
|
10117
|
+
var MenuContext = (0, import_react43.createContext)({ compact: false });
|
|
10118
|
+
var useMenuContext = () => (0, import_react43.useContext)(MenuContext);
|
|
10083
10119
|
|
|
10084
10120
|
// src/components/Menu/Menu.tsx
|
|
10085
10121
|
var import_jsx_runtime231 = require("react/jsx-runtime");
|
|
@@ -10183,7 +10219,7 @@ var Menu = ({
|
|
|
10183
10219
|
onInteractOutside,
|
|
10184
10220
|
...props
|
|
10185
10221
|
}) => {
|
|
10186
|
-
const contextValue = (0,
|
|
10222
|
+
const contextValue = (0, import_react44.useMemo)(() => ({ compact }), [compact]);
|
|
10187
10223
|
let controlProps = {
|
|
10188
10224
|
...(0, import_type_guards36.isNotNil)(onOpenChange) && (0, import_type_guards36.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
10189
10225
|
};
|
|
@@ -10257,13 +10293,13 @@ var MenuLabel = ({ children, ...props }) => {
|
|
|
10257
10293
|
MenuLabel.displayName = "MenuLabel";
|
|
10258
10294
|
|
|
10259
10295
|
// src/components/Menu/SubMenu.tsx
|
|
10260
|
-
var
|
|
10296
|
+
var import_react46 = require("react");
|
|
10261
10297
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
10262
10298
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
10263
10299
|
var import_type_guards38 = require("@wistia/type-guards");
|
|
10264
10300
|
|
|
10265
10301
|
// src/components/Menu/MenuItemButton.tsx
|
|
10266
|
-
var
|
|
10302
|
+
var import_react45 = require("react");
|
|
10267
10303
|
var import_styled_components58 = __toESM(require("styled-components"));
|
|
10268
10304
|
var import_type_guards37 = require("@wistia/type-guards");
|
|
10269
10305
|
var import_jsx_runtime233 = require("react/jsx-runtime");
|
|
@@ -10340,7 +10376,7 @@ var StyledBadgeContainer = import_styled_components58.default.div`
|
|
|
10340
10376
|
font-size: var(--wui-typography-label-4-size);
|
|
10341
10377
|
color: var(--wui-color-text-secondary);
|
|
10342
10378
|
`;
|
|
10343
|
-
var MenuItemButton = (0,
|
|
10379
|
+
var MenuItemButton = (0, import_react45.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
10344
10380
|
let { colorScheme, badge } = props;
|
|
10345
10381
|
if (appearance === "dangerous") {
|
|
10346
10382
|
if ((0, import_type_guards37.isNotUndefined)(colorScheme)) {
|
|
@@ -10436,7 +10472,7 @@ var SubMenu = ({
|
|
|
10436
10472
|
...props
|
|
10437
10473
|
}) => {
|
|
10438
10474
|
const { isSmAndUp } = useMq();
|
|
10439
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
10475
|
+
const [isExpanded, setIsExpanded] = (0, import_react46.useState)(false);
|
|
10440
10476
|
const { compact } = useMenuContext();
|
|
10441
10477
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
10442
10478
|
/* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
@@ -10465,10 +10501,10 @@ var SubMenu = ({
|
|
|
10465
10501
|
SubMenu.displayName = "SubMenu";
|
|
10466
10502
|
|
|
10467
10503
|
// src/components/Menu/MenuItem.tsx
|
|
10468
|
-
var
|
|
10504
|
+
var import_react47 = require("react");
|
|
10469
10505
|
var import_react_dropdown_menu4 = require("@radix-ui/react-dropdown-menu");
|
|
10470
10506
|
var import_jsx_runtime236 = require("react/jsx-runtime");
|
|
10471
|
-
var MenuItem = (0,
|
|
10507
|
+
var MenuItem = (0, import_react47.forwardRef)(
|
|
10472
10508
|
({ onSelect = () => null, ...props }, ref) => {
|
|
10473
10509
|
return /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
|
|
10474
10510
|
import_react_dropdown_menu4.DropdownMenuItem,
|
|
@@ -10620,7 +10656,7 @@ var CheckboxMenuItem = ({
|
|
|
10620
10656
|
CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
10621
10657
|
|
|
10622
10658
|
// src/components/Modal/Modal.tsx
|
|
10623
|
-
var
|
|
10659
|
+
var import_react51 = require("react");
|
|
10624
10660
|
var import_styled_components65 = __toESM(require("styled-components"));
|
|
10625
10661
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
10626
10662
|
var import_type_guards41 = require("@wistia/type-guards");
|
|
@@ -10680,19 +10716,19 @@ var ModalHeader = ({
|
|
|
10680
10716
|
};
|
|
10681
10717
|
|
|
10682
10718
|
// src/components/Modal/ModalContent.tsx
|
|
10683
|
-
var
|
|
10719
|
+
var import_react49 = require("react");
|
|
10684
10720
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
10685
10721
|
var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
10686
10722
|
|
|
10687
10723
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
10688
|
-
var
|
|
10724
|
+
var import_react48 = require("react");
|
|
10689
10725
|
var import_type_guards40 = require("@wistia/type-guards");
|
|
10690
10726
|
var useFocusRestore = () => {
|
|
10691
|
-
const previouslyFocusedRef = (0,
|
|
10692
|
-
(0,
|
|
10727
|
+
const previouslyFocusedRef = (0, import_react48.useRef)(null);
|
|
10728
|
+
(0, import_react48.useEffect)(() => {
|
|
10693
10729
|
previouslyFocusedRef.current = document.activeElement;
|
|
10694
10730
|
}, []);
|
|
10695
|
-
(0,
|
|
10731
|
+
(0, import_react48.useEffect)(() => {
|
|
10696
10732
|
return () => {
|
|
10697
10733
|
if ((0, import_type_guards40.isNotNil)(previouslyFocusedRef.current)) {
|
|
10698
10734
|
setTimeout(() => {
|
|
@@ -10746,7 +10782,7 @@ var StyledModalContent = (0, import_styled_components63.default)(import_react_di
|
|
|
10746
10782
|
}
|
|
10747
10783
|
}
|
|
10748
10784
|
`;
|
|
10749
|
-
var ModalContent = (0,
|
|
10785
|
+
var ModalContent = (0, import_react49.forwardRef)(
|
|
10750
10786
|
({ fullHeight, width, children, ...props }, ref) => {
|
|
10751
10787
|
useFocusRestore();
|
|
10752
10788
|
return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
|
|
@@ -10764,7 +10800,7 @@ var ModalContent = (0, import_react47.forwardRef)(
|
|
|
10764
10800
|
);
|
|
10765
10801
|
|
|
10766
10802
|
// src/private/components/Backdrop/Backdrop.tsx
|
|
10767
|
-
var
|
|
10803
|
+
var import_react50 = require("react");
|
|
10768
10804
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
10769
10805
|
var import_jsx_runtime243 = require("react/jsx-runtime");
|
|
10770
10806
|
var backdropAnimationDuration = 150;
|
|
@@ -10802,7 +10838,7 @@ var BackdropComponent = import_styled_components64.default.div`
|
|
|
10802
10838
|
}
|
|
10803
10839
|
}
|
|
10804
10840
|
`;
|
|
10805
|
-
var Backdrop = (0,
|
|
10841
|
+
var Backdrop = (0, import_react50.forwardRef)(
|
|
10806
10842
|
({ alignHorizontal = "center", alignVertical = "center", children, ...otherProps }, ref) => /* @__PURE__ */ (0, import_jsx_runtime243.jsx)(
|
|
10807
10843
|
BackdropComponent,
|
|
10808
10844
|
{
|
|
@@ -10824,7 +10860,7 @@ var ModalBody = import_styled_components65.default.div`
|
|
|
10824
10860
|
display: flex;
|
|
10825
10861
|
order: 2;
|
|
10826
10862
|
`;
|
|
10827
|
-
var Modal = (0,
|
|
10863
|
+
var Modal = (0, import_react51.forwardRef)(
|
|
10828
10864
|
({
|
|
10829
10865
|
children,
|
|
10830
10866
|
fullHeight = false,
|
|
@@ -11038,7 +11074,7 @@ var ProgressBar = ({
|
|
|
11038
11074
|
ProgressBar.displayName = "ProgressBar";
|
|
11039
11075
|
|
|
11040
11076
|
// src/components/Radio/Radio.tsx
|
|
11041
|
-
var
|
|
11077
|
+
var import_react52 = require("react");
|
|
11042
11078
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
11043
11079
|
var import_type_guards44 = require("@wistia/type-guards");
|
|
11044
11080
|
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
@@ -11141,7 +11177,7 @@ var StyledHiddenRadioInput = import_styled_components68.default.input`
|
|
|
11141
11177
|
display: block;
|
|
11142
11178
|
}
|
|
11143
11179
|
`;
|
|
11144
|
-
var Radio = (0,
|
|
11180
|
+
var Radio = (0, import_react52.forwardRef)(
|
|
11145
11181
|
({
|
|
11146
11182
|
checked,
|
|
11147
11183
|
disabled = false,
|
|
@@ -11156,7 +11192,7 @@ var Radio = (0, import_react50.forwardRef)(
|
|
|
11156
11192
|
hideLabel = false,
|
|
11157
11193
|
...props
|
|
11158
11194
|
}, ref) => {
|
|
11159
|
-
const generatedId = (0,
|
|
11195
|
+
const generatedId = (0, import_react52.useId)();
|
|
11160
11196
|
const computedId = (0, import_type_guards44.isNonEmptyString)(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
11161
11197
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(
|
|
11162
11198
|
StyledRadioWrapper,
|
|
@@ -11206,20 +11242,20 @@ var Radio = (0, import_react50.forwardRef)(
|
|
|
11206
11242
|
Radio.displayName = "Radio";
|
|
11207
11243
|
|
|
11208
11244
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
11209
|
-
var
|
|
11245
|
+
var import_react55 = require("react");
|
|
11210
11246
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
11211
11247
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
11212
11248
|
var import_type_guards45 = require("@wistia/type-guards");
|
|
11213
11249
|
|
|
11214
11250
|
// src/components/SegmentedControl/useSelectedItemStyle.tsx
|
|
11215
|
-
var
|
|
11251
|
+
var import_react53 = require("react");
|
|
11216
11252
|
var import_jsx_runtime248 = require("react/jsx-runtime");
|
|
11217
|
-
var SelectedItemStyleContext = (0,
|
|
11253
|
+
var SelectedItemStyleContext = (0, import_react53.createContext)(null);
|
|
11218
11254
|
var SelectedItemStyleProvider = ({
|
|
11219
11255
|
children
|
|
11220
11256
|
}) => {
|
|
11221
|
-
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0,
|
|
11222
|
-
const selectedItemIndicatorStyle = (0,
|
|
11257
|
+
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0, import_react53.useState)(null);
|
|
11258
|
+
const selectedItemIndicatorStyle = (0, import_react53.useMemo)(
|
|
11223
11259
|
() => selectedItemMeasurements != null ? {
|
|
11224
11260
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
11225
11261
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px) translateY(-50%)`,
|
|
@@ -11229,7 +11265,7 @@ var SelectedItemStyleProvider = ({
|
|
|
11229
11265
|
},
|
|
11230
11266
|
[selectedItemMeasurements]
|
|
11231
11267
|
);
|
|
11232
|
-
const contextValue = (0,
|
|
11268
|
+
const contextValue = (0, import_react53.useMemo)(
|
|
11233
11269
|
() => ({
|
|
11234
11270
|
setSelectedItemMeasurements,
|
|
11235
11271
|
selectedItemIndicatorStyle
|
|
@@ -11239,7 +11275,7 @@ var SelectedItemStyleProvider = ({
|
|
|
11239
11275
|
return /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(SelectedItemStyleContext.Provider, { value: contextValue, children });
|
|
11240
11276
|
};
|
|
11241
11277
|
var useSelectedItemStyle = () => {
|
|
11242
|
-
const context = (0,
|
|
11278
|
+
const context = (0, import_react53.useContext)(SelectedItemStyleContext);
|
|
11243
11279
|
if (context === null) {
|
|
11244
11280
|
throw new Error("useSelectedItemStyle must be used within a SelectedItemStyleProvider");
|
|
11245
11281
|
}
|
|
@@ -11250,11 +11286,11 @@ var useSelectedItemStyle = () => {
|
|
|
11250
11286
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
11251
11287
|
|
|
11252
11288
|
// src/components/SegmentedControl/useSegmentedControlValue.tsx
|
|
11253
|
-
var
|
|
11254
|
-
var SegmentedControlValueContext = (0,
|
|
11289
|
+
var import_react54 = require("react");
|
|
11290
|
+
var SegmentedControlValueContext = (0, import_react54.createContext)(null);
|
|
11255
11291
|
var SegmentedControlValueProvider = SegmentedControlValueContext.Provider;
|
|
11256
11292
|
var useSegmentedControlValue = () => {
|
|
11257
|
-
const context = (0,
|
|
11293
|
+
const context = (0, import_react54.useContext)(SegmentedControlValueContext);
|
|
11258
11294
|
if (context === null) {
|
|
11259
11295
|
throw new Error("useSegmentedControlValue must be used within a SegmentedControlValueProvider");
|
|
11260
11296
|
}
|
|
@@ -11300,7 +11336,7 @@ var segmentedControlStyles = import_styled_components70.css`
|
|
|
11300
11336
|
var StyledSegmentedControl = (0, import_styled_components70.default)(import_react_toggle_group.Root)`
|
|
11301
11337
|
${segmentedControlStyles}
|
|
11302
11338
|
`;
|
|
11303
|
-
var SegmentedControl = (0,
|
|
11339
|
+
var SegmentedControl = (0, import_react55.forwardRef)(
|
|
11304
11340
|
({
|
|
11305
11341
|
children,
|
|
11306
11342
|
disabled = false,
|
|
@@ -11335,7 +11371,7 @@ var SegmentedControl = (0, import_react53.forwardRef)(
|
|
|
11335
11371
|
SegmentedControl.displayName = "SegmentedControl";
|
|
11336
11372
|
|
|
11337
11373
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
11338
|
-
var
|
|
11374
|
+
var import_react56 = require("react");
|
|
11339
11375
|
var import_styled_components71 = __toESM(require("styled-components"));
|
|
11340
11376
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
11341
11377
|
var import_type_guards46 = require("@wistia/type-guards");
|
|
@@ -11403,11 +11439,11 @@ var segmentedControlItemStyles = import_styled_components71.css`
|
|
|
11403
11439
|
var StyledSegmentedControlItem = (0, import_styled_components71.default)(import_react_toggle_group2.Item)`
|
|
11404
11440
|
${segmentedControlItemStyles}
|
|
11405
11441
|
`;
|
|
11406
|
-
var SegmentedControlItem = (0,
|
|
11442
|
+
var SegmentedControlItem = (0, import_react56.forwardRef)(
|
|
11407
11443
|
({ disabled, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11408
11444
|
const selectedValue = useSegmentedControlValue();
|
|
11409
11445
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
11410
|
-
const buttonRef = (0,
|
|
11446
|
+
const buttonRef = (0, import_react56.useRef)(null);
|
|
11411
11447
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11412
11448
|
const handleClick = (event) => {
|
|
11413
11449
|
const target = event.target;
|
|
@@ -11416,7 +11452,7 @@ var SegmentedControlItem = (0, import_react54.forwardRef)(
|
|
|
11416
11452
|
event.preventDefault();
|
|
11417
11453
|
}
|
|
11418
11454
|
};
|
|
11419
|
-
(0,
|
|
11455
|
+
(0, import_react56.useEffect)(() => {
|
|
11420
11456
|
const buttonElem = buttonRef.current;
|
|
11421
11457
|
if (!buttonElem) {
|
|
11422
11458
|
return void 0;
|
|
@@ -11462,7 +11498,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
11462
11498
|
|
|
11463
11499
|
// src/components/Select/Select.tsx
|
|
11464
11500
|
var import_react_select = require("@radix-ui/react-select");
|
|
11465
|
-
var
|
|
11501
|
+
var import_react57 = require("react");
|
|
11466
11502
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
11467
11503
|
var import_jsx_runtime252 = require("react/jsx-runtime");
|
|
11468
11504
|
var StyledTrigger = (0, import_styled_components72.default)(import_react_select.Trigger)`
|
|
@@ -11527,7 +11563,7 @@ var StyledContent3 = (0, import_styled_components72.default)(import_react_select
|
|
|
11527
11563
|
max-height: var(--radix-select-content-available-height);
|
|
11528
11564
|
z-index: var(--wui-zindex-select);
|
|
11529
11565
|
`;
|
|
11530
|
-
var Select = (0,
|
|
11566
|
+
var Select = (0, import_react57.forwardRef)(
|
|
11531
11567
|
({
|
|
11532
11568
|
colorScheme = "inherit",
|
|
11533
11569
|
children,
|
|
@@ -11576,7 +11612,7 @@ Select.displayName = "Select";
|
|
|
11576
11612
|
|
|
11577
11613
|
// src/components/Select/SelectOption.tsx
|
|
11578
11614
|
var import_react_select2 = require("@radix-ui/react-select");
|
|
11579
|
-
var
|
|
11615
|
+
var import_react58 = require("react");
|
|
11580
11616
|
var import_styled_components73 = __toESM(require("styled-components"));
|
|
11581
11617
|
var import_type_guards47 = require("@wistia/type-guards");
|
|
11582
11618
|
var import_jsx_runtime253 = require("react/jsx-runtime");
|
|
@@ -11607,7 +11643,7 @@ var StyledItem = (0, import_styled_components73.default)(import_react_select2.It
|
|
|
11607
11643
|
var StyledIconContainer = import_styled_components73.default.span`
|
|
11608
11644
|
width: 12px;
|
|
11609
11645
|
`;
|
|
11610
|
-
var SelectOption = (0,
|
|
11646
|
+
var SelectOption = (0, import_react58.forwardRef)(
|
|
11611
11647
|
({ children, selectedDisplayValue, ...props }, forwardedRef) => {
|
|
11612
11648
|
return /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(
|
|
11613
11649
|
StyledItem,
|
|
@@ -11655,7 +11691,7 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
11655
11691
|
};
|
|
11656
11692
|
|
|
11657
11693
|
// src/components/Switch/Switch.tsx
|
|
11658
|
-
var
|
|
11694
|
+
var import_react59 = require("react");
|
|
11659
11695
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
11660
11696
|
var import_type_guards48 = require("@wistia/type-guards");
|
|
11661
11697
|
var import_jsx_runtime255 = require("react/jsx-runtime");
|
|
@@ -11760,7 +11796,7 @@ var StyledHiddenSwitchInput = import_styled_components75.default.input`
|
|
|
11760
11796
|
}
|
|
11761
11797
|
}
|
|
11762
11798
|
`;
|
|
11763
|
-
var Switch = (0,
|
|
11799
|
+
var Switch = (0, import_react59.forwardRef)(
|
|
11764
11800
|
({
|
|
11765
11801
|
checked,
|
|
11766
11802
|
disabled = false,
|
|
@@ -11775,7 +11811,7 @@ var Switch = (0, import_react57.forwardRef)(
|
|
|
11775
11811
|
hideLabel = false,
|
|
11776
11812
|
...props
|
|
11777
11813
|
}, ref) => {
|
|
11778
|
-
const generatedId = (0,
|
|
11814
|
+
const generatedId = (0, import_react59.useId)();
|
|
11779
11815
|
const computedId = (0, import_type_guards48.isNonEmptyString)(id) ? id : `wistia-ui-switch-${generatedId}`;
|
|
11780
11816
|
return /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)(StyledSwitchWrapper, { $disabled: disabled, children: [
|
|
11781
11817
|
/* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
|
|
@@ -11824,22 +11860,29 @@ var StyledTable = import_styled_components76.default.table`
|
|
|
11824
11860
|
width: 100%;
|
|
11825
11861
|
border-collapse: collapse;
|
|
11826
11862
|
|
|
11863
|
+
${({ $divided }) => $divided && import_styled_components76.css`
|
|
11864
|
+
tr {
|
|
11865
|
+
border-bottom: 1px solid var(--wui-color-border);
|
|
11866
|
+
}
|
|
11867
|
+
`}
|
|
11868
|
+
|
|
11827
11869
|
${({ $striped }) => $striped && import_styled_components76.css`
|
|
11828
11870
|
tbody tr:nth-child(even) {
|
|
11829
11871
|
background-color: var(--wui-color-bg-surface-secondary);
|
|
11830
11872
|
}
|
|
11831
11873
|
`}
|
|
11832
11874
|
|
|
11833
|
-
${({ $
|
|
11834
|
-
|
|
11835
|
-
|
|
11875
|
+
${({ $visuallyHiddenHeader }) => $visuallyHiddenHeader && import_styled_components76.css`
|
|
11876
|
+
thead {
|
|
11877
|
+
${visuallyHiddenStyle}
|
|
11836
11878
|
}
|
|
11837
11879
|
`}
|
|
11838
11880
|
`;
|
|
11839
11881
|
var Table = ({
|
|
11840
11882
|
children,
|
|
11841
|
-
striped = false,
|
|
11842
11883
|
divided = false,
|
|
11884
|
+
striped = false,
|
|
11885
|
+
visuallyHiddenHeader = false,
|
|
11843
11886
|
...props
|
|
11844
11887
|
}) => {
|
|
11845
11888
|
return /* @__PURE__ */ (0, import_jsx_runtime256.jsx)(
|
|
@@ -11847,6 +11890,7 @@ var Table = ({
|
|
|
11847
11890
|
{
|
|
11848
11891
|
$divided: divided,
|
|
11849
11892
|
$striped: striped,
|
|
11893
|
+
$visuallyHiddenHeader: visuallyHiddenHeader,
|
|
11850
11894
|
...props,
|
|
11851
11895
|
children
|
|
11852
11896
|
}
|
|
@@ -11857,18 +11901,18 @@ var Table = ({
|
|
|
11857
11901
|
var import_styled_components77 = __toESM(require("styled-components"));
|
|
11858
11902
|
|
|
11859
11903
|
// src/components/Table/TableSectionContext.ts
|
|
11860
|
-
var
|
|
11861
|
-
var TableSectionContext = (0,
|
|
11904
|
+
var import_react60 = require("react");
|
|
11905
|
+
var TableSectionContext = (0, import_react60.createContext)(null);
|
|
11862
11906
|
|
|
11863
11907
|
// src/components/Table/TableBody.tsx
|
|
11864
11908
|
var import_jsx_runtime257 = require("react/jsx-runtime");
|
|
11865
|
-
var
|
|
11909
|
+
var StyledTableBody = import_styled_components77.default.tbody``;
|
|
11866
11910
|
var TableBody = ({ children, ...props }) => {
|
|
11867
|
-
return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(TableSectionContext.Provider, { value: "body", children: /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(
|
|
11911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(TableSectionContext.Provider, { value: "body", children: /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(StyledTableBody, { ...props, children }) });
|
|
11868
11912
|
};
|
|
11869
11913
|
|
|
11870
11914
|
// src/components/Table/TableCell.tsx
|
|
11871
|
-
var
|
|
11915
|
+
var import_react61 = require("react");
|
|
11872
11916
|
var import_styled_components78 = __toESM(require("styled-components"));
|
|
11873
11917
|
var import_jsx_runtime258 = require("react/jsx-runtime");
|
|
11874
11918
|
var sharedStyles = import_styled_components78.css`
|
|
@@ -11889,19 +11933,19 @@ var StyledTd = import_styled_components78.default.td`
|
|
|
11889
11933
|
line-height: var(--wui-typography-body-2-line-height);
|
|
11890
11934
|
`;
|
|
11891
11935
|
var TableCell = ({ children, ...props }) => {
|
|
11892
|
-
const section = (0,
|
|
11936
|
+
const section = (0, import_react61.useContext)(TableSectionContext);
|
|
11893
11937
|
if (section === "head") {
|
|
11894
11938
|
return /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(StyledTh, { ...props, children });
|
|
11895
11939
|
}
|
|
11896
11940
|
return /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(StyledTd, { ...props, children });
|
|
11897
11941
|
};
|
|
11898
11942
|
|
|
11899
|
-
// src/components/Table/
|
|
11943
|
+
// src/components/Table/TableFoot.tsx
|
|
11900
11944
|
var import_styled_components79 = __toESM(require("styled-components"));
|
|
11901
11945
|
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)(
|
|
11946
|
+
var StyledTableFoot = import_styled_components79.default.tfoot``;
|
|
11947
|
+
var TableFoot = ({ children, ...props }) => {
|
|
11948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(TableSectionContext.Provider, { value: "footer", children: /* @__PURE__ */ (0, import_jsx_runtime259.jsx)(StyledTableFoot, { ...props, children }) });
|
|
11905
11949
|
};
|
|
11906
11950
|
|
|
11907
11951
|
// src/components/Table/TableHead.tsx
|
|
@@ -11915,13 +11959,13 @@ var TableHead = ({ children, ...props }) => {
|
|
|
11915
11959
|
// src/components/Table/TableRow.tsx
|
|
11916
11960
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
11917
11961
|
var import_jsx_runtime261 = require("react/jsx-runtime");
|
|
11918
|
-
var
|
|
11962
|
+
var StyledTableRow = import_styled_components81.default.tr``;
|
|
11919
11963
|
var TableRow = ({ children, ...props }) => {
|
|
11920
|
-
return /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(
|
|
11964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime261.jsx)(StyledTableRow, { ...props, children });
|
|
11921
11965
|
};
|
|
11922
11966
|
|
|
11923
11967
|
// src/components/Tabs/Tabs.tsx
|
|
11924
|
-
var
|
|
11968
|
+
var import_react65 = require("react");
|
|
11925
11969
|
var import_react_tabs4 = require("@radix-ui/react-tabs");
|
|
11926
11970
|
var import_type_guards50 = require("@wistia/type-guards");
|
|
11927
11971
|
var import_styled_components86 = __toESM(require("styled-components"));
|
|
@@ -11976,17 +12020,17 @@ var TabList = ({
|
|
|
11976
12020
|
TabList.displayName = "TabList";
|
|
11977
12021
|
|
|
11978
12022
|
// src/components/Tabs/TabItem.tsx
|
|
11979
|
-
var
|
|
12023
|
+
var import_react63 = require("react");
|
|
11980
12024
|
var import_styled_components84 = __toESM(require("styled-components"));
|
|
11981
12025
|
var import_react_tabs3 = require("@radix-ui/react-tabs");
|
|
11982
12026
|
var import_type_guards49 = require("@wistia/type-guards");
|
|
11983
12027
|
|
|
11984
12028
|
// src/components/Tabs/useTabsValue.tsx
|
|
11985
|
-
var
|
|
11986
|
-
var TabsValueContext = (0,
|
|
12029
|
+
var import_react62 = require("react");
|
|
12030
|
+
var TabsValueContext = (0, import_react62.createContext)(null);
|
|
11987
12031
|
var TabsValueProvider = TabsValueContext.Provider;
|
|
11988
12032
|
var useTabsValue = () => {
|
|
11989
|
-
const context = (0,
|
|
12033
|
+
const context = (0, import_react62.useContext)(TabsValueContext);
|
|
11990
12034
|
if (context === null) {
|
|
11991
12035
|
throw new Error("useTabsValue must be used within a TabsValueProvider");
|
|
11992
12036
|
}
|
|
@@ -12002,13 +12046,13 @@ var StyledTabItem = (0, import_styled_components84.default)(import_react_tabs3.T
|
|
|
12002
12046
|
outline: none;
|
|
12003
12047
|
}
|
|
12004
12048
|
`;
|
|
12005
|
-
var TabItem = (0,
|
|
12049
|
+
var TabItem = (0, import_react63.forwardRef)(
|
|
12006
12050
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
12007
12051
|
const selectedValue = useTabsValue();
|
|
12008
12052
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
12009
|
-
const buttonRef = (0,
|
|
12053
|
+
const buttonRef = (0, import_react63.useRef)(null);
|
|
12010
12054
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
12011
|
-
(0,
|
|
12055
|
+
(0, import_react63.useEffect)(() => {
|
|
12012
12056
|
const buttonElem = buttonRef.current;
|
|
12013
12057
|
if (!buttonElem) {
|
|
12014
12058
|
return void 0;
|
|
@@ -12052,16 +12096,16 @@ var TabItem = (0, import_react61.forwardRef)(
|
|
|
12052
12096
|
TabItem.displayName = "TabItem";
|
|
12053
12097
|
|
|
12054
12098
|
// src/components/Tabs/extractTabItems.ts
|
|
12055
|
-
var
|
|
12099
|
+
var import_react64 = require("react");
|
|
12056
12100
|
var extractTabItems = (children) => {
|
|
12057
12101
|
const tabItems = [];
|
|
12058
|
-
|
|
12059
|
-
if (!(0,
|
|
12102
|
+
import_react64.Children.forEach(children, (child) => {
|
|
12103
|
+
if (!(0, import_react64.isValidElement)(child)) {
|
|
12060
12104
|
return;
|
|
12061
12105
|
}
|
|
12062
12106
|
if (typeof child.type !== "string" && child.type.displayName === "Tab") {
|
|
12063
12107
|
tabItems.push(child);
|
|
12064
|
-
} else if (child.type ===
|
|
12108
|
+
} else if (child.type === import_react64.Fragment) {
|
|
12065
12109
|
const fragmentElement = child;
|
|
12066
12110
|
tabItems.push(...extractTabItems(fragmentElement.props.children));
|
|
12067
12111
|
} else if ((child.props.children ?? null) != null) {
|
|
@@ -12108,7 +12152,7 @@ var StyledTabsRoot = (0, import_styled_components86.default)(import_react_tabs4.
|
|
|
12108
12152
|
flex-direction: column;
|
|
12109
12153
|
height: ${({ $stickyHeaders }) => $stickyHeaders ? "100%" : "auto"};
|
|
12110
12154
|
`;
|
|
12111
|
-
var Tabs = (0,
|
|
12155
|
+
var Tabs = (0, import_react65.forwardRef)(
|
|
12112
12156
|
({
|
|
12113
12157
|
children,
|
|
12114
12158
|
fullWidth = true,
|
|
@@ -12120,7 +12164,7 @@ var Tabs = (0, import_react63.forwardRef)(
|
|
|
12120
12164
|
...props
|
|
12121
12165
|
}, ref) => {
|
|
12122
12166
|
const tabItems = extractTabItems(children);
|
|
12123
|
-
const [internalSelectedValue, setInternalSelectedValue] = (0,
|
|
12167
|
+
const [internalSelectedValue, setInternalSelectedValue] = (0, import_react65.useState)(defaultSelectedValue);
|
|
12124
12168
|
const modeProps = defaultSelectedValue !== void 0 ? {
|
|
12125
12169
|
defaultValue: defaultSelectedValue,
|
|
12126
12170
|
onValueChange: setInternalSelectedValue
|
|
@@ -12206,15 +12250,15 @@ var Tabs = (0, import_react63.forwardRef)(
|
|
|
12206
12250
|
Tabs.displayName = "Tabs";
|
|
12207
12251
|
|
|
12208
12252
|
// src/components/Tabs/Tab.tsx
|
|
12209
|
-
var
|
|
12253
|
+
var import_react66 = require("react");
|
|
12210
12254
|
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
12211
|
-
var Tab = (0,
|
|
12255
|
+
var Tab = (0, import_react66.forwardRef)(({ children }, ref) => {
|
|
12212
12256
|
return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("div", { ref, children });
|
|
12213
12257
|
});
|
|
12214
12258
|
Tab.displayName = "Tab";
|
|
12215
12259
|
|
|
12216
12260
|
// src/components/Tag/Tag.tsx
|
|
12217
|
-
var
|
|
12261
|
+
var import_react67 = require("react");
|
|
12218
12262
|
var import_styled_components87 = __toESM(require("styled-components"));
|
|
12219
12263
|
var import_type_guards51 = require("@wistia/type-guards");
|
|
12220
12264
|
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
@@ -12331,7 +12375,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
12331
12375
|
)
|
|
12332
12376
|
] });
|
|
12333
12377
|
};
|
|
12334
|
-
var Tag = (0,
|
|
12378
|
+
var Tag = (0, import_react67.forwardRef)(
|
|
12335
12379
|
({ onClickRemove, colorScheme = "inherit", href, icon, label, onClickRemoveLabel, ...props }, ref) => {
|
|
12336
12380
|
const hasIcon = (0, import_type_guards51.isNotNil)(icon);
|
|
12337
12381
|
const labelProps = (0, import_type_guards51.isNotNil)(href) && (0, import_type_guards51.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
@@ -12405,7 +12449,7 @@ var ThumbnailBadge = ({ icon, label, ...props }) => {
|
|
|
12405
12449
|
ThumbnailBadge.displayName = "ThumbnailBadge";
|
|
12406
12450
|
|
|
12407
12451
|
// src/components/Thumbnail/Thumbnail.tsx
|
|
12408
|
-
var
|
|
12452
|
+
var import_react68 = require("react");
|
|
12409
12453
|
var import_styled_components90 = __toESM(require("styled-components"));
|
|
12410
12454
|
var import_type_guards54 = require("@wistia/type-guards");
|
|
12411
12455
|
|
|
@@ -12592,7 +12636,7 @@ var StyledThumbnail = import_styled_components90.default.div`
|
|
|
12592
12636
|
border-radius: calc(8% * (9 / 16)) / 8%;
|
|
12593
12637
|
}
|
|
12594
12638
|
`;
|
|
12595
|
-
var Thumbnail = (0,
|
|
12639
|
+
var Thumbnail = (0, import_react68.forwardRef)(
|
|
12596
12640
|
({
|
|
12597
12641
|
gradientBackground = "defaultMidOne",
|
|
12598
12642
|
thumbnailImageType = "square",
|
|
@@ -12628,7 +12672,7 @@ var Thumbnail = (0, import_react66.forwardRef)(
|
|
|
12628
12672
|
Thumbnail.displayName = "Thumbnail";
|
|
12629
12673
|
|
|
12630
12674
|
// src/components/ThumbnailCollage/ThumbnailCollage.tsx
|
|
12631
|
-
var
|
|
12675
|
+
var import_react69 = __toESM(require("react"));
|
|
12632
12676
|
var import_styled_components91 = __toESM(require("styled-components"));
|
|
12633
12677
|
var import_type_guards55 = require("@wistia/type-guards");
|
|
12634
12678
|
var import_jsx_runtime271 = (
|
|
@@ -12708,10 +12752,10 @@ var ThumbnailCollage = ({
|
|
|
12708
12752
|
gradientBackground = "defaultMidOne",
|
|
12709
12753
|
...props
|
|
12710
12754
|
}) => {
|
|
12711
|
-
const thumbnailArray =
|
|
12755
|
+
const thumbnailArray = import_react69.default.Children.toArray(children);
|
|
12712
12756
|
const truncatedThumbnails = thumbnailArray.slice(0, 3);
|
|
12713
12757
|
const thumbnails = (0, import_type_guards55.isNonEmptyArray)(thumbnailArray) ? truncatedThumbnails.map((child) => {
|
|
12714
|
-
return
|
|
12758
|
+
return import_react69.default.cloneElement(child, {
|
|
12715
12759
|
...child.props,
|
|
12716
12760
|
children: void 0
|
|
12717
12761
|
});
|
|
@@ -12928,7 +12972,7 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
12928
12972
|
Table,
|
|
12929
12973
|
TableBody,
|
|
12930
12974
|
TableCell,
|
|
12931
|
-
|
|
12975
|
+
TableFoot,
|
|
12932
12976
|
TableHead,
|
|
12933
12977
|
TableRow,
|
|
12934
12978
|
Tabs,
|
|
@@ -12949,6 +12993,7 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
12949
12993
|
useActiveMq,
|
|
12950
12994
|
useAriaLive,
|
|
12951
12995
|
useBoolean,
|
|
12996
|
+
useClipboard,
|
|
12952
12997
|
useFilePicker,
|
|
12953
12998
|
useFocusTrap,
|
|
12954
12999
|
useFormState,
|