@wistia/ui 0.6.35 → 0.6.36-beta.211b75b3.8b31759
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 +542 -290
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.mjs +308 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.6.
|
|
3
|
+
* @license @wistia/ui v0.6.36-beta.211b75b3.8b31759
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -124,10 +124,12 @@ __export(index_exports, {
|
|
|
124
124
|
useAriaLive: () => useAriaLive,
|
|
125
125
|
useBoolean: () => useBoolean,
|
|
126
126
|
useFilePicker: () => import_use_file_picker.useFilePicker,
|
|
127
|
+
useFocusTrap: () => useFocusTrap,
|
|
127
128
|
useFormState: () => useFormState,
|
|
128
129
|
useImperativeFilePicker: () => import_use_file_picker.useImperativeFilePicker,
|
|
129
130
|
useKey: () => useKey,
|
|
130
131
|
useLocalStorage: () => useLocalStorage,
|
|
132
|
+
useLockBodyScroll: () => useLockBodyScroll,
|
|
131
133
|
useMq: () => useMq,
|
|
132
134
|
useToast: () => useToast,
|
|
133
135
|
useWindowSize: () => useWindowSize
|
|
@@ -2176,11 +2178,27 @@ var useLocalStorage = (key, initialValue, storage = window.localStorage) => {
|
|
|
2176
2178
|
return [storedValue, setValue, removeValue];
|
|
2177
2179
|
};
|
|
2178
2180
|
|
|
2181
|
+
// src/hooks/useLockBodyScroll/useLockBodyScroll.ts
|
|
2182
|
+
var import_react8 = require("react");
|
|
2183
|
+
var useLockBodyScroll = (locked) => {
|
|
2184
|
+
(0, import_react8.useLayoutEffect)(() => {
|
|
2185
|
+
if (locked) {
|
|
2186
|
+
const originalStyle = window.getComputedStyle(document.body).overflow;
|
|
2187
|
+
document.body.style.overflow = "hidden";
|
|
2188
|
+
return () => {
|
|
2189
|
+
document.body.style.overflow = originalStyle;
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
return () => {
|
|
2193
|
+
};
|
|
2194
|
+
}, [locked]);
|
|
2195
|
+
};
|
|
2196
|
+
|
|
2179
2197
|
// src/hooks/useMq/useMq.ts
|
|
2180
2198
|
var import_type_guards7 = require("@wistia/type-guards");
|
|
2181
2199
|
|
|
2182
2200
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
2183
|
-
var
|
|
2201
|
+
var import_react9 = require("react");
|
|
2184
2202
|
var import_throttle_debounce = require("throttle-debounce");
|
|
2185
2203
|
|
|
2186
2204
|
// src/private/helpers/isClient/isClient.ts
|
|
@@ -2188,11 +2206,11 @@ var isClient = () => typeof window !== "undefined" && typeof document !== "undef
|
|
|
2188
2206
|
|
|
2189
2207
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
2190
2208
|
var useWindowSize = (interval = 0) => {
|
|
2191
|
-
const [dimensions, setDimensions] = (0,
|
|
2209
|
+
const [dimensions, setDimensions] = (0, import_react9.useState)({
|
|
2192
2210
|
width: isClient() ? window.innerWidth : 0,
|
|
2193
2211
|
height: isClient() ? window.innerHeight : 0
|
|
2194
2212
|
});
|
|
2195
|
-
(0,
|
|
2213
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
2196
2214
|
const handleResize = (0, import_throttle_debounce.debounce)(
|
|
2197
2215
|
interval,
|
|
2198
2216
|
() => setDimensions({
|
|
@@ -2244,11 +2262,11 @@ var useActiveMq = () => {
|
|
|
2244
2262
|
};
|
|
2245
2263
|
|
|
2246
2264
|
// src/hooks/useToast/useToast.tsx
|
|
2247
|
-
var
|
|
2265
|
+
var import_react11 = require("react");
|
|
2248
2266
|
var import_sonner2 = require("sonner");
|
|
2249
2267
|
|
|
2250
2268
|
// src/private/components/Toast/Toast.tsx
|
|
2251
|
-
var
|
|
2269
|
+
var import_react10 = require("react");
|
|
2252
2270
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
2253
2271
|
var import_type_guards9 = require("@wistia/type-guards");
|
|
2254
2272
|
|
|
@@ -2478,8 +2496,8 @@ var StyledToast = import_styled_components15.default.div`
|
|
|
2478
2496
|
}
|
|
2479
2497
|
`;
|
|
2480
2498
|
var Action = ({ actionButton }) => {
|
|
2481
|
-
if ((0, import_type_guards9.isNotNil)(actionButton) && (0,
|
|
2482
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionWrapper, { children: (0,
|
|
2499
|
+
if ((0, import_type_guards9.isNotNil)(actionButton) && (0, import_react10.isValidElement)(actionButton)) {
|
|
2500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionWrapper, { children: (0, import_react10.cloneElement)(actionButton, {
|
|
2483
2501
|
variant: "soft",
|
|
2484
2502
|
// force Button variant
|
|
2485
2503
|
size: "sm"
|
|
@@ -2515,7 +2533,7 @@ Toast.displayName = "Toast";
|
|
|
2515
2533
|
// src/hooks/useToast/useToast.tsx
|
|
2516
2534
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2517
2535
|
var useToast = () => {
|
|
2518
|
-
return (0,
|
|
2536
|
+
return (0, import_react11.useCallback)(
|
|
2519
2537
|
({ message, action, colorScheme, icon, position = "bottom-left", duration = 3e3 }) => {
|
|
2520
2538
|
import_sonner2.toast.custom(
|
|
2521
2539
|
() => {
|
|
@@ -2536,14 +2554,246 @@ var useToast = () => {
|
|
|
2536
2554
|
);
|
|
2537
2555
|
};
|
|
2538
2556
|
|
|
2557
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2558
|
+
var import_react12 = require("react");
|
|
2559
|
+
var import_type_guards10 = require("@wistia/type-guards");
|
|
2560
|
+
|
|
2561
|
+
// src/hooks/useFocusTrap/helpers.ts
|
|
2562
|
+
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]';
|
|
2563
|
+
var coerceToString = (value) => value === null || value === void 0 ? "" : String(value);
|
|
2564
|
+
var isHiddenElement = (element) => {
|
|
2565
|
+
const { display, visibility } = window.getComputedStyle(element);
|
|
2566
|
+
const isHidden = display === "none" || element.style.display === "none" || visibility === "none" || element.style.visibility === "hidden";
|
|
2567
|
+
return element.offsetWidth <= 0 && element.offsetHeight <= 0 || isHidden;
|
|
2568
|
+
};
|
|
2569
|
+
var isVisibleElement = (element) => {
|
|
2570
|
+
let parentElement = element;
|
|
2571
|
+
while (parentElement) {
|
|
2572
|
+
if (parentElement === document.body) {
|
|
2573
|
+
break;
|
|
2574
|
+
}
|
|
2575
|
+
if (isHiddenElement(parentElement)) {
|
|
2576
|
+
return false;
|
|
2577
|
+
}
|
|
2578
|
+
parentElement = parentElement.parentNode;
|
|
2579
|
+
}
|
|
2580
|
+
return true;
|
|
2581
|
+
};
|
|
2582
|
+
var getElementTabIndex = (element) => {
|
|
2583
|
+
const tabIndex = element.getAttribute("tabindex");
|
|
2584
|
+
return Number.parseInt(tabIndex ?? void 0, 10);
|
|
2585
|
+
};
|
|
2586
|
+
var isTabIndexNaN = (element) => {
|
|
2587
|
+
const tabIndex = getElementTabIndex(element);
|
|
2588
|
+
return Number.isNaN(tabIndex);
|
|
2589
|
+
};
|
|
2590
|
+
var isFocusableElement = (element) => {
|
|
2591
|
+
const tabbableNodeRegEx = /input|select|textarea|button|object/;
|
|
2592
|
+
const nodeName = element.nodeName.toLowerCase();
|
|
2593
|
+
const isTabIndexNotNaN = !isTabIndexNaN(element);
|
|
2594
|
+
const isFocusable = (
|
|
2595
|
+
// @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.
|
|
2596
|
+
tabbableNodeRegEx.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN)
|
|
2597
|
+
);
|
|
2598
|
+
return Boolean(isFocusable) && isVisibleElement(element);
|
|
2599
|
+
};
|
|
2600
|
+
var isTabbableElement = (element) => {
|
|
2601
|
+
const tabIndex = getElementTabIndex(element);
|
|
2602
|
+
return (isTabIndexNaN(element) || tabIndex >= 0) && isFocusableElement(element);
|
|
2603
|
+
};
|
|
2604
|
+
var findTabbableDescendants = (element) => Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter(
|
|
2605
|
+
isTabbableElement
|
|
2606
|
+
);
|
|
2607
|
+
var focusLaterElements = [];
|
|
2608
|
+
var focusElement = null;
|
|
2609
|
+
var needToFocus = false;
|
|
2610
|
+
var handleBlur = () => {
|
|
2611
|
+
needToFocus = true;
|
|
2612
|
+
};
|
|
2613
|
+
var handleFocus = () => {
|
|
2614
|
+
if (needToFocus) {
|
|
2615
|
+
needToFocus = false;
|
|
2616
|
+
if (!focusElement) {
|
|
2617
|
+
return;
|
|
2618
|
+
}
|
|
2619
|
+
if (focusElement.contains(document.activeElement)) {
|
|
2620
|
+
return;
|
|
2621
|
+
}
|
|
2622
|
+
const element = findTabbableDescendants(focusElement)[0] ?? focusElement;
|
|
2623
|
+
element.focus();
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2626
|
+
var markForFocusLater = () => {
|
|
2627
|
+
const element = document.activeElement;
|
|
2628
|
+
if (element !== null) {
|
|
2629
|
+
focusLaterElements.push(element);
|
|
2630
|
+
}
|
|
2631
|
+
};
|
|
2632
|
+
var returnFocus = () => {
|
|
2633
|
+
let toFocus = null;
|
|
2634
|
+
try {
|
|
2635
|
+
toFocus = focusLaterElements.pop();
|
|
2636
|
+
if (toFocus) {
|
|
2637
|
+
toFocus.focus();
|
|
2638
|
+
}
|
|
2639
|
+
} catch {
|
|
2640
|
+
console.warn(
|
|
2641
|
+
`You tried to return focus to ${coerceToString(toFocus)} but it is not in the DOM anymore`
|
|
2642
|
+
);
|
|
2643
|
+
}
|
|
2644
|
+
};
|
|
2645
|
+
var setupScopedFocus = (element) => {
|
|
2646
|
+
focusElement = element;
|
|
2647
|
+
document.addEventListener("focusout", handleBlur, false);
|
|
2648
|
+
document.addEventListener("focusin", handleFocus, true);
|
|
2649
|
+
};
|
|
2650
|
+
var teardownScopedFocus = () => {
|
|
2651
|
+
focusElement = null;
|
|
2652
|
+
document.removeEventListener("focusout", handleBlur);
|
|
2653
|
+
document.removeEventListener("focusin", handleFocus);
|
|
2654
|
+
};
|
|
2655
|
+
var scopeTab = (node, event) => {
|
|
2656
|
+
const tabbable = findTabbableDescendants(node);
|
|
2657
|
+
if (!tabbable.length) {
|
|
2658
|
+
event.preventDefault();
|
|
2659
|
+
return;
|
|
2660
|
+
}
|
|
2661
|
+
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
|
|
2662
|
+
const leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
|
|
2663
|
+
if (!leavingFinalTabbable) {
|
|
2664
|
+
return;
|
|
2665
|
+
}
|
|
2666
|
+
event.preventDefault();
|
|
2667
|
+
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
|
|
2668
|
+
if (target) {
|
|
2669
|
+
target.focus();
|
|
2670
|
+
}
|
|
2671
|
+
};
|
|
2672
|
+
var createAriaHider = (containerNode, selector) => {
|
|
2673
|
+
if (selector === void 0) {
|
|
2674
|
+
selector = "body > :not(script)";
|
|
2675
|
+
}
|
|
2676
|
+
const rootNodes = Array.from(document.querySelectorAll(selector)).map((node) => {
|
|
2677
|
+
if (node.contains(containerNode)) {
|
|
2678
|
+
return void 0;
|
|
2679
|
+
}
|
|
2680
|
+
const ariaHidden = node.getAttribute("aria-hidden");
|
|
2681
|
+
if (ariaHidden === null || ariaHidden === "false") {
|
|
2682
|
+
node.setAttribute("aria-hidden", "true");
|
|
2683
|
+
}
|
|
2684
|
+
return {
|
|
2685
|
+
node,
|
|
2686
|
+
ariaHidden
|
|
2687
|
+
};
|
|
2688
|
+
});
|
|
2689
|
+
return () => {
|
|
2690
|
+
rootNodes.forEach((item) => {
|
|
2691
|
+
if (!item) {
|
|
2692
|
+
return;
|
|
2693
|
+
}
|
|
2694
|
+
if (item.ariaHidden === null) {
|
|
2695
|
+
item.node.removeAttribute("aria-hidden");
|
|
2696
|
+
} else {
|
|
2697
|
+
item.node.setAttribute("aria-hidden", item.ariaHidden);
|
|
2698
|
+
}
|
|
2699
|
+
});
|
|
2700
|
+
};
|
|
2701
|
+
};
|
|
2702
|
+
|
|
2703
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2704
|
+
var isRef = (val) => {
|
|
2705
|
+
return val !== null && typeof val === "object" && "current" in val;
|
|
2706
|
+
};
|
|
2707
|
+
var useFocusTrap = (active = true, options = {}) => {
|
|
2708
|
+
const ref = (0, import_react12.useRef)(null);
|
|
2709
|
+
const restoreAriaRef = (0, import_react12.useRef)(null);
|
|
2710
|
+
const setRef = (0, import_react12.useCallback)(
|
|
2711
|
+
(node) => {
|
|
2712
|
+
if (restoreAriaRef.current !== null) {
|
|
2713
|
+
restoreAriaRef.current();
|
|
2714
|
+
}
|
|
2715
|
+
if (ref.current) {
|
|
2716
|
+
returnFocus();
|
|
2717
|
+
teardownScopedFocus();
|
|
2718
|
+
}
|
|
2719
|
+
if (active && node !== null && node !== void 0) {
|
|
2720
|
+
setupScopedFocus(node);
|
|
2721
|
+
markForFocusLater();
|
|
2722
|
+
const processNode = (node2) => {
|
|
2723
|
+
restoreAriaRef.current = !(options.disableAriaHider ?? false) ? createAriaHider(node2) : null;
|
|
2724
|
+
let focusElement2 = null;
|
|
2725
|
+
if ((0, import_type_guards10.isNotUndefined)(options.focusSelector)) {
|
|
2726
|
+
if (isRef(options.focusSelector)) {
|
|
2727
|
+
focusElement2 = options.focusSelector.current;
|
|
2728
|
+
} else {
|
|
2729
|
+
focusElement2 = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
if (!focusElement2) {
|
|
2733
|
+
const children = Array.from(
|
|
2734
|
+
node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)
|
|
2735
|
+
);
|
|
2736
|
+
focusElement2 = // Prefer tabbable elements, But fallback to any focusable element
|
|
2737
|
+
children.find(isTabbableElement) ?? // But fallback to any focusable element
|
|
2738
|
+
children.find(isFocusableElement) ?? // Nothing found
|
|
2739
|
+
null;
|
|
2740
|
+
if (!focusElement2 && isFocusableElement(node2)) {
|
|
2741
|
+
focusElement2 = node2;
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
if (focusElement2) {
|
|
2745
|
+
focusElement2.focus();
|
|
2746
|
+
}
|
|
2747
|
+
if (!focusElement2 && process.env["NODE_ENV"] === "development") {
|
|
2748
|
+
console.warn(
|
|
2749
|
+
'[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.',
|
|
2750
|
+
node2
|
|
2751
|
+
);
|
|
2752
|
+
}
|
|
2753
|
+
};
|
|
2754
|
+
setTimeout(() => {
|
|
2755
|
+
if (node.ownerDocument) {
|
|
2756
|
+
processNode(node);
|
|
2757
|
+
}
|
|
2758
|
+
if (!node.ownerDocument && process.env["NODE_ENV"] === "development") {
|
|
2759
|
+
console.warn(
|
|
2760
|
+
"[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.",
|
|
2761
|
+
node
|
|
2762
|
+
);
|
|
2763
|
+
}
|
|
2764
|
+
});
|
|
2765
|
+
ref.current = node;
|
|
2766
|
+
} else {
|
|
2767
|
+
ref.current = null;
|
|
2768
|
+
}
|
|
2769
|
+
},
|
|
2770
|
+
[active, options.focusSelector, options.disableAriaHider]
|
|
2771
|
+
);
|
|
2772
|
+
(0, import_react12.useEffect)(() => {
|
|
2773
|
+
if (!active) {
|
|
2774
|
+
return void 0;
|
|
2775
|
+
}
|
|
2776
|
+
const handleKeyDown = (event) => {
|
|
2777
|
+
if (event.key === "Tab" && ref.current) {
|
|
2778
|
+
scopeTab(ref.current, event);
|
|
2779
|
+
}
|
|
2780
|
+
};
|
|
2781
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2782
|
+
return () => {
|
|
2783
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2784
|
+
};
|
|
2785
|
+
}, [active]);
|
|
2786
|
+
return setRef;
|
|
2787
|
+
};
|
|
2788
|
+
|
|
2539
2789
|
// src/components/ActionButton/ActionButton.tsx
|
|
2540
|
-
var
|
|
2790
|
+
var import_react16 = require("react");
|
|
2541
2791
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2542
2792
|
|
|
2543
2793
|
// src/components/Button/Button.tsx
|
|
2544
|
-
var
|
|
2794
|
+
var import_react15 = require("react");
|
|
2545
2795
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
2546
|
-
var
|
|
2796
|
+
var import_type_guards14 = require("@wistia/type-guards");
|
|
2547
2797
|
|
|
2548
2798
|
// src/css/buttonResetCss.tsx
|
|
2549
2799
|
var import_styled_components16 = require("styled-components");
|
|
@@ -2747,7 +2997,7 @@ var buttonSizeStyles = {
|
|
|
2747
2997
|
};
|
|
2748
2998
|
|
|
2749
2999
|
// src/components/Icon/Icon.tsx
|
|
2750
|
-
var
|
|
3000
|
+
var import_type_guards12 = require("@wistia/type-guards");
|
|
2751
3001
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
2752
3002
|
|
|
2753
3003
|
// src/components/Icon/icons/AbTestIcon.tsx
|
|
@@ -6602,17 +6852,17 @@ var iconMap = {
|
|
|
6602
6852
|
};
|
|
6603
6853
|
|
|
6604
6854
|
// src/private/hooks/useResponsiveProp/useResponsiveProp.ts
|
|
6605
|
-
var
|
|
6606
|
-
var
|
|
6855
|
+
var import_type_guards11 = require("@wistia/type-guards");
|
|
6856
|
+
var import_react13 = require("react");
|
|
6607
6857
|
var isResponsiveObject = (values) => {
|
|
6608
6858
|
return typeof values === "object" && values !== null && !Array.isArray(values) && "base" in values;
|
|
6609
6859
|
};
|
|
6610
6860
|
var useResponsiveProp = (values) => {
|
|
6611
6861
|
const activeMediaQueries = useActiveMq();
|
|
6612
|
-
return (0,
|
|
6613
|
-
if ((0,
|
|
6862
|
+
return (0, import_react13.useMemo)(() => {
|
|
6863
|
+
if ((0, import_type_guards11.isRecord)(values) && isResponsiveObject(values)) {
|
|
6614
6864
|
const mq2 = activeMediaQueries.find((key) => key in values);
|
|
6615
|
-
return (0,
|
|
6865
|
+
return (0, import_type_guards11.isNotUndefined)(mq2) && (0, import_type_guards11.isNotUndefined)(values[mq2]) ? values[mq2] : values.base;
|
|
6616
6866
|
}
|
|
6617
6867
|
return values;
|
|
6618
6868
|
}, [activeMediaQueries, values]);
|
|
@@ -6639,13 +6889,13 @@ var Icon = ({
|
|
|
6639
6889
|
...otherProps
|
|
6640
6890
|
}) => {
|
|
6641
6891
|
const responsiveSize = useResponsiveProp(size);
|
|
6642
|
-
if ((0,
|
|
6892
|
+
if ((0, import_type_guards12.isNil)(type)) {
|
|
6643
6893
|
throw new Error("An Icon component requires a `type` prop to be provided");
|
|
6644
6894
|
}
|
|
6645
|
-
if ((0,
|
|
6895
|
+
if ((0, import_type_guards12.isNil)(iconMap[type])) {
|
|
6646
6896
|
throw new Error(`Type "${type}" does not exist, please update type prop in Icon component.`);
|
|
6647
6897
|
}
|
|
6648
|
-
if ((0,
|
|
6898
|
+
if ((0, import_type_guards12.isNil)(iconSizeMap[responsiveSize])) {
|
|
6649
6899
|
throw new Error(
|
|
6650
6900
|
`Size "${responsiveSize}" does not exist, please update size prop in Icon component.`
|
|
6651
6901
|
);
|
|
@@ -6676,13 +6926,13 @@ var Icon = ({
|
|
|
6676
6926
|
Icon.displayName = "Icon";
|
|
6677
6927
|
|
|
6678
6928
|
// src/components/Link/Link.tsx
|
|
6679
|
-
var
|
|
6680
|
-
var
|
|
6929
|
+
var import_react14 = require("react");
|
|
6930
|
+
var import_type_guards13 = require("@wistia/type-guards");
|
|
6681
6931
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
6682
6932
|
var import_react_router_dom = require("react-router-dom");
|
|
6683
6933
|
var import_jsx_runtime192 = require("react/jsx-runtime");
|
|
6684
6934
|
var generateHref = (href, type, disabled) => {
|
|
6685
|
-
if (disabled || (0,
|
|
6935
|
+
if (disabled || (0, import_type_guards13.isNil)(href)) {
|
|
6686
6936
|
return void 0;
|
|
6687
6937
|
}
|
|
6688
6938
|
let to = href;
|
|
@@ -6694,12 +6944,12 @@ var generateHref = (href, type, disabled) => {
|
|
|
6694
6944
|
}
|
|
6695
6945
|
return to;
|
|
6696
6946
|
};
|
|
6697
|
-
var isButton = (props) => (0,
|
|
6698
|
-
var isLink = (props) => (0,
|
|
6947
|
+
var isButton = (props) => (0, import_type_guards13.isUndefined)(props.href);
|
|
6948
|
+
var isLink = (props) => (0, import_type_guards13.isNotUndefined)(props.href);
|
|
6699
6949
|
var StyledLink = import_styled_components19.default.a`
|
|
6700
6950
|
--link-icon-size: 14px;
|
|
6701
6951
|
|
|
6702
|
-
${({ href }) => (0,
|
|
6952
|
+
${({ href }) => (0, import_type_guards13.isNil)(href) && buttonResetCss};
|
|
6703
6953
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
6704
6954
|
cursor: pointer;
|
|
6705
6955
|
font-family: var(--wui-typography-family-default);
|
|
@@ -6716,7 +6966,7 @@ var StyledLink = import_styled_components19.default.a`
|
|
|
6716
6966
|
}
|
|
6717
6967
|
}
|
|
6718
6968
|
`;
|
|
6719
|
-
var Link = (0,
|
|
6969
|
+
var Link = (0, import_react14.forwardRef)(
|
|
6720
6970
|
({
|
|
6721
6971
|
beforeAction,
|
|
6722
6972
|
children,
|
|
@@ -6740,16 +6990,16 @@ var Link = (0, import_react12.forwardRef)(
|
|
|
6740
6990
|
} catch (error) {
|
|
6741
6991
|
console.error(error);
|
|
6742
6992
|
} finally {
|
|
6743
|
-
if ((0,
|
|
6993
|
+
if ((0, import_type_guards13.isFunction)(props.onClick)) {
|
|
6744
6994
|
props.onClick(event);
|
|
6745
6995
|
} else if (routingCallback !== null) {
|
|
6746
6996
|
routingCallback();
|
|
6747
|
-
} else if ((0,
|
|
6997
|
+
} else if ((0, import_type_guards13.isNotNil)(to)) {
|
|
6748
6998
|
window.location.assign(to);
|
|
6749
6999
|
} else {
|
|
6750
7000
|
}
|
|
6751
7001
|
}
|
|
6752
|
-
} else if ((0,
|
|
7002
|
+
} else if ((0, import_type_guards13.isFunction)(props.onClick)) {
|
|
6753
7003
|
props.onClick(event);
|
|
6754
7004
|
} else {
|
|
6755
7005
|
}
|
|
@@ -6810,7 +7060,7 @@ Link.displayName = "Link";
|
|
|
6810
7060
|
|
|
6811
7061
|
// src/components/Button/Button.tsx
|
|
6812
7062
|
var import_jsx_runtime193 = require("react/jsx-runtime");
|
|
6813
|
-
var isLink2 = (props) => (0,
|
|
7063
|
+
var isLink2 = (props) => (0, import_type_guards14.isNotUndefined)(props.href);
|
|
6814
7064
|
var StyledButton = import_styled_components20.default.button`
|
|
6815
7065
|
${buttonResetCss}
|
|
6816
7066
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -6850,8 +7100,8 @@ var ButtonContent = ({
|
|
|
6850
7100
|
/* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
6851
7101
|
StyledButtonContent,
|
|
6852
7102
|
{
|
|
6853
|
-
$hasLeftIcon: (0,
|
|
6854
|
-
$hasRightIcon: (0,
|
|
7103
|
+
$hasLeftIcon: (0, import_type_guards14.isNotNil)(leftIcon),
|
|
7104
|
+
$hasRightIcon: (0, import_type_guards14.isNotNil)(rightIcon),
|
|
6855
7105
|
$isLoading: isLoading,
|
|
6856
7106
|
children: [
|
|
6857
7107
|
leftIcon ?? null,
|
|
@@ -6862,7 +7112,7 @@ var ButtonContent = ({
|
|
|
6862
7112
|
)
|
|
6863
7113
|
] });
|
|
6864
7114
|
};
|
|
6865
|
-
var Button = (0,
|
|
7115
|
+
var Button = (0, import_react15.forwardRef)(
|
|
6866
7116
|
({
|
|
6867
7117
|
children,
|
|
6868
7118
|
forceState,
|
|
@@ -6919,7 +7169,7 @@ var Button = (0, import_react13.forwardRef)(
|
|
|
6919
7169
|
event.preventDefault();
|
|
6920
7170
|
return;
|
|
6921
7171
|
}
|
|
6922
|
-
if ((0,
|
|
7172
|
+
if ((0, import_type_guards14.isNotNil)(onClick)) {
|
|
6923
7173
|
onClick(event);
|
|
6924
7174
|
}
|
|
6925
7175
|
};
|
|
@@ -7041,7 +7291,7 @@ var StyledLabel = import_styled_components21.default.span`
|
|
|
7041
7291
|
grid-row: 2;
|
|
7042
7292
|
text-align: left;
|
|
7043
7293
|
`;
|
|
7044
|
-
var ActionButton = (0,
|
|
7294
|
+
var ActionButton = (0, import_react16.forwardRef)(
|
|
7045
7295
|
({
|
|
7046
7296
|
icon,
|
|
7047
7297
|
colorScheme = "default",
|
|
@@ -7085,8 +7335,8 @@ var ActionButton = (0, import_react14.forwardRef)(
|
|
|
7085
7335
|
ActionButton.displayName = "ActionButton";
|
|
7086
7336
|
|
|
7087
7337
|
// src/components/Avatar/Avatar.tsx
|
|
7088
|
-
var
|
|
7089
|
-
var
|
|
7338
|
+
var import_react17 = require("react");
|
|
7339
|
+
var import_type_guards16 = require("@wistia/type-guards");
|
|
7090
7340
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
7091
7341
|
|
|
7092
7342
|
// src/components/ColorSchemeWrapper/ColorSchemeWrapper.tsx
|
|
@@ -7129,13 +7379,13 @@ var ColorSchemeWrapper = ({
|
|
|
7129
7379
|
ColorSchemeWrapper.displayName = "ColorSchemeWrapper";
|
|
7130
7380
|
|
|
7131
7381
|
// src/components/Avatar/formatNameForDisplay.tsx
|
|
7132
|
-
var
|
|
7382
|
+
var import_type_guards15 = require("@wistia/type-guards");
|
|
7133
7383
|
var containsEmojiCharacter = (char) => {
|
|
7134
7384
|
const emojiRegex = /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu;
|
|
7135
7385
|
return emojiRegex.test(char);
|
|
7136
7386
|
};
|
|
7137
7387
|
var formatNameForDisplay = (name) => {
|
|
7138
|
-
if ((0,
|
|
7388
|
+
if ((0, import_type_guards15.isNil)(name) || !(0, import_type_guards15.isString)(name) || (0, import_type_guards15.isEmptyString)(name) || containsEmojiCharacter(name)) {
|
|
7139
7389
|
return "U";
|
|
7140
7390
|
}
|
|
7141
7391
|
const firstChar = name.trim().substring(0, 1);
|
|
@@ -7198,7 +7448,7 @@ var AvatarWrapper = import_styled_components23.default.div`
|
|
|
7198
7448
|
max-height: ${({ $maxHeight }) => $maxHeight}px;
|
|
7199
7449
|
`;
|
|
7200
7450
|
var chooseColorScheme = (name) => {
|
|
7201
|
-
if ((0,
|
|
7451
|
+
if ((0, import_type_guards16.isNil)(name) || name === "Anonymous") {
|
|
7202
7452
|
return "default";
|
|
7203
7453
|
}
|
|
7204
7454
|
const filteredColors = colorSchemeOptions.filter(
|
|
@@ -7217,8 +7467,8 @@ var Avatar = ({
|
|
|
7217
7467
|
onImageLoad,
|
|
7218
7468
|
...otherProps
|
|
7219
7469
|
}) => {
|
|
7220
|
-
const [imageLoadState, setImageLoadState] = (0,
|
|
7221
|
-
(0,
|
|
7470
|
+
const [imageLoadState, setImageLoadState] = (0, import_react17.useState)("loading");
|
|
7471
|
+
(0, import_react17.useEffect)(() => {
|
|
7222
7472
|
setImageLoadState("loading");
|
|
7223
7473
|
}, [imageUrl]);
|
|
7224
7474
|
const handleImageLoad = () => {
|
|
@@ -7230,8 +7480,8 @@ var Avatar = ({
|
|
|
7230
7480
|
onImageLoad?.({ state: "error", type: "initials" });
|
|
7231
7481
|
};
|
|
7232
7482
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
7233
|
-
const avatarColor = (0,
|
|
7234
|
-
const showInitials = (0,
|
|
7483
|
+
const avatarColor = (0, import_react17.useMemo)(() => chooseColorScheme(name), [name]);
|
|
7484
|
+
const showInitials = (0, import_type_guards16.isNil)(imageUrl) || imageLoadState === "error";
|
|
7235
7485
|
return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
7236
7486
|
AvatarWrapper,
|
|
7237
7487
|
{
|
|
@@ -7260,9 +7510,9 @@ var Avatar = ({
|
|
|
7260
7510
|
Avatar.displayName = "Avatar";
|
|
7261
7511
|
|
|
7262
7512
|
// src/components/Badge/Badge.tsx
|
|
7263
|
-
var
|
|
7513
|
+
var import_react18 = require("react");
|
|
7264
7514
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
7265
|
-
var
|
|
7515
|
+
var import_type_guards17 = require("@wistia/type-guards");
|
|
7266
7516
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
7267
7517
|
var StyledBadge = import_styled_components24.default.div`
|
|
7268
7518
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -7284,9 +7534,9 @@ var StyledBadge = import_styled_components24.default.div`
|
|
|
7284
7534
|
width: 12px;
|
|
7285
7535
|
}
|
|
7286
7536
|
`;
|
|
7287
|
-
var Badge = (0,
|
|
7537
|
+
var Badge = (0, import_react18.forwardRef)(
|
|
7288
7538
|
({ colorScheme = "inherit", label, icon, ...otherProps }, ref) => {
|
|
7289
|
-
const hasIcon = (0,
|
|
7539
|
+
const hasIcon = (0, import_type_guards17.isNotNil)(icon);
|
|
7290
7540
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
|
|
7291
7541
|
StyledBadge,
|
|
7292
7542
|
{
|
|
@@ -7305,9 +7555,9 @@ var Badge = (0, import_react16.forwardRef)(
|
|
|
7305
7555
|
Badge.displayName = "Badge";
|
|
7306
7556
|
|
|
7307
7557
|
// src/components/Box/Box.tsx
|
|
7308
|
-
var
|
|
7558
|
+
var import_react19 = require("react");
|
|
7309
7559
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
7310
|
-
var
|
|
7560
|
+
var import_type_guards18 = require("@wistia/type-guards");
|
|
7311
7561
|
|
|
7312
7562
|
// src/private/helpers/makePolymorphic/makePolymorphic.tsx
|
|
7313
7563
|
var makePolymorphic = (component) => {
|
|
@@ -7318,8 +7568,8 @@ var makePolymorphic = (component) => {
|
|
|
7318
7568
|
var import_jsx_runtime198 = require("react/jsx-runtime");
|
|
7319
7569
|
var isDev = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
|
|
7320
7570
|
var getGapStyle = (gap) => {
|
|
7321
|
-
if ((0,
|
|
7322
|
-
if ((0,
|
|
7571
|
+
if ((0, import_type_guards18.isNotNil)(gap)) {
|
|
7572
|
+
if ((0, import_type_guards18.isRecord)(gap)) {
|
|
7323
7573
|
return Object.entries(gap).map(([key, value]) => {
|
|
7324
7574
|
return `${key}-gap: var(--wui-${value})};`;
|
|
7325
7575
|
}).join("");
|
|
@@ -7394,8 +7644,8 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
7394
7644
|
align-content: ${({ $alignContent }) => $alignContent};
|
|
7395
7645
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
7396
7646
|
align-self: ${({ $alignSelf }) => $alignSelf ?? null};
|
|
7397
|
-
display: ${({ $inline }) => (0,
|
|
7398
|
-
flex-basis: ${({ $basis }) => (0,
|
|
7647
|
+
display: ${({ $inline }) => (0, import_type_guards18.isNotNil)($inline) && $inline ? "inline-flex" : "flex"};
|
|
7648
|
+
flex-basis: ${({ $basis }) => (0, import_type_guards18.isNotNil)($basis) ? $basis : null};
|
|
7399
7649
|
flex-direction: ${({ $flexDirection }) => $flexDirection};
|
|
7400
7650
|
${({ $fillBox: fill }) => getFillStyle(fill)};
|
|
7401
7651
|
${({ $fillViewport }) => getFillViewportStyle($fillViewport)};
|
|
@@ -7405,22 +7655,22 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
7405
7655
|
width: ${({ $width }) => $width ?? null};
|
|
7406
7656
|
|
|
7407
7657
|
/* Box children styles */
|
|
7408
|
-
flex-grow: ${({ $grow }) => (0,
|
|
7409
|
-
flex-shrink: ${({ $shrink }) => (0,
|
|
7658
|
+
flex-grow: ${({ $grow }) => (0, import_type_guards18.isNotNil)($grow) ? $grow : null};
|
|
7659
|
+
flex-shrink: ${({ $shrink }) => (0, import_type_guards18.isNotNil)($shrink) ? $shrink : null};
|
|
7410
7660
|
flex-wrap: ${({ $wrapItems }) => $wrapItems ? "wrap" : "nowrap"};
|
|
7411
7661
|
justify-content: ${({ $justifyContent }) => $justifyContent};
|
|
7412
|
-
order: ${({ $order }) => (0,
|
|
7662
|
+
order: ${({ $order }) => (0, import_type_guards18.isNotNil)($order) ? $order : null};
|
|
7413
7663
|
`;
|
|
7414
7664
|
var wrapChildren = (children) => {
|
|
7415
|
-
if ((0,
|
|
7665
|
+
if ((0, import_type_guards18.isNotNil)(children)) {
|
|
7416
7666
|
if (typeof children === "object" && isDev) {
|
|
7417
|
-
return
|
|
7418
|
-
if ((0,
|
|
7667
|
+
return import_react19.Children.map(children, (child) => {
|
|
7668
|
+
if ((0, import_type_guards18.isNil)(child)) return null;
|
|
7419
7669
|
const elementParams = {};
|
|
7420
7670
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
7421
7671
|
elementParams.hasBoxParent = true;
|
|
7422
7672
|
}
|
|
7423
|
-
return (0,
|
|
7673
|
+
return (0, import_react19.cloneElement)(child, elementParams);
|
|
7424
7674
|
});
|
|
7425
7675
|
}
|
|
7426
7676
|
return children;
|
|
@@ -7428,7 +7678,7 @@ var wrapChildren = (children) => {
|
|
|
7428
7678
|
return null;
|
|
7429
7679
|
};
|
|
7430
7680
|
var DEFAULT_ELEMENT = "div";
|
|
7431
|
-
var BoxComponent = (0,
|
|
7681
|
+
var BoxComponent = (0, import_react19.forwardRef)(
|
|
7432
7682
|
({
|
|
7433
7683
|
alignContent = "stretch",
|
|
7434
7684
|
alignItems = "flex-start",
|
|
@@ -7453,7 +7703,7 @@ var BoxComponent = (0, import_react17.forwardRef)(
|
|
|
7453
7703
|
flexMode,
|
|
7454
7704
|
...otherProps
|
|
7455
7705
|
}, ref) => {
|
|
7456
|
-
if ((0,
|
|
7706
|
+
if ((0, import_type_guards18.isNotUndefined)(height)) {
|
|
7457
7707
|
if (fill === true || fill === "vertical") {
|
|
7458
7708
|
throw new Error('Cannot use height prop with fill="vertical" or fill={true}');
|
|
7459
7709
|
}
|
|
@@ -7463,7 +7713,7 @@ var BoxComponent = (0, import_react17.forwardRef)(
|
|
|
7463
7713
|
);
|
|
7464
7714
|
}
|
|
7465
7715
|
}
|
|
7466
|
-
if ((0,
|
|
7716
|
+
if ((0, import_type_guards18.isNotUndefined)(width)) {
|
|
7467
7717
|
if (fill === true || fill === "horizontal") {
|
|
7468
7718
|
throw new Error('Cannot use width prop with fill="horizontal" or fill={true}');
|
|
7469
7719
|
}
|
|
@@ -7505,7 +7755,7 @@ BoxComponent.displayName = "Box";
|
|
|
7505
7755
|
var Box = makePolymorphic(BoxComponent);
|
|
7506
7756
|
|
|
7507
7757
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
7508
|
-
var
|
|
7758
|
+
var import_react20 = require("react");
|
|
7509
7759
|
var import_styled_components26 = __toESM(require("styled-components"));
|
|
7510
7760
|
var import_jsx_runtime199 = require("react/jsx-runtime");
|
|
7511
7761
|
var StyledBreadcrumbs = import_styled_components26.default.nav`
|
|
@@ -7521,7 +7771,7 @@ var StyledBreadcrumbs = import_styled_components26.default.nav`
|
|
|
7521
7771
|
var BUFFER_WIDTH = 10;
|
|
7522
7772
|
var Breadcrumbs = ({ children, ...props }) => {
|
|
7523
7773
|
const { isXsAndDown } = useMq();
|
|
7524
|
-
let crumbs =
|
|
7774
|
+
let crumbs = import_react20.Children.toArray(children);
|
|
7525
7775
|
if (isXsAndDown) {
|
|
7526
7776
|
crumbs = crumbs.slice(-1);
|
|
7527
7777
|
}
|
|
@@ -7588,7 +7838,7 @@ var Breadcrumb = ({ icon, href, children, ...props }) => {
|
|
|
7588
7838
|
|
|
7589
7839
|
// src/components/ButtonGroup/ButtonGroup.tsx
|
|
7590
7840
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
7591
|
-
var
|
|
7841
|
+
var import_type_guards19 = require("@wistia/type-guards");
|
|
7592
7842
|
var import_jsx_runtime201 = require("react/jsx-runtime");
|
|
7593
7843
|
var getAlignment = (align) => {
|
|
7594
7844
|
if (align === "center") {
|
|
@@ -7634,7 +7884,7 @@ var ButtonGroup = ({
|
|
|
7634
7884
|
collapseOnSmallScreens = true,
|
|
7635
7885
|
...otherProps
|
|
7636
7886
|
}) => {
|
|
7637
|
-
if ((0,
|
|
7887
|
+
if ((0, import_type_guards19.isNil)(children)) {
|
|
7638
7888
|
return null;
|
|
7639
7889
|
}
|
|
7640
7890
|
return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
|
|
@@ -7708,7 +7958,7 @@ var Card = ({
|
|
|
7708
7958
|
Card.displayName = "Card";
|
|
7709
7959
|
|
|
7710
7960
|
// src/components/Center/Center.tsx
|
|
7711
|
-
var
|
|
7961
|
+
var import_react21 = require("react");
|
|
7712
7962
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
7713
7963
|
var import_jsx_runtime203 = require("react/jsx-runtime");
|
|
7714
7964
|
var StyledCenter = import_styled_components30.default.div`
|
|
@@ -7723,7 +7973,7 @@ var StyledCenter = import_styled_components30.default.div`
|
|
|
7723
7973
|
align-items: center;
|
|
7724
7974
|
`}
|
|
7725
7975
|
`;
|
|
7726
|
-
var Center = (0,
|
|
7976
|
+
var Center = (0, import_react21.forwardRef)(
|
|
7727
7977
|
({ maxWidth = "100%", gutterWidth = "space-00", intrinsic = false, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
|
|
7728
7978
|
StyledCenter,
|
|
7729
7979
|
{
|
|
@@ -7739,17 +7989,17 @@ var Center = (0, import_react19.forwardRef)(
|
|
|
7739
7989
|
Center.displayName = "Center";
|
|
7740
7990
|
|
|
7741
7991
|
// src/components/Checkbox/Checkbox.tsx
|
|
7742
|
-
var
|
|
7992
|
+
var import_react22 = require("react");
|
|
7743
7993
|
var import_styled_components34 = __toESM(require("styled-components"));
|
|
7744
|
-
var
|
|
7994
|
+
var import_type_guards23 = require("@wistia/type-guards");
|
|
7745
7995
|
|
|
7746
7996
|
// src/private/components/FormControlLabel/FormControlLabel.tsx
|
|
7747
7997
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
7748
|
-
var
|
|
7998
|
+
var import_type_guards22 = require("@wistia/type-guards");
|
|
7749
7999
|
|
|
7750
8000
|
// src/private/components/FormControlLabel/FormControlLabelDescription.tsx
|
|
7751
8001
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
7752
|
-
var
|
|
8002
|
+
var import_type_guards20 = require("@wistia/type-guards");
|
|
7753
8003
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
7754
8004
|
var disabledStyle = import_styled_components31.css`
|
|
7755
8005
|
color: var(--wui-color-text-disabled);
|
|
@@ -7769,7 +8019,7 @@ var FormControlLabelDescription = ({
|
|
|
7769
8019
|
disabled = false,
|
|
7770
8020
|
...props
|
|
7771
8021
|
}) => {
|
|
7772
|
-
if ((0,
|
|
8022
|
+
if ((0, import_type_guards20.isNil)(children)) {
|
|
7773
8023
|
return null;
|
|
7774
8024
|
}
|
|
7775
8025
|
return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
|
|
@@ -7785,7 +8035,7 @@ FormControlLabelDescription.displayName = "FormControlLabelDescription";
|
|
|
7785
8035
|
|
|
7786
8036
|
// src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
|
|
7787
8037
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
7788
|
-
var
|
|
8038
|
+
var import_type_guards21 = require("@wistia/type-guards");
|
|
7789
8039
|
var import_jsx_runtime205 = require("react/jsx-runtime");
|
|
7790
8040
|
var VisuallyHidden = import_styled_components32.default.div({ ...visuallyHiddenStyle });
|
|
7791
8041
|
var VisuallyHiddenButFocusable = import_styled_components32.default.div({
|
|
@@ -7797,7 +8047,7 @@ var ScreenReaderOnly = ({
|
|
|
7797
8047
|
focusable = false,
|
|
7798
8048
|
...otherProps
|
|
7799
8049
|
}) => {
|
|
7800
|
-
const accessibleText = (0,
|
|
8050
|
+
const accessibleText = (0, import_type_guards21.isNotNil)(text) ? text : children;
|
|
7801
8051
|
if (focusable) {
|
|
7802
8052
|
return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(VisuallyHiddenButFocusable, { ...otherProps, children: accessibleText });
|
|
7803
8053
|
}
|
|
@@ -7837,7 +8087,7 @@ var FormControlLabel = ({
|
|
|
7837
8087
|
hideLabel = false,
|
|
7838
8088
|
...props
|
|
7839
8089
|
}) => {
|
|
7840
|
-
if ((0,
|
|
8090
|
+
if ((0, import_type_guards22.isNil)(label)) {
|
|
7841
8091
|
return null;
|
|
7842
8092
|
}
|
|
7843
8093
|
const labelContent = hideLabel ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(ScreenReaderOnly, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(StyledLabelWrapper, { children: [
|
|
@@ -7851,7 +8101,7 @@ var FormControlLabel = ({
|
|
|
7851
8101
|
htmlFor,
|
|
7852
8102
|
...props,
|
|
7853
8103
|
children: [
|
|
7854
|
-
(0,
|
|
8104
|
+
(0, import_type_guards22.isNotNil)(controlSlot) ? controlSlot : null,
|
|
7855
8105
|
labelContent
|
|
7856
8106
|
]
|
|
7857
8107
|
}
|
|
@@ -7959,7 +8209,7 @@ var StyledHiddenCheckboxInput = import_styled_components34.default.input`
|
|
|
7959
8209
|
display: block;
|
|
7960
8210
|
}
|
|
7961
8211
|
`;
|
|
7962
|
-
var Checkbox = (0,
|
|
8212
|
+
var Checkbox = (0, import_react22.forwardRef)(
|
|
7963
8213
|
({
|
|
7964
8214
|
checked,
|
|
7965
8215
|
disabled = false,
|
|
@@ -7974,8 +8224,8 @@ var Checkbox = (0, import_react20.forwardRef)(
|
|
|
7974
8224
|
hideLabel = false,
|
|
7975
8225
|
...props
|
|
7976
8226
|
}, ref) => {
|
|
7977
|
-
const generatedId = (0,
|
|
7978
|
-
const computedId = (0,
|
|
8227
|
+
const generatedId = (0, import_react22.useId)();
|
|
8228
|
+
const computedId = (0, import_type_guards23.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-${generatedId}`;
|
|
7979
8229
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(StyledCheckboxWrapper, { disabled, children: [
|
|
7980
8230
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
7981
8231
|
StyledHiddenCheckboxInput,
|
|
@@ -8017,9 +8267,9 @@ var Checkbox = (0, import_react20.forwardRef)(
|
|
|
8017
8267
|
Checkbox.displayName = "Checkbox";
|
|
8018
8268
|
|
|
8019
8269
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
8020
|
-
var
|
|
8270
|
+
var import_react23 = require("react");
|
|
8021
8271
|
var ClickRegion = ({ children, targetRef }) => {
|
|
8022
|
-
(0,
|
|
8272
|
+
(0, import_react23.useEffect)(() => {
|
|
8023
8273
|
if (targetRef.current && targetRef.current.tagName === "A") {
|
|
8024
8274
|
targetRef.current.setAttribute("data-click-region-target-link", "");
|
|
8025
8275
|
} else if (targetRef.current && targetRef.current.tagName === "BUTTON") {
|
|
@@ -8027,7 +8277,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8027
8277
|
} else {
|
|
8028
8278
|
}
|
|
8029
8279
|
}, [targetRef]);
|
|
8030
|
-
const handleClick = (0,
|
|
8280
|
+
const handleClick = (0, import_react23.useCallback)(
|
|
8031
8281
|
(event) => {
|
|
8032
8282
|
const node = targetRef.current;
|
|
8033
8283
|
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")) {
|
|
@@ -8044,7 +8294,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8044
8294
|
},
|
|
8045
8295
|
[targetRef]
|
|
8046
8296
|
);
|
|
8047
|
-
return (0,
|
|
8297
|
+
return (0, import_react23.cloneElement)(import_react23.Children.only(children), {
|
|
8048
8298
|
"data-click-region": true,
|
|
8049
8299
|
onClick: handleClick
|
|
8050
8300
|
});
|
|
@@ -8053,7 +8303,7 @@ ClickRegion.displayName = "ClickRegion";
|
|
|
8053
8303
|
|
|
8054
8304
|
// src/components/Collapsible/Collapsible.tsx
|
|
8055
8305
|
var import_react_collapsible = require("@radix-ui/react-collapsible");
|
|
8056
|
-
var
|
|
8306
|
+
var import_type_guards24 = require("@wistia/type-guards");
|
|
8057
8307
|
var import_styled_components35 = __toESM(require("styled-components"));
|
|
8058
8308
|
var import_jsx_runtime208 = require("react/jsx-runtime");
|
|
8059
8309
|
var StyledRoot = (0, import_styled_components35.default)(import_react_collapsible.Root)`
|
|
@@ -8070,31 +8320,31 @@ var Collapsible = ({
|
|
|
8070
8320
|
onOpenChange
|
|
8071
8321
|
}) => {
|
|
8072
8322
|
const controlProps = {
|
|
8073
|
-
...(0,
|
|
8323
|
+
...(0, import_type_guards24.isNotNil)(onOpenChange) && (0, import_type_guards24.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
8074
8324
|
};
|
|
8075
8325
|
return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(StyledRoot, { ...controlProps, children });
|
|
8076
8326
|
};
|
|
8077
8327
|
Collapsible.displayName = "Collapsible";
|
|
8078
8328
|
|
|
8079
8329
|
// src/components/Collapsible/CollapsibleTrigger.tsx
|
|
8080
|
-
var
|
|
8330
|
+
var import_react24 = require("react");
|
|
8081
8331
|
var import_react_collapsible2 = require("@radix-ui/react-collapsible");
|
|
8082
8332
|
var import_jsx_runtime209 = require("react/jsx-runtime");
|
|
8083
8333
|
var CollapsibleTrigger = ({ children }) => {
|
|
8084
|
-
|
|
8334
|
+
import_react24.Children.only(children);
|
|
8085
8335
|
return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_react_collapsible2.Trigger, { asChild: true, children });
|
|
8086
8336
|
};
|
|
8087
8337
|
|
|
8088
8338
|
// src/components/Collapsible/CollapsibleContent.tsx
|
|
8089
8339
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
8090
8340
|
var import_react_collapsible3 = require("@radix-ui/react-collapsible");
|
|
8091
|
-
var
|
|
8341
|
+
var import_type_guards25 = require("@wistia/type-guards");
|
|
8092
8342
|
var import_jsx_runtime210 = require("react/jsx-runtime");
|
|
8093
8343
|
var ClampedContent = import_styled_components36.default.div.attrs({ "data-wui-collapsible-content": true })`
|
|
8094
8344
|
--wui-collapsible-content-clamp-lines: ${({ $clamp }) => $clamp};
|
|
8095
8345
|
`;
|
|
8096
8346
|
var CollapsibleContent = ({ clamp, children }) => {
|
|
8097
|
-
if ((0,
|
|
8347
|
+
if ((0, import_type_guards25.isNotUndefined)(clamp)) {
|
|
8098
8348
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(ClampedContent, { $clamp: clamp, children });
|
|
8099
8349
|
}
|
|
8100
8350
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(import_react_collapsible3.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(import_jsx_runtime210.Fragment, { children: [
|
|
@@ -8105,10 +8355,10 @@ var CollapsibleContent = ({ clamp, children }) => {
|
|
|
8105
8355
|
|
|
8106
8356
|
// src/components/DataCards/DataCard.tsx
|
|
8107
8357
|
var import_styled_components38 = __toESM(require("styled-components"));
|
|
8108
|
-
var
|
|
8358
|
+
var import_type_guards26 = require("@wistia/type-guards");
|
|
8109
8359
|
|
|
8110
8360
|
// src/components/Heading/Heading.tsx
|
|
8111
|
-
var
|
|
8361
|
+
var import_react25 = require("react");
|
|
8112
8362
|
var import_styled_components37 = __toESM(require("styled-components"));
|
|
8113
8363
|
var import_jsx_runtime211 = require("react/jsx-runtime");
|
|
8114
8364
|
var heroStyle = import_styled_components37.css`
|
|
@@ -8195,7 +8445,7 @@ var variantElementMap = {
|
|
|
8195
8445
|
heading5: "h5",
|
|
8196
8446
|
heading6: "h6"
|
|
8197
8447
|
};
|
|
8198
|
-
var HeadingComponent = (0,
|
|
8448
|
+
var HeadingComponent = (0, import_react25.forwardRef)(
|
|
8199
8449
|
({
|
|
8200
8450
|
align = "left",
|
|
8201
8451
|
colorScheme = "inherit",
|
|
@@ -8314,8 +8564,8 @@ var DataCard = ({
|
|
|
8314
8564
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledLoadingValue, {}) : value
|
|
8315
8565
|
}
|
|
8316
8566
|
),
|
|
8317
|
-
(0,
|
|
8318
|
-
(0,
|
|
8567
|
+
(0, import_type_guards26.isNotNull)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledSlot, { children: upperRightSlot }),
|
|
8568
|
+
(0, import_type_guards26.isNotNull)(trend) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledDataCardTrendContainer, { children: trend })
|
|
8319
8569
|
]
|
|
8320
8570
|
}
|
|
8321
8571
|
);
|
|
@@ -8359,7 +8609,7 @@ DataCards.displayName = "DataCards";
|
|
|
8359
8609
|
var import_styled_components41 = __toESM(require("styled-components"));
|
|
8360
8610
|
|
|
8361
8611
|
// src/components/Text/Text.tsx
|
|
8362
|
-
var
|
|
8612
|
+
var import_react26 = require("react");
|
|
8363
8613
|
var import_styled_components40 = __toESM(require("styled-components"));
|
|
8364
8614
|
var import_jsx_runtime214 = require("react/jsx-runtime");
|
|
8365
8615
|
var bodyBoldStyles = import_styled_components40.css`
|
|
@@ -8525,7 +8775,7 @@ var StyledText = import_styled_components40.default.div`
|
|
|
8525
8775
|
}
|
|
8526
8776
|
`}
|
|
8527
8777
|
`;
|
|
8528
|
-
var TextComponent = (0,
|
|
8778
|
+
var TextComponent = (0, import_react26.forwardRef)(
|
|
8529
8779
|
({
|
|
8530
8780
|
align = "left",
|
|
8531
8781
|
colorScheme = "inherit",
|
|
@@ -8641,7 +8891,7 @@ Divider.displayName = "Divider";
|
|
|
8641
8891
|
|
|
8642
8892
|
// src/components/EditableHeading/EditableHeading.tsx
|
|
8643
8893
|
var import_styled_components45 = __toESM(require("styled-components"));
|
|
8644
|
-
var
|
|
8894
|
+
var import_react28 = require("react");
|
|
8645
8895
|
|
|
8646
8896
|
// src/components/Tooltip/Tooltip.tsx
|
|
8647
8897
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
@@ -8750,9 +9000,9 @@ var Tooltip = ({
|
|
|
8750
9000
|
Tooltip.displayName = "Tooltip";
|
|
8751
9001
|
|
|
8752
9002
|
// src/components/Input/Input.tsx
|
|
8753
|
-
var
|
|
9003
|
+
var import_react27 = require("react");
|
|
8754
9004
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
8755
|
-
var
|
|
9005
|
+
var import_type_guards27 = require("@wistia/type-guards");
|
|
8756
9006
|
var import_jsx_runtime218 = require("react/jsx-runtime");
|
|
8757
9007
|
var inputStyles = import_styled_components44.css`
|
|
8758
9008
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -8839,7 +9089,7 @@ var StyledInputContainer = import_styled_components44.default.div`
|
|
|
8839
9089
|
padding-right: 32px;
|
|
8840
9090
|
}
|
|
8841
9091
|
`;
|
|
8842
|
-
var Input = (0,
|
|
9092
|
+
var Input = (0, import_react27.forwardRef)(
|
|
8843
9093
|
({
|
|
8844
9094
|
fullWidth = true,
|
|
8845
9095
|
monospace = false,
|
|
@@ -8849,30 +9099,30 @@ var Input = (0, import_react25.forwardRef)(
|
|
|
8849
9099
|
rightIcon,
|
|
8850
9100
|
...props
|
|
8851
9101
|
}, externalRef) => {
|
|
8852
|
-
const internalRef = (0,
|
|
9102
|
+
const internalRef = (0, import_react27.useRef)();
|
|
8853
9103
|
const ref = (
|
|
8854
9104
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
8855
|
-
(0,
|
|
9105
|
+
(0, import_type_guards27.isNotNil)(externalRef) && (0, import_type_guards27.isRecord)(externalRef) && "current" in externalRef ? externalRef : internalRef
|
|
8856
9106
|
);
|
|
8857
9107
|
let leftIconToDisplay = leftIcon;
|
|
8858
|
-
if ((0,
|
|
9108
|
+
if ((0, import_type_guards27.isNil)(leftIcon) && type === "search") {
|
|
8859
9109
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(Icon, { type: "search" });
|
|
8860
9110
|
}
|
|
8861
|
-
if ((0,
|
|
8862
|
-
leftIconToDisplay = (0,
|
|
9111
|
+
if ((0, import_type_guards27.isNotNil)(leftIconToDisplay)) {
|
|
9112
|
+
leftIconToDisplay = (0, import_react27.cloneElement)(leftIconToDisplay, {
|
|
8863
9113
|
size: "md",
|
|
8864
9114
|
className: "wui-input-left-icon"
|
|
8865
9115
|
});
|
|
8866
9116
|
}
|
|
8867
9117
|
let rightIconToDisplay = rightIcon;
|
|
8868
|
-
if ((0,
|
|
8869
|
-
rightIconToDisplay = (0,
|
|
9118
|
+
if ((0, import_type_guards27.isNotNil)(rightIconToDisplay)) {
|
|
9119
|
+
rightIconToDisplay = (0, import_react27.cloneElement)(rightIconToDisplay, {
|
|
8870
9120
|
size: "md",
|
|
8871
9121
|
className: "wui-input-right-icon"
|
|
8872
9122
|
});
|
|
8873
9123
|
}
|
|
8874
|
-
const
|
|
8875
|
-
if ((0,
|
|
9124
|
+
const handleFocus2 = (event) => {
|
|
9125
|
+
if ((0, import_type_guards27.isNotNil)(props.onFocus)) {
|
|
8876
9126
|
props.onFocus(event);
|
|
8877
9127
|
}
|
|
8878
9128
|
if (autoSelect && isValidRef(ref) && "current" in ref) {
|
|
@@ -8893,14 +9143,14 @@ var Input = (0, import_react25.forwardRef)(
|
|
|
8893
9143
|
{
|
|
8894
9144
|
...props,
|
|
8895
9145
|
ref,
|
|
8896
|
-
onFocus:
|
|
9146
|
+
onFocus: handleFocus2
|
|
8897
9147
|
}
|
|
8898
9148
|
) : /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
|
|
8899
9149
|
"input",
|
|
8900
9150
|
{
|
|
8901
9151
|
...props,
|
|
8902
9152
|
ref,
|
|
8903
|
-
onFocus:
|
|
9153
|
+
onFocus: handleFocus2,
|
|
8904
9154
|
type
|
|
8905
9155
|
}
|
|
8906
9156
|
),
|
|
@@ -8961,11 +9211,11 @@ var EditableHeading = ({
|
|
|
8961
9211
|
forceEditing = false,
|
|
8962
9212
|
editingDisabled = false
|
|
8963
9213
|
}) => {
|
|
8964
|
-
const [isEditing, setIsEditing] = (0,
|
|
8965
|
-
const [value, setValue] = (0,
|
|
8966
|
-
const [previousValue, setPreviousValue] = (0,
|
|
8967
|
-
const [headingHeight, setHeadingHeight] = (0,
|
|
8968
|
-
const headingRef = (0,
|
|
9214
|
+
const [isEditing, setIsEditing] = (0, import_react28.useState)(false);
|
|
9215
|
+
const [value, setValue] = (0, import_react28.useState)(children);
|
|
9216
|
+
const [previousValue, setPreviousValue] = (0, import_react28.useState)(children);
|
|
9217
|
+
const [headingHeight, setHeadingHeight] = (0, import_react28.useState)("60");
|
|
9218
|
+
const headingRef = (0, import_react28.useRef)(null);
|
|
8969
9219
|
const handleSetEditing = (editing) => {
|
|
8970
9220
|
if (editingDisabled) return;
|
|
8971
9221
|
if (editing && headingRef.current) {
|
|
@@ -9051,12 +9301,12 @@ var EditableHeading = ({
|
|
|
9051
9301
|
};
|
|
9052
9302
|
|
|
9053
9303
|
// src/components/Form/Form.tsx
|
|
9054
|
-
var
|
|
9304
|
+
var import_react30 = require("react");
|
|
9055
9305
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
9056
|
-
var
|
|
9306
|
+
var import_type_guards28 = require("@wistia/type-guards");
|
|
9057
9307
|
|
|
9058
9308
|
// src/components/Stack/Stack.tsx
|
|
9059
|
-
var
|
|
9309
|
+
var import_react29 = require("react");
|
|
9060
9310
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
9061
9311
|
var import_jsx_runtime220 = require("react/jsx-runtime");
|
|
9062
9312
|
var DEFAULT_ELEMENT4 = "div";
|
|
@@ -9066,7 +9316,7 @@ var StyledStack = import_styled_components46.default.div`
|
|
|
9066
9316
|
gap: ${({ $gap }) => `var(--wui-${$gap})`};
|
|
9067
9317
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
9068
9318
|
`;
|
|
9069
|
-
var StackComponent = (0,
|
|
9319
|
+
var StackComponent = (0, import_react29.forwardRef)(
|
|
9070
9320
|
({ renderAs, direction = "vertical", gap = "space-02", alignItems = "stretch", ...props }, ref) => {
|
|
9071
9321
|
const responsiveGap = useResponsiveProp(gap);
|
|
9072
9322
|
const responsiveDirection = useResponsiveProp(direction);
|
|
@@ -9095,7 +9345,7 @@ var StyledForm = import_styled_components47.default.form`
|
|
|
9095
9345
|
max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
|
|
9096
9346
|
align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
|
|
9097
9347
|
`;
|
|
9098
|
-
var FormContext = (0,
|
|
9348
|
+
var FormContext = (0, import_react30.createContext)({
|
|
9099
9349
|
values: {},
|
|
9100
9350
|
errors: {},
|
|
9101
9351
|
hasSubmitted: false,
|
|
@@ -9111,25 +9361,25 @@ var FormComponent = ({
|
|
|
9111
9361
|
fullWidth = false,
|
|
9112
9362
|
...props
|
|
9113
9363
|
}, forwardedRef) => {
|
|
9114
|
-
const [errors, setErrors] = (0,
|
|
9115
|
-
const [hasSubmitted, setHasSubmitted] = (0,
|
|
9116
|
-
const innerRef = (0,
|
|
9364
|
+
const [errors, setErrors] = (0, import_react30.useState)({});
|
|
9365
|
+
const [hasSubmitted, setHasSubmitted] = (0, import_react30.useState)(false);
|
|
9366
|
+
const innerRef = (0, import_react30.useRef)();
|
|
9117
9367
|
const ref = forwardedRef ?? innerRef;
|
|
9118
|
-
const autoId = (0,
|
|
9368
|
+
const autoId = (0, import_react30.useId)();
|
|
9119
9369
|
const id = props.id ?? autoId;
|
|
9120
9370
|
const handleValidate = (nextFormData) => {
|
|
9121
9371
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
9122
|
-
if ((0,
|
|
9372
|
+
if ((0, import_type_guards28.isUndefined)(validate)) {
|
|
9123
9373
|
return {};
|
|
9124
9374
|
}
|
|
9125
9375
|
return validate(nextData);
|
|
9126
9376
|
};
|
|
9127
|
-
const
|
|
9377
|
+
const handleBlur2 = (event) => {
|
|
9128
9378
|
if (props.onBlur) {
|
|
9129
9379
|
props.onBlur(event);
|
|
9130
9380
|
}
|
|
9131
9381
|
const formData = new FormData(event.currentTarget);
|
|
9132
|
-
if ((0,
|
|
9382
|
+
if ((0, import_type_guards28.isNotUndefined)(validate)) {
|
|
9133
9383
|
handleValidate(formData);
|
|
9134
9384
|
}
|
|
9135
9385
|
};
|
|
@@ -9157,7 +9407,7 @@ var FormComponent = ({
|
|
|
9157
9407
|
void action(null);
|
|
9158
9408
|
}
|
|
9159
9409
|
};
|
|
9160
|
-
const context = (0,
|
|
9410
|
+
const context = (0, import_react30.useMemo)(() => {
|
|
9161
9411
|
return {
|
|
9162
9412
|
values,
|
|
9163
9413
|
errors,
|
|
@@ -9177,7 +9427,7 @@ var FormComponent = ({
|
|
|
9177
9427
|
as: StyledForm,
|
|
9178
9428
|
gap: "space-05",
|
|
9179
9429
|
id,
|
|
9180
|
-
onBlur:
|
|
9430
|
+
onBlur: handleBlur2,
|
|
9181
9431
|
onReset: handleReset,
|
|
9182
9432
|
onSubmit: handleSubmit,
|
|
9183
9433
|
children
|
|
@@ -9186,15 +9436,15 @@ var FormComponent = ({
|
|
|
9186
9436
|
);
|
|
9187
9437
|
};
|
|
9188
9438
|
FormComponent.displayName = "Form";
|
|
9189
|
-
var Form = (0,
|
|
9439
|
+
var Form = (0, import_react30.forwardRef)(FormComponent);
|
|
9190
9440
|
|
|
9191
9441
|
// src/components/Form/useFormState.tsx
|
|
9192
|
-
var
|
|
9442
|
+
var import_react31 = require("react");
|
|
9193
9443
|
var useFormState = (action, initialData = {}) => {
|
|
9194
|
-
const [data, setData] = (0,
|
|
9195
|
-
const [isPending, setIsPending] = (0,
|
|
9196
|
-
const [error, setError] = (0,
|
|
9197
|
-
const formAction = (0,
|
|
9444
|
+
const [data, setData] = (0, import_react31.useState)(initialData);
|
|
9445
|
+
const [isPending, setIsPending] = (0, import_react31.useState)(false);
|
|
9446
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
9447
|
+
const formAction = (0, import_react31.useCallback)(
|
|
9198
9448
|
async (nextFormData) => {
|
|
9199
9449
|
if (nextFormData === null) {
|
|
9200
9450
|
setData(initialData);
|
|
@@ -9225,23 +9475,23 @@ var useFormState = (action, initialData = {}) => {
|
|
|
9225
9475
|
};
|
|
9226
9476
|
|
|
9227
9477
|
// src/components/Form/FormErrorSummary.tsx
|
|
9228
|
-
var
|
|
9229
|
-
var
|
|
9478
|
+
var import_react32 = require("react");
|
|
9479
|
+
var import_type_guards29 = require("@wistia/type-guards");
|
|
9230
9480
|
var import_jsx_runtime222 = require("react/jsx-runtime");
|
|
9231
9481
|
var ErrorItem = ({ name, error, formId }) => {
|
|
9232
9482
|
return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(Link, { href: `#${formId}-${name}`, children: error }) }, name);
|
|
9233
9483
|
};
|
|
9234
9484
|
var FormErrorSummary = ({ description }) => {
|
|
9235
|
-
const ref = (0,
|
|
9236
|
-
const { formId, errors, hasSubmitted } = (0,
|
|
9485
|
+
const ref = (0, import_react32.useRef)(null);
|
|
9486
|
+
const { formId, errors, hasSubmitted } = (0, import_react32.useContext)(FormContext);
|
|
9237
9487
|
const isValid = Object.keys(errors).length === 0;
|
|
9238
9488
|
if (isValid || !hasSubmitted) {
|
|
9239
9489
|
return null;
|
|
9240
9490
|
}
|
|
9241
9491
|
return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { ref, children: [
|
|
9242
9492
|
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { children: description }),
|
|
9243
|
-
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0,
|
|
9244
|
-
([name, error]) => (0,
|
|
9493
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0, import_type_guards29.isNotUndefined)(error)).map(
|
|
9494
|
+
([name, error]) => (0, import_type_guards29.isArray)(error) ? error.map((err) => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
9245
9495
|
ErrorItem,
|
|
9246
9496
|
{
|
|
9247
9497
|
error: err,
|
|
@@ -9263,9 +9513,9 @@ var FormErrorSummary = ({ description }) => {
|
|
|
9263
9513
|
};
|
|
9264
9514
|
|
|
9265
9515
|
// src/components/FormField/FormField.tsx
|
|
9266
|
-
var
|
|
9516
|
+
var import_react35 = require("react");
|
|
9267
9517
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
9268
|
-
var
|
|
9518
|
+
var import_type_guards30 = require("@wistia/type-guards");
|
|
9269
9519
|
|
|
9270
9520
|
// src/components/Label/Label.tsx
|
|
9271
9521
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
@@ -9328,11 +9578,11 @@ var Label = ({
|
|
|
9328
9578
|
Label.displayName = "Label";
|
|
9329
9579
|
|
|
9330
9580
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9331
|
-
var
|
|
9581
|
+
var import_react34 = require("react");
|
|
9332
9582
|
|
|
9333
9583
|
// src/components/FormGroup/FormGroup.tsx
|
|
9334
9584
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
9335
|
-
var
|
|
9585
|
+
var import_react33 = require("react");
|
|
9336
9586
|
var import_jsx_runtime224 = require("react/jsx-runtime");
|
|
9337
9587
|
var StyledFieldset = import_styled_components49.default.fieldset`
|
|
9338
9588
|
border: 0;
|
|
@@ -9341,7 +9591,7 @@ var StyledLegend = import_styled_components49.default.legend`
|
|
|
9341
9591
|
margin-bottom: var(--space-01);
|
|
9342
9592
|
`;
|
|
9343
9593
|
var FormGroup = ({ children, label, ...props }) => {
|
|
9344
|
-
const ref = (0,
|
|
9594
|
+
const ref = (0, import_react33.useRef)();
|
|
9345
9595
|
return /* @__PURE__ */ (0, import_jsx_runtime224.jsxs)(
|
|
9346
9596
|
Stack,
|
|
9347
9597
|
{
|
|
@@ -9366,7 +9616,7 @@ FormGroup.displayName = "FormGroup";
|
|
|
9366
9616
|
|
|
9367
9617
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9368
9618
|
var import_jsx_runtime225 = require("react/jsx-runtime");
|
|
9369
|
-
var CheckboxGroupContext = (0,
|
|
9619
|
+
var CheckboxGroupContext = (0, import_react34.createContext)(null);
|
|
9370
9620
|
var CheckboxGroup = ({
|
|
9371
9621
|
children,
|
|
9372
9622
|
name,
|
|
@@ -9374,7 +9624,7 @@ var CheckboxGroup = ({
|
|
|
9374
9624
|
value,
|
|
9375
9625
|
...props
|
|
9376
9626
|
}) => {
|
|
9377
|
-
const context = (0,
|
|
9627
|
+
const context = (0, import_react34.useMemo)(() => {
|
|
9378
9628
|
return {
|
|
9379
9629
|
name,
|
|
9380
9630
|
onChange
|
|
@@ -9425,7 +9675,7 @@ var StyledErrorList = import_styled_components50.default.ul`
|
|
|
9425
9675
|
gap: var(--wui-space-01);
|
|
9426
9676
|
`;
|
|
9427
9677
|
var ErrorMessages = ({ errors, id }) => {
|
|
9428
|
-
const isMultipleErrors = (0,
|
|
9678
|
+
const isMultipleErrors = (0, import_type_guards30.isArray)(errors);
|
|
9429
9679
|
return isMultipleErrors ? /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(StyledErrorList, { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
|
|
9430
9680
|
Text,
|
|
9431
9681
|
{
|
|
@@ -9459,8 +9709,8 @@ var FormField = ({
|
|
|
9459
9709
|
value,
|
|
9460
9710
|
...props
|
|
9461
9711
|
}) => {
|
|
9462
|
-
const formState = (0,
|
|
9463
|
-
const checkboxGroup = (0,
|
|
9712
|
+
const formState = (0, import_react35.useContext)(FormContext);
|
|
9713
|
+
const checkboxGroup = (0, import_react35.useContext)(CheckboxGroupContext);
|
|
9464
9714
|
const defaultValue = formState.values[name];
|
|
9465
9715
|
const isIntegratedLabel = children.type === Checkbox;
|
|
9466
9716
|
const computedId = id ?? `${formState.formId}-${name}`;
|
|
@@ -9475,19 +9725,19 @@ var FormField = ({
|
|
|
9475
9725
|
"aria-describedby": ariaDescribedby,
|
|
9476
9726
|
...props
|
|
9477
9727
|
};
|
|
9478
|
-
if ((0,
|
|
9728
|
+
if ((0, import_type_guards30.isUndefined)(value) && (0, import_type_guards30.isNotUndefined)(defaultValue)) {
|
|
9479
9729
|
childProps = {
|
|
9480
9730
|
...childProps,
|
|
9481
9731
|
defaultValue
|
|
9482
9732
|
};
|
|
9483
9733
|
}
|
|
9484
|
-
if ((0,
|
|
9485
|
-
const computedName = (0,
|
|
9734
|
+
if ((0, import_type_guards30.isNotNil)(checkboxGroup)) {
|
|
9735
|
+
const computedName = (0, import_type_guards30.isNotNil)(checkboxGroup.name) ? `${checkboxGroup.name}[${name}]` : name;
|
|
9486
9736
|
const handleChange = (event) => {
|
|
9487
|
-
if ((0,
|
|
9737
|
+
if ((0, import_type_guards30.isNotUndefined)(props.onChange)) {
|
|
9488
9738
|
props.onChange(event);
|
|
9489
9739
|
}
|
|
9490
|
-
if ((0,
|
|
9740
|
+
if ((0, import_type_guards30.isNotUndefined)(checkboxGroup.onChange)) {
|
|
9491
9741
|
checkboxGroup.onChange(event);
|
|
9492
9742
|
}
|
|
9493
9743
|
};
|
|
@@ -9495,10 +9745,10 @@ var FormField = ({
|
|
|
9495
9745
|
...childProps,
|
|
9496
9746
|
name: computedName,
|
|
9497
9747
|
onChange: handleChange,
|
|
9498
|
-
"aria-invalid": (0,
|
|
9748
|
+
"aria-invalid": (0, import_type_guards30.isNotNil)(error)
|
|
9499
9749
|
};
|
|
9500
9750
|
}
|
|
9501
|
-
|
|
9751
|
+
import_react35.Children.only(children);
|
|
9502
9752
|
return /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(
|
|
9503
9753
|
StyledFormField,
|
|
9504
9754
|
{
|
|
@@ -9506,9 +9756,9 @@ var FormField = ({
|
|
|
9506
9756
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
9507
9757
|
children: [
|
|
9508
9758
|
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(Label, { htmlFor: computedId, children: label }),
|
|
9509
|
-
(0,
|
|
9510
|
-
(0,
|
|
9511
|
-
(0,
|
|
9759
|
+
(0, import_type_guards30.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
9760
|
+
(0, import_react35.cloneElement)(children, childProps),
|
|
9761
|
+
(0, import_type_guards30.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(import_jsx_runtime226.Fragment, { children: [
|
|
9512
9762
|
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)("div", {}),
|
|
9513
9763
|
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
|
|
9514
9764
|
ErrorMessages,
|
|
@@ -9525,9 +9775,9 @@ var FormField = ({
|
|
|
9525
9775
|
FormField.displayName = "FormField";
|
|
9526
9776
|
|
|
9527
9777
|
// src/components/FormGroup/RadioGroup.tsx
|
|
9528
|
-
var
|
|
9778
|
+
var import_react36 = require("react");
|
|
9529
9779
|
var import_jsx_runtime227 = require("react/jsx-runtime");
|
|
9530
|
-
var RadioGroupContext = (0,
|
|
9780
|
+
var RadioGroupContext = (0, import_react36.createContext)(null);
|
|
9531
9781
|
var RadioGroup = ({
|
|
9532
9782
|
children,
|
|
9533
9783
|
name,
|
|
@@ -9535,7 +9785,7 @@ var RadioGroup = ({
|
|
|
9535
9785
|
value,
|
|
9536
9786
|
...props
|
|
9537
9787
|
}) => {
|
|
9538
|
-
const context = (0,
|
|
9788
|
+
const context = (0, import_react36.useMemo)(() => {
|
|
9539
9789
|
return {
|
|
9540
9790
|
name,
|
|
9541
9791
|
onChange
|
|
@@ -9546,7 +9796,7 @@ var RadioGroup = ({
|
|
|
9546
9796
|
RadioGroup.displayName = "RadioGroup";
|
|
9547
9797
|
|
|
9548
9798
|
// src/components/IconButton/IconButton.tsx
|
|
9549
|
-
var
|
|
9799
|
+
var import_react37 = require("react");
|
|
9550
9800
|
var import_styled_components51 = __toESM(require("styled-components"));
|
|
9551
9801
|
var import_jsx_runtime228 = require("react/jsx-runtime");
|
|
9552
9802
|
var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
@@ -9563,7 +9813,7 @@ var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
|
9563
9813
|
align-items: center;
|
|
9564
9814
|
line-height: 1;
|
|
9565
9815
|
`;
|
|
9566
|
-
var IconButton = (0,
|
|
9816
|
+
var IconButton = (0, import_react37.forwardRef)(
|
|
9567
9817
|
({ children, label, size = "md", ...props }, ref) => {
|
|
9568
9818
|
const responsiveSize = useResponsiveProp(size);
|
|
9569
9819
|
return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
@@ -9574,7 +9824,7 @@ var IconButton = (0, import_react35.forwardRef)(
|
|
|
9574
9824
|
"aria-label": label,
|
|
9575
9825
|
"data-wistia-ui-icon-button": true,
|
|
9576
9826
|
size: responsiveSize,
|
|
9577
|
-
children: (0,
|
|
9827
|
+
children: (0, import_react37.cloneElement)(import_react37.Children.only(children), {
|
|
9578
9828
|
size: responsiveSize
|
|
9579
9829
|
})
|
|
9580
9830
|
}
|
|
@@ -9585,7 +9835,7 @@ IconButton.displayName = "IconButton";
|
|
|
9585
9835
|
|
|
9586
9836
|
// src/components/Image/Image.tsx
|
|
9587
9837
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
9588
|
-
var
|
|
9838
|
+
var import_type_guards31 = require("@wistia/type-guards");
|
|
9589
9839
|
var import_jsx_runtime229 = require("react/jsx-runtime");
|
|
9590
9840
|
var getFillStyle2 = (fillContainer) => {
|
|
9591
9841
|
if (fillContainer === "horizontal") {
|
|
@@ -9603,7 +9853,7 @@ var getFillStyle2 = (fillContainer) => {
|
|
|
9603
9853
|
return void 0;
|
|
9604
9854
|
};
|
|
9605
9855
|
var StyledImage = import_styled_components52.default.img`
|
|
9606
|
-
border-radius: ${({ $borderRadius }) => (0,
|
|
9856
|
+
border-radius: ${({ $borderRadius }) => (0, import_type_guards31.isNotNil)($borderRadius) ? `var(--wui-${$borderRadius})` : void 0};
|
|
9607
9857
|
${({ $fillContainer }) => getFillStyle2($fillContainer)};
|
|
9608
9858
|
object-fit: ${({ $objFit }) => $objFit};
|
|
9609
9859
|
object-position: ${({ $objPosition }) => $objPosition};
|
|
@@ -9635,13 +9885,13 @@ Image.displayName = "Image";
|
|
|
9635
9885
|
// src/components/Menu/Menu.tsx
|
|
9636
9886
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
9637
9887
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
9638
|
-
var
|
|
9639
|
-
var
|
|
9888
|
+
var import_type_guards32 = require("@wistia/type-guards");
|
|
9889
|
+
var import_react39 = require("react");
|
|
9640
9890
|
|
|
9641
9891
|
// src/components/Menu/MenuContext.tsx
|
|
9642
|
-
var
|
|
9643
|
-
var MenuContext = (0,
|
|
9644
|
-
var useMenuContext = () => (0,
|
|
9892
|
+
var import_react38 = require("react");
|
|
9893
|
+
var MenuContext = (0, import_react38.createContext)({ compact: false });
|
|
9894
|
+
var useMenuContext = () => (0, import_react38.useContext)(MenuContext);
|
|
9645
9895
|
|
|
9646
9896
|
// src/components/Menu/Menu.tsx
|
|
9647
9897
|
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
@@ -9745,9 +9995,9 @@ var Menu = ({
|
|
|
9745
9995
|
onInteractOutside,
|
|
9746
9996
|
...props
|
|
9747
9997
|
}) => {
|
|
9748
|
-
const contextValue = (0,
|
|
9998
|
+
const contextValue = (0, import_react39.useMemo)(() => ({ compact }), [compact]);
|
|
9749
9999
|
let controlProps = {
|
|
9750
|
-
...(0,
|
|
10000
|
+
...(0, import_type_guards32.isNotNil)(onOpenChange) && (0, import_type_guards32.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
9751
10001
|
};
|
|
9752
10002
|
if (disabled) {
|
|
9753
10003
|
controlProps = {
|
|
@@ -9761,7 +10011,7 @@ var Menu = ({
|
|
|
9761
10011
|
modal: false,
|
|
9762
10012
|
...controlProps,
|
|
9763
10013
|
children: [
|
|
9764
|
-
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0,
|
|
10014
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0, import_type_guards32.isNotUndefined)(trigger) ? trigger : /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
9765
10015
|
Button,
|
|
9766
10016
|
{
|
|
9767
10017
|
"aria-expanded": isOpen,
|
|
@@ -9819,15 +10069,15 @@ var MenuLabel = ({ children, ...props }) => {
|
|
|
9819
10069
|
MenuLabel.displayName = "MenuLabel";
|
|
9820
10070
|
|
|
9821
10071
|
// src/components/Menu/SubMenu.tsx
|
|
9822
|
-
var
|
|
10072
|
+
var import_react41 = require("react");
|
|
9823
10073
|
var import_styled_components57 = __toESM(require("styled-components"));
|
|
9824
10074
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
9825
|
-
var
|
|
10075
|
+
var import_type_guards34 = require("@wistia/type-guards");
|
|
9826
10076
|
|
|
9827
10077
|
// src/components/Menu/MenuItemButton.tsx
|
|
9828
|
-
var
|
|
10078
|
+
var import_react40 = require("react");
|
|
9829
10079
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
9830
|
-
var
|
|
10080
|
+
var import_type_guards33 = require("@wistia/type-guards");
|
|
9831
10081
|
var import_jsx_runtime232 = require("react/jsx-runtime");
|
|
9832
10082
|
var StyledButton3 = (0, import_styled_components55.default)(Button)`
|
|
9833
10083
|
${({ colorScheme }) => getColorScheme(colorScheme)};
|
|
@@ -9902,10 +10152,10 @@ var StyledBadgeContainer = import_styled_components55.default.div`
|
|
|
9902
10152
|
font-size: var(--wui-typography-label-4-size);
|
|
9903
10153
|
color: var(--wui-color-text-secondary);
|
|
9904
10154
|
`;
|
|
9905
|
-
var MenuItemButton = (0,
|
|
10155
|
+
var MenuItemButton = (0, import_react40.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
9906
10156
|
let { colorScheme, badge } = props;
|
|
9907
10157
|
if (appearance === "dangerous") {
|
|
9908
|
-
if ((0,
|
|
10158
|
+
if ((0, import_type_guards33.isNotUndefined)(colorScheme)) {
|
|
9909
10159
|
console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
9910
10160
|
}
|
|
9911
10161
|
colorScheme = "error";
|
|
@@ -9935,7 +10185,7 @@ var MenuItemButton = (0, import_react38.forwardRef)(({ children, appearance, com
|
|
|
9935
10185
|
children: [
|
|
9936
10186
|
props.leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
9937
10187
|
/* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledLabelAndDescriptionContainer, { children }),
|
|
9938
|
-
(0,
|
|
10188
|
+
(0, import_type_guards33.isNotNil)(badge) || (0, import_type_guards33.isNotNil)(command) ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledBadgeContainer, { children: badge ?? command }) : null,
|
|
9939
10189
|
props.rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
9940
10190
|
]
|
|
9941
10191
|
}
|
|
@@ -9998,12 +10248,12 @@ var SubMenu = ({
|
|
|
9998
10248
|
...props
|
|
9999
10249
|
}) => {
|
|
10000
10250
|
const { isSmAndUp } = useMq();
|
|
10001
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
10251
|
+
const [isExpanded, setIsExpanded] = (0, import_react41.useState)(false);
|
|
10002
10252
|
const { compact } = useMenuContext();
|
|
10003
10253
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
10004
10254
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
10005
10255
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(MenuItemLabel, { children: label }),
|
|
10006
|
-
(0,
|
|
10256
|
+
(0, import_type_guards34.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(MenuItemDescription, { children: description }) : null
|
|
10007
10257
|
] }),
|
|
10008
10258
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(import_react_dropdown_menu3.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(SubMenuContent, { $compact: compact, children }) })
|
|
10009
10259
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(import_react_dropdown_menu3.DropdownMenuGroup, { children: [
|
|
@@ -10027,10 +10277,10 @@ var SubMenu = ({
|
|
|
10027
10277
|
SubMenu.displayName = "SubMenu";
|
|
10028
10278
|
|
|
10029
10279
|
// src/components/Menu/MenuItem.tsx
|
|
10030
|
-
var
|
|
10280
|
+
var import_react42 = require("react");
|
|
10031
10281
|
var import_react_dropdown_menu4 = require("@radix-ui/react-dropdown-menu");
|
|
10032
10282
|
var import_jsx_runtime235 = require("react/jsx-runtime");
|
|
10033
|
-
var MenuItem = (0,
|
|
10283
|
+
var MenuItem = (0, import_react42.forwardRef)(
|
|
10034
10284
|
({ onSelect = () => null, ...props }, ref) => {
|
|
10035
10285
|
return /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
10036
10286
|
import_react_dropdown_menu4.DropdownMenuItem,
|
|
@@ -10180,10 +10430,10 @@ var CheckboxMenuItem = ({
|
|
|
10180
10430
|
CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
10181
10431
|
|
|
10182
10432
|
// src/components/Modal/Modal.tsx
|
|
10183
|
-
var
|
|
10433
|
+
var import_react46 = require("react");
|
|
10184
10434
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
10185
10435
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
10186
|
-
var
|
|
10436
|
+
var import_type_guards36 = require("@wistia/type-guards");
|
|
10187
10437
|
|
|
10188
10438
|
// src/components/Modal/ModalHeader.tsx
|
|
10189
10439
|
var import_styled_components59 = __toESM(require("styled-components"));
|
|
@@ -10240,21 +10490,21 @@ var ModalHeader = ({
|
|
|
10240
10490
|
};
|
|
10241
10491
|
|
|
10242
10492
|
// src/components/Modal/ModalContent.tsx
|
|
10243
|
-
var
|
|
10493
|
+
var import_react44 = require("react");
|
|
10244
10494
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
10245
10495
|
var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
10246
10496
|
|
|
10247
10497
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
10248
|
-
var
|
|
10249
|
-
var
|
|
10498
|
+
var import_react43 = require("react");
|
|
10499
|
+
var import_type_guards35 = require("@wistia/type-guards");
|
|
10250
10500
|
var useFocusRestore = () => {
|
|
10251
|
-
const previouslyFocusedRef = (0,
|
|
10252
|
-
(0,
|
|
10501
|
+
const previouslyFocusedRef = (0, import_react43.useRef)(null);
|
|
10502
|
+
(0, import_react43.useEffect)(() => {
|
|
10253
10503
|
previouslyFocusedRef.current = document.activeElement;
|
|
10254
10504
|
}, []);
|
|
10255
|
-
(0,
|
|
10505
|
+
(0, import_react43.useEffect)(() => {
|
|
10256
10506
|
return () => {
|
|
10257
|
-
if ((0,
|
|
10507
|
+
if ((0, import_type_guards35.isNotNil)(previouslyFocusedRef.current)) {
|
|
10258
10508
|
setTimeout(() => {
|
|
10259
10509
|
previouslyFocusedRef.current?.focus();
|
|
10260
10510
|
}, 0);
|
|
@@ -10306,7 +10556,7 @@ var StyledModalContent = (0, import_styled_components60.default)(import_react_di
|
|
|
10306
10556
|
}
|
|
10307
10557
|
}
|
|
10308
10558
|
`;
|
|
10309
|
-
var ModalContent = (0,
|
|
10559
|
+
var ModalContent = (0, import_react44.forwardRef)(
|
|
10310
10560
|
({ fullHeight, width, children, ...otherProps }, ref) => {
|
|
10311
10561
|
useFocusRestore();
|
|
10312
10562
|
return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
|
|
@@ -10324,7 +10574,7 @@ var ModalContent = (0, import_react42.forwardRef)(
|
|
|
10324
10574
|
);
|
|
10325
10575
|
|
|
10326
10576
|
// src/private/components/Backdrop/Backdrop.tsx
|
|
10327
|
-
var
|
|
10577
|
+
var import_react45 = require("react");
|
|
10328
10578
|
var import_styled_components61 = __toESM(require("styled-components"));
|
|
10329
10579
|
var import_jsx_runtime242 = require("react/jsx-runtime");
|
|
10330
10580
|
var backdropAnimationDuration = 150;
|
|
@@ -10362,7 +10612,7 @@ var BackdropComponent = import_styled_components61.default.div`
|
|
|
10362
10612
|
}
|
|
10363
10613
|
}
|
|
10364
10614
|
`;
|
|
10365
|
-
var Backdrop = (0,
|
|
10615
|
+
var Backdrop = (0, import_react45.forwardRef)(
|
|
10366
10616
|
({ alignHorizontal = "center", alignVertical = "center", children, ...otherProps }, ref) => /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
|
|
10367
10617
|
BackdropComponent,
|
|
10368
10618
|
{
|
|
@@ -10384,7 +10634,7 @@ var ModalBody = import_styled_components62.default.div`
|
|
|
10384
10634
|
display: flex;
|
|
10385
10635
|
order: 2;
|
|
10386
10636
|
`;
|
|
10387
|
-
var Modal = (0,
|
|
10637
|
+
var Modal = (0, import_react46.forwardRef)(
|
|
10388
10638
|
({
|
|
10389
10639
|
children,
|
|
10390
10640
|
fullHeight = false,
|
|
@@ -10401,7 +10651,7 @@ var Modal = (0, import_react44.forwardRef)(
|
|
|
10401
10651
|
import_react_dialog4.Root,
|
|
10402
10652
|
{
|
|
10403
10653
|
onOpenChange: (open2) => {
|
|
10404
|
-
if (!open2 && (0,
|
|
10654
|
+
if (!open2 && (0, import_type_guards36.isNotNil)(onRequestClose)) {
|
|
10405
10655
|
onRequestClose();
|
|
10406
10656
|
}
|
|
10407
10657
|
},
|
|
@@ -10414,7 +10664,7 @@ var Modal = (0, import_react44.forwardRef)(
|
|
|
10414
10664
|
ref,
|
|
10415
10665
|
fullHeight,
|
|
10416
10666
|
onOpenAutoFocus: (event) => {
|
|
10417
|
-
if ((0,
|
|
10667
|
+
if ((0, import_type_guards36.isNotNil)(initialFocusRef) && initialFocusRef.current) {
|
|
10418
10668
|
event.preventDefault();
|
|
10419
10669
|
requestAnimationFrame(() => {
|
|
10420
10670
|
initialFocusRef.current?.focus();
|
|
@@ -10448,9 +10698,9 @@ var import_react_popover = require("@radix-ui/react-popover");
|
|
|
10448
10698
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
10449
10699
|
|
|
10450
10700
|
// src/private/helpers/getControls/getControlProps.tsx
|
|
10451
|
-
var
|
|
10701
|
+
var import_type_guards37 = require("@wistia/type-guards");
|
|
10452
10702
|
var getControlProps = (isOpen, onOpenChange) => {
|
|
10453
|
-
return (0,
|
|
10703
|
+
return (0, import_type_guards37.isNotNil)(onOpenChange) && (0, import_type_guards37.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {};
|
|
10454
10704
|
};
|
|
10455
10705
|
|
|
10456
10706
|
// src/components/Popover/Popover.tsx
|
|
@@ -10509,7 +10759,7 @@ Popover.displayName = "Popover";
|
|
|
10509
10759
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
10510
10760
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
10511
10761
|
var import_react_progress = require("@radix-ui/react-progress");
|
|
10512
|
-
var
|
|
10762
|
+
var import_type_guards38 = require("@wistia/type-guards");
|
|
10513
10763
|
var import_jsx_runtime245 = require("react/jsx-runtime");
|
|
10514
10764
|
var ProgressBarWrapper = import_styled_components64.default.div`
|
|
10515
10765
|
--progress-bar-height: 8px;
|
|
@@ -10564,7 +10814,7 @@ var ProgressBar = ({
|
|
|
10564
10814
|
...props
|
|
10565
10815
|
}) => {
|
|
10566
10816
|
return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(ProgressBarWrapper, { children: [
|
|
10567
|
-
(0,
|
|
10817
|
+
(0, import_type_guards38.isNotNil)(labelLeft) ? /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ProgressBarLabel, { children: labelLeft }) : null,
|
|
10568
10818
|
/* @__PURE__ */ (0, import_jsx_runtime245.jsx)(
|
|
10569
10819
|
StyledProgressBar,
|
|
10570
10820
|
{
|
|
@@ -10580,15 +10830,15 @@ var ProgressBar = ({
|
|
|
10580
10830
|
)
|
|
10581
10831
|
}
|
|
10582
10832
|
),
|
|
10583
|
-
(0,
|
|
10833
|
+
(0, import_type_guards38.isNotNil)(labelRight) ? /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ProgressBarLabel, { children: labelRight }) : null
|
|
10584
10834
|
] });
|
|
10585
10835
|
};
|
|
10586
10836
|
ProgressBar.displayName = "ProgressBar";
|
|
10587
10837
|
|
|
10588
10838
|
// src/components/Radio/Radio.tsx
|
|
10589
|
-
var
|
|
10839
|
+
var import_react47 = require("react");
|
|
10590
10840
|
var import_styled_components65 = __toESM(require("styled-components"));
|
|
10591
|
-
var
|
|
10841
|
+
var import_type_guards39 = require("@wistia/type-guards");
|
|
10592
10842
|
var import_jsx_runtime246 = require("react/jsx-runtime");
|
|
10593
10843
|
var RadioIcon = () => /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
|
|
10594
10844
|
"svg",
|
|
@@ -10689,7 +10939,7 @@ var StyledHiddenRadioInput = import_styled_components65.default.input`
|
|
|
10689
10939
|
display: block;
|
|
10690
10940
|
}
|
|
10691
10941
|
`;
|
|
10692
|
-
var Radio = (0,
|
|
10942
|
+
var Radio = (0, import_react47.forwardRef)(
|
|
10693
10943
|
({
|
|
10694
10944
|
checked,
|
|
10695
10945
|
disabled = false,
|
|
@@ -10704,8 +10954,8 @@ var Radio = (0, import_react45.forwardRef)(
|
|
|
10704
10954
|
hideLabel = false,
|
|
10705
10955
|
...props
|
|
10706
10956
|
}, ref) => {
|
|
10707
|
-
const generatedId = (0,
|
|
10708
|
-
const computedId = (0,
|
|
10957
|
+
const generatedId = (0, import_react47.useId)();
|
|
10958
|
+
const computedId = (0, import_type_guards39.isNonEmptyString)(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
10709
10959
|
return /* @__PURE__ */ (0, import_jsx_runtime246.jsxs)(
|
|
10710
10960
|
StyledRadioWrapper,
|
|
10711
10961
|
{
|
|
@@ -10754,22 +11004,22 @@ var Radio = (0, import_react45.forwardRef)(
|
|
|
10754
11004
|
Radio.displayName = "Radio";
|
|
10755
11005
|
|
|
10756
11006
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
10757
|
-
var
|
|
11007
|
+
var import_react51 = require("react");
|
|
10758
11008
|
var import_styled_components67 = __toESM(require("styled-components"));
|
|
10759
11009
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
10760
|
-
var
|
|
11010
|
+
var import_type_guards40 = require("@wistia/type-guards");
|
|
10761
11011
|
|
|
10762
11012
|
// src/components/SegmentedControl/useSelectedItemMeasurements.tsx
|
|
10763
|
-
var
|
|
11013
|
+
var import_react48 = require("react");
|
|
10764
11014
|
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
10765
|
-
var SelectedItemMeasurementsContext = (0,
|
|
11015
|
+
var SelectedItemMeasurementsContext = (0, import_react48.createContext)(
|
|
10766
11016
|
null
|
|
10767
11017
|
);
|
|
10768
11018
|
var SelectedItemMeasurementsProvider = ({
|
|
10769
11019
|
children
|
|
10770
11020
|
}) => {
|
|
10771
|
-
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0,
|
|
10772
|
-
const contextValue = (0,
|
|
11021
|
+
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0, import_react48.useState)(null);
|
|
11022
|
+
const contextValue = (0, import_react48.useMemo)(
|
|
10773
11023
|
() => ({
|
|
10774
11024
|
setSelectedItemMeasurements,
|
|
10775
11025
|
selectedItemMeasurements
|
|
@@ -10779,7 +11029,7 @@ var SelectedItemMeasurementsProvider = ({
|
|
|
10779
11029
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(SelectedItemMeasurementsContext.Provider, { value: contextValue, children });
|
|
10780
11030
|
};
|
|
10781
11031
|
var useSelectedItemMeasurements = () => {
|
|
10782
|
-
const context = (0,
|
|
11032
|
+
const context = (0, import_react48.useContext)(SelectedItemMeasurementsContext);
|
|
10783
11033
|
if (context === null) {
|
|
10784
11034
|
throw new Error(
|
|
10785
11035
|
"useSelectedItemMeasurements must be used within a SelectedItemMeasurementsProvider"
|
|
@@ -10789,15 +11039,15 @@ var useSelectedItemMeasurements = () => {
|
|
|
10789
11039
|
};
|
|
10790
11040
|
|
|
10791
11041
|
// src/components/SegmentedControl/SelectedItemIndicator.tsx
|
|
10792
|
-
var
|
|
11042
|
+
var import_react50 = require("react");
|
|
10793
11043
|
var import_styled_components66 = __toESM(require("styled-components"));
|
|
10794
11044
|
|
|
10795
11045
|
// src/components/SegmentedControl/useSegmentedControlValue.tsx
|
|
10796
|
-
var
|
|
10797
|
-
var SegmentedControlValueContext = (0,
|
|
11046
|
+
var import_react49 = require("react");
|
|
11047
|
+
var SegmentedControlValueContext = (0, import_react49.createContext)(null);
|
|
10798
11048
|
var SegmentedControlValueProvider = SegmentedControlValueContext.Provider;
|
|
10799
11049
|
var useSegmentedControlValue = () => {
|
|
10800
|
-
const context = (0,
|
|
11050
|
+
const context = (0, import_react49.useContext)(SegmentedControlValueContext);
|
|
10801
11051
|
if (context === null) {
|
|
10802
11052
|
throw new Error("useSegmentedControlValue must be used within a SegmentedControlValueProvider");
|
|
10803
11053
|
}
|
|
@@ -10821,7 +11071,7 @@ var SelectedItemIndicatorDiv = import_styled_components66.default.div`
|
|
|
10821
11071
|
var SelectedItemIndicator = () => {
|
|
10822
11072
|
const selectedValue = useSegmentedControlValue();
|
|
10823
11073
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
10824
|
-
const selectedItemIndicatorStyle = (0,
|
|
11074
|
+
const selectedItemIndicatorStyle = (0, import_react50.useMemo)(
|
|
10825
11075
|
() => selectedItemMeasurements != null ? {
|
|
10826
11076
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
10827
11077
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -10859,7 +11109,7 @@ var segmentedControlStyles = import_styled_components67.css`
|
|
|
10859
11109
|
var StyledSegmentedControl = (0, import_styled_components67.default)(import_react_toggle_group.Root)`
|
|
10860
11110
|
${segmentedControlStyles}
|
|
10861
11111
|
`;
|
|
10862
|
-
var SegmentedControl = (0,
|
|
11112
|
+
var SegmentedControl = (0, import_react51.forwardRef)(
|
|
10863
11113
|
({
|
|
10864
11114
|
children,
|
|
10865
11115
|
disabled = false,
|
|
@@ -10868,7 +11118,7 @@ var SegmentedControl = (0, import_react49.forwardRef)(
|
|
|
10868
11118
|
onSelectedValueChange,
|
|
10869
11119
|
...props
|
|
10870
11120
|
}, ref) => {
|
|
10871
|
-
if ((0,
|
|
11121
|
+
if ((0, import_type_guards40.isNil)(children)) {
|
|
10872
11122
|
return null;
|
|
10873
11123
|
}
|
|
10874
11124
|
return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
|
|
@@ -10894,20 +11144,20 @@ var SegmentedControl = (0, import_react49.forwardRef)(
|
|
|
10894
11144
|
SegmentedControl.displayName = "SegmentedControl";
|
|
10895
11145
|
|
|
10896
11146
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
10897
|
-
var
|
|
11147
|
+
var import_react52 = require("react");
|
|
10898
11148
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
10899
11149
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
10900
|
-
var
|
|
11150
|
+
var import_type_guards42 = require("@wistia/type-guards");
|
|
10901
11151
|
|
|
10902
11152
|
// src/private/helpers/mergeRefs/mergeRefs.ts
|
|
10903
|
-
var
|
|
11153
|
+
var import_type_guards41 = require("@wistia/type-guards");
|
|
10904
11154
|
var mergeRefs = (refs) => (value) => {
|
|
10905
11155
|
refs.forEach((ref) => {
|
|
10906
|
-
if ((0,
|
|
11156
|
+
if ((0, import_type_guards41.isFunction)(ref)) {
|
|
10907
11157
|
ref(value);
|
|
10908
11158
|
return;
|
|
10909
11159
|
}
|
|
10910
|
-
if ((0,
|
|
11160
|
+
if ((0, import_type_guards41.isNotNil)(ref)) {
|
|
10911
11161
|
ref.current = value;
|
|
10912
11162
|
}
|
|
10913
11163
|
});
|
|
@@ -10977,11 +11227,11 @@ var segmentedControlItemStyles = import_styled_components68.css`
|
|
|
10977
11227
|
var StyledSegmentedControlItem = (0, import_styled_components68.default)(import_react_toggle_group2.Item)`
|
|
10978
11228
|
${segmentedControlItemStyles}
|
|
10979
11229
|
`;
|
|
10980
|
-
var SegmentedControlItem = (0,
|
|
11230
|
+
var SegmentedControlItem = (0, import_react52.forwardRef)(
|
|
10981
11231
|
({ disabled, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
10982
11232
|
const selectedValue = useSegmentedControlValue();
|
|
10983
11233
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
10984
|
-
const buttonRef = (0,
|
|
11234
|
+
const buttonRef = (0, import_react52.useRef)(null);
|
|
10985
11235
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
10986
11236
|
const handleClick = (event) => {
|
|
10987
11237
|
const target = event.target;
|
|
@@ -10990,7 +11240,7 @@ var SegmentedControlItem = (0, import_react50.forwardRef)(
|
|
|
10990
11240
|
event.preventDefault();
|
|
10991
11241
|
}
|
|
10992
11242
|
};
|
|
10993
|
-
(0,
|
|
11243
|
+
(0, import_react52.useEffect)(() => {
|
|
10994
11244
|
const buttonElem = buttonRef.current;
|
|
10995
11245
|
if (!buttonElem) {
|
|
10996
11246
|
return void 0;
|
|
@@ -11019,8 +11269,8 @@ var SegmentedControlItem = (0, import_react50.forwardRef)(
|
|
|
11019
11269
|
StyledSegmentedControlItem,
|
|
11020
11270
|
{
|
|
11021
11271
|
ref: combinedRef,
|
|
11022
|
-
$hasLabel: (0,
|
|
11023
|
-
"aria-label": (0,
|
|
11272
|
+
$hasLabel: (0, import_type_guards42.isNotNil)(label),
|
|
11273
|
+
"aria-label": (0, import_type_guards42.isNotNil)(label) ? void 0 : ariaLabel,
|
|
11024
11274
|
disabled,
|
|
11025
11275
|
onClick: handleClick,
|
|
11026
11276
|
value,
|
|
@@ -11036,7 +11286,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
11036
11286
|
|
|
11037
11287
|
// src/components/Select/Select.tsx
|
|
11038
11288
|
var import_react_select = require("@radix-ui/react-select");
|
|
11039
|
-
var
|
|
11289
|
+
var import_react53 = require("react");
|
|
11040
11290
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
11041
11291
|
var import_jsx_runtime251 = require("react/jsx-runtime");
|
|
11042
11292
|
var StyledTrigger = (0, import_styled_components69.default)(import_react_select.Trigger)`
|
|
@@ -11105,7 +11355,7 @@ var StyledContent3 = (0, import_styled_components69.default)(import_react_select
|
|
|
11105
11355
|
max-height: var(--radix-select-content-available-height);
|
|
11106
11356
|
z-index: var(--wui-zindex-select);
|
|
11107
11357
|
`;
|
|
11108
|
-
var Select = (0,
|
|
11358
|
+
var Select = (0, import_react53.forwardRef)(
|
|
11109
11359
|
({
|
|
11110
11360
|
colorScheme = "inherit",
|
|
11111
11361
|
children,
|
|
@@ -11154,7 +11404,7 @@ Select.displayName = "Select";
|
|
|
11154
11404
|
|
|
11155
11405
|
// src/components/Select/SelectOption.tsx
|
|
11156
11406
|
var import_react_select2 = require("@radix-ui/react-select");
|
|
11157
|
-
var
|
|
11407
|
+
var import_react54 = require("react");
|
|
11158
11408
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
11159
11409
|
var import_jsx_runtime252 = require("react/jsx-runtime");
|
|
11160
11410
|
var StyledItem = (0, import_styled_components70.default)(import_react_select2.Item)`
|
|
@@ -11183,7 +11433,7 @@ var StyledItem = (0, import_styled_components70.default)(import_react_select2.It
|
|
|
11183
11433
|
var StyledIconContainer = import_styled_components70.default.span`
|
|
11184
11434
|
width: 12px;
|
|
11185
11435
|
`;
|
|
11186
|
-
var SelectOption = (0,
|
|
11436
|
+
var SelectOption = (0, import_react54.forwardRef)(
|
|
11187
11437
|
({ children, ...props }, forwardedRef) => {
|
|
11188
11438
|
return /* @__PURE__ */ (0, import_jsx_runtime252.jsxs)(
|
|
11189
11439
|
StyledItem,
|
|
@@ -11228,9 +11478,9 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
11228
11478
|
};
|
|
11229
11479
|
|
|
11230
11480
|
// src/components/Switch/Switch.tsx
|
|
11231
|
-
var
|
|
11481
|
+
var import_react55 = require("react");
|
|
11232
11482
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
11233
|
-
var
|
|
11483
|
+
var import_type_guards43 = require("@wistia/type-guards");
|
|
11234
11484
|
var import_jsx_runtime254 = require("react/jsx-runtime");
|
|
11235
11485
|
var sizeSmall3 = import_styled_components72.css`
|
|
11236
11486
|
--wui-size-small-width: 24px;
|
|
@@ -11333,7 +11583,7 @@ var StyledHiddenSwitchInput = import_styled_components72.default.input`
|
|
|
11333
11583
|
}
|
|
11334
11584
|
}
|
|
11335
11585
|
`;
|
|
11336
|
-
var Switch = (0,
|
|
11586
|
+
var Switch = (0, import_react55.forwardRef)(
|
|
11337
11587
|
({
|
|
11338
11588
|
checked,
|
|
11339
11589
|
disabled = false,
|
|
@@ -11348,8 +11598,8 @@ var Switch = (0, import_react53.forwardRef)(
|
|
|
11348
11598
|
hideLabel = false,
|
|
11349
11599
|
...props
|
|
11350
11600
|
}, ref) => {
|
|
11351
|
-
const generatedId = (0,
|
|
11352
|
-
const computedId = (0,
|
|
11601
|
+
const generatedId = (0, import_react55.useId)();
|
|
11602
|
+
const computedId = (0, import_type_guards43.isNonEmptyString)(id) ? id : `wistia-ui-switch-${generatedId}`;
|
|
11353
11603
|
return /* @__PURE__ */ (0, import_jsx_runtime254.jsxs)(StyledSwitchWrapper, { $disabled: disabled, children: [
|
|
11354
11604
|
/* @__PURE__ */ (0, import_jsx_runtime254.jsx)(
|
|
11355
11605
|
StyledHiddenSwitchInput,
|
|
@@ -11430,8 +11680,8 @@ var Table = ({
|
|
|
11430
11680
|
var import_styled_components74 = __toESM(require("styled-components"));
|
|
11431
11681
|
|
|
11432
11682
|
// src/components/Table/TableSectionContext.ts
|
|
11433
|
-
var
|
|
11434
|
-
var TableSectionContext = (0,
|
|
11683
|
+
var import_react56 = require("react");
|
|
11684
|
+
var TableSectionContext = (0, import_react56.createContext)(null);
|
|
11435
11685
|
|
|
11436
11686
|
// src/components/Table/TableBody.tsx
|
|
11437
11687
|
var import_jsx_runtime256 = require("react/jsx-runtime");
|
|
@@ -11441,7 +11691,7 @@ var TableBody = ({ children, ...props }) => {
|
|
|
11441
11691
|
};
|
|
11442
11692
|
|
|
11443
11693
|
// src/components/Table/TableCell.tsx
|
|
11444
|
-
var
|
|
11694
|
+
var import_react57 = require("react");
|
|
11445
11695
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
11446
11696
|
var import_jsx_runtime257 = require("react/jsx-runtime");
|
|
11447
11697
|
var sharedStyles = import_styled_components75.css`
|
|
@@ -11462,7 +11712,7 @@ var StyledTd = import_styled_components75.default.td`
|
|
|
11462
11712
|
line-height: var(--wui-typography-body-2-line-height);
|
|
11463
11713
|
`;
|
|
11464
11714
|
var TableCell = ({ children, ...props }) => {
|
|
11465
|
-
const section = (0,
|
|
11715
|
+
const section = (0, import_react57.useContext)(TableSectionContext);
|
|
11466
11716
|
if (section === "head") {
|
|
11467
11717
|
return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(StyledTh, { ...props, children });
|
|
11468
11718
|
}
|
|
@@ -11494,9 +11744,9 @@ var TableRow = ({ children, ...props }) => {
|
|
|
11494
11744
|
};
|
|
11495
11745
|
|
|
11496
11746
|
// src/components/Tabs/Tabs.tsx
|
|
11497
|
-
var
|
|
11747
|
+
var import_react62 = require("react");
|
|
11498
11748
|
var import_react_tabs4 = require("@radix-ui/react-tabs");
|
|
11499
|
-
var
|
|
11749
|
+
var import_type_guards45 = require("@wistia/type-guards");
|
|
11500
11750
|
var import_styled_components83 = __toESM(require("styled-components"));
|
|
11501
11751
|
|
|
11502
11752
|
// src/components/Tabs/TabPanel.tsx
|
|
@@ -11549,17 +11799,17 @@ var TabList = ({
|
|
|
11549
11799
|
TabList.displayName = "TabList";
|
|
11550
11800
|
|
|
11551
11801
|
// src/components/Tabs/TabItem.tsx
|
|
11552
|
-
var
|
|
11802
|
+
var import_react59 = require("react");
|
|
11553
11803
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
11554
11804
|
var import_react_tabs3 = require("@radix-ui/react-tabs");
|
|
11555
|
-
var
|
|
11805
|
+
var import_type_guards44 = require("@wistia/type-guards");
|
|
11556
11806
|
|
|
11557
11807
|
// src/components/Tabs/useTabsValue.tsx
|
|
11558
|
-
var
|
|
11559
|
-
var TabsValueContext = (0,
|
|
11808
|
+
var import_react58 = require("react");
|
|
11809
|
+
var TabsValueContext = (0, import_react58.createContext)(null);
|
|
11560
11810
|
var TabsValueProvider = TabsValueContext.Provider;
|
|
11561
11811
|
var useTabsValue = () => {
|
|
11562
|
-
const context = (0,
|
|
11812
|
+
const context = (0, import_react58.useContext)(TabsValueContext);
|
|
11563
11813
|
if (context === null) {
|
|
11564
11814
|
throw new Error("useTabsValue must be used within a TabsValueProvider");
|
|
11565
11815
|
}
|
|
@@ -11575,13 +11825,13 @@ var StyledTabItem = (0, import_styled_components81.default)(import_react_tabs3.T
|
|
|
11575
11825
|
outline: none;
|
|
11576
11826
|
}
|
|
11577
11827
|
`;
|
|
11578
|
-
var TabItem = (0,
|
|
11828
|
+
var TabItem = (0, import_react59.forwardRef)(
|
|
11579
11829
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11580
11830
|
const selectedValue = useTabsValue();
|
|
11581
11831
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11582
|
-
const buttonRef = (0,
|
|
11832
|
+
const buttonRef = (0, import_react59.useRef)(null);
|
|
11583
11833
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11584
|
-
(0,
|
|
11834
|
+
(0, import_react59.useEffect)(() => {
|
|
11585
11835
|
const buttonElem = buttonRef.current;
|
|
11586
11836
|
if (!buttonElem) {
|
|
11587
11837
|
return void 0;
|
|
@@ -11610,8 +11860,8 @@ var TabItem = (0, import_react57.forwardRef)(
|
|
|
11610
11860
|
StyledTabItem,
|
|
11611
11861
|
{
|
|
11612
11862
|
ref: combinedRef,
|
|
11613
|
-
$hasLabel: (0,
|
|
11614
|
-
"aria-label": (0,
|
|
11863
|
+
$hasLabel: (0, import_type_guards44.isNotNil)(label),
|
|
11864
|
+
"aria-label": (0, import_type_guards44.isNotNil)(label) ? void 0 : ariaLabel,
|
|
11615
11865
|
disabled,
|
|
11616
11866
|
value,
|
|
11617
11867
|
children: [
|
|
@@ -11625,16 +11875,16 @@ var TabItem = (0, import_react57.forwardRef)(
|
|
|
11625
11875
|
TabItem.displayName = "TabItem";
|
|
11626
11876
|
|
|
11627
11877
|
// src/components/Tabs/extractTabItems.ts
|
|
11628
|
-
var
|
|
11878
|
+
var import_react60 = require("react");
|
|
11629
11879
|
var extractTabItems = (children) => {
|
|
11630
11880
|
const tabItems = [];
|
|
11631
|
-
|
|
11632
|
-
if (!(0,
|
|
11881
|
+
import_react60.Children.forEach(children, (child) => {
|
|
11882
|
+
if (!(0, import_react60.isValidElement)(child)) {
|
|
11633
11883
|
return;
|
|
11634
11884
|
}
|
|
11635
11885
|
if (typeof child.type !== "string" && child.type.displayName === "Tab") {
|
|
11636
11886
|
tabItems.push(child);
|
|
11637
|
-
} else if (child.type ===
|
|
11887
|
+
} else if (child.type === import_react60.Fragment) {
|
|
11638
11888
|
const fragmentElement = child;
|
|
11639
11889
|
tabItems.push(...extractTabItems(fragmentElement.props.children));
|
|
11640
11890
|
} else if ((child.props.children ?? null) != null) {
|
|
@@ -11647,7 +11897,7 @@ var extractTabItems = (children) => {
|
|
|
11647
11897
|
};
|
|
11648
11898
|
|
|
11649
11899
|
// src/components/Tabs/SelectedItemIndicator.tsx
|
|
11650
|
-
var
|
|
11900
|
+
var import_react61 = require("react");
|
|
11651
11901
|
var import_styled_components82 = __toESM(require("styled-components"));
|
|
11652
11902
|
var import_jsx_runtime264 = require("react/jsx-runtime");
|
|
11653
11903
|
var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(SelectedItemIndicatorDiv)`
|
|
@@ -11658,7 +11908,7 @@ var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(Selec
|
|
|
11658
11908
|
var SelectedItemIndicator2 = () => {
|
|
11659
11909
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11660
11910
|
const selectedValue = useTabsValue();
|
|
11661
|
-
const selectedItemIndicatorStyle = (0,
|
|
11911
|
+
const selectedItemIndicatorStyle = (0, import_react61.useMemo)(
|
|
11662
11912
|
() => selectedItemMeasurements != null ? {
|
|
11663
11913
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
11664
11914
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -11699,7 +11949,7 @@ var StyledTabsRoot = (0, import_styled_components83.default)(import_react_tabs4.
|
|
|
11699
11949
|
flex-direction: column;
|
|
11700
11950
|
height: ${({ $stickyHeaders }) => $stickyHeaders ? "100%" : "auto"};
|
|
11701
11951
|
`;
|
|
11702
|
-
var Tabs = (0,
|
|
11952
|
+
var Tabs = (0, import_react62.forwardRef)(
|
|
11703
11953
|
({
|
|
11704
11954
|
children,
|
|
11705
11955
|
fullWidth = true,
|
|
@@ -11711,7 +11961,7 @@ var Tabs = (0, import_react60.forwardRef)(
|
|
|
11711
11961
|
...otherProps
|
|
11712
11962
|
}, ref) => {
|
|
11713
11963
|
const tabItems = extractTabItems(children);
|
|
11714
|
-
const [internalSelectedValue, setInternalSelectedValue] = (0,
|
|
11964
|
+
const [internalSelectedValue, setInternalSelectedValue] = (0, import_react62.useState)(defaultSelectedValue);
|
|
11715
11965
|
const modeProps = defaultSelectedValue !== void 0 ? {
|
|
11716
11966
|
defaultValue: defaultSelectedValue,
|
|
11717
11967
|
onValueChange: setInternalSelectedValue
|
|
@@ -11741,7 +11991,7 @@ var Tabs = (0, import_react60.forwardRef)(
|
|
|
11741
11991
|
label,
|
|
11742
11992
|
"aria-label": ariaLabelForTab
|
|
11743
11993
|
} = tab.props;
|
|
11744
|
-
if ((0,
|
|
11994
|
+
if ((0, import_type_guards45.isNil)(icon)) {
|
|
11745
11995
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11746
11996
|
TabItem,
|
|
11747
11997
|
{
|
|
@@ -11752,7 +12002,7 @@ var Tabs = (0, import_react60.forwardRef)(
|
|
|
11752
12002
|
value
|
|
11753
12003
|
);
|
|
11754
12004
|
}
|
|
11755
|
-
if ((0,
|
|
12005
|
+
if ((0, import_type_guards45.isNotNil)(label)) {
|
|
11756
12006
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11757
12007
|
TabItem,
|
|
11758
12008
|
{
|
|
@@ -11764,7 +12014,7 @@ var Tabs = (0, import_react60.forwardRef)(
|
|
|
11764
12014
|
value
|
|
11765
12015
|
);
|
|
11766
12016
|
}
|
|
11767
|
-
if ((0,
|
|
12017
|
+
if ((0, import_type_guards45.isNotNil)(ariaLabelForTab)) {
|
|
11768
12018
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11769
12019
|
TabItem,
|
|
11770
12020
|
{
|
|
@@ -11797,17 +12047,17 @@ var Tabs = (0, import_react60.forwardRef)(
|
|
|
11797
12047
|
Tabs.displayName = "Tabs";
|
|
11798
12048
|
|
|
11799
12049
|
// src/components/Tabs/Tab.tsx
|
|
11800
|
-
var
|
|
12050
|
+
var import_react63 = require("react");
|
|
11801
12051
|
var import_jsx_runtime266 = require("react/jsx-runtime");
|
|
11802
|
-
var Tab = (0,
|
|
12052
|
+
var Tab = (0, import_react63.forwardRef)(({ children }, ref) => {
|
|
11803
12053
|
return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { ref, children });
|
|
11804
12054
|
});
|
|
11805
12055
|
Tab.displayName = "Tab";
|
|
11806
12056
|
|
|
11807
12057
|
// src/components/Tag/Tag.tsx
|
|
11808
|
-
var
|
|
12058
|
+
var import_react64 = require("react");
|
|
11809
12059
|
var import_styled_components84 = __toESM(require("styled-components"));
|
|
11810
|
-
var
|
|
12060
|
+
var import_type_guards46 = require("@wistia/type-guards");
|
|
11811
12061
|
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
11812
12062
|
var TagLabel = import_styled_components84.default.a`
|
|
11813
12063
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -11892,10 +12142,10 @@ var StyledTag = import_styled_components84.default.div`
|
|
|
11892
12142
|
}
|
|
11893
12143
|
`;
|
|
11894
12144
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
11895
|
-
if ((0,
|
|
12145
|
+
if ((0, import_type_guards46.isNil)(onClickRemove)) {
|
|
11896
12146
|
return null;
|
|
11897
12147
|
}
|
|
11898
|
-
if ((0,
|
|
12148
|
+
if ((0, import_type_guards46.isNil)(onClickRemoveLabel)) {
|
|
11899
12149
|
throw new Error(
|
|
11900
12150
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
11901
12151
|
);
|
|
@@ -11922,7 +12172,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
11922
12172
|
)
|
|
11923
12173
|
] });
|
|
11924
12174
|
};
|
|
11925
|
-
var Tag = (0,
|
|
12175
|
+
var Tag = (0, import_react64.forwardRef)(
|
|
11926
12176
|
({
|
|
11927
12177
|
onClickRemove,
|
|
11928
12178
|
colorScheme = "inherit",
|
|
@@ -11932,8 +12182,8 @@ var Tag = (0, import_react62.forwardRef)(
|
|
|
11932
12182
|
onClickRemoveLabel,
|
|
11933
12183
|
...otherProps
|
|
11934
12184
|
}, ref) => {
|
|
11935
|
-
const hasIcon = (0,
|
|
11936
|
-
const labelProps = (0,
|
|
12185
|
+
const hasIcon = (0, import_type_guards46.isNotNil)(icon);
|
|
12186
|
+
const labelProps = (0, import_type_guards46.isNotNil)(href) && (0, import_type_guards46.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
11937
12187
|
return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
|
|
11938
12188
|
StyledTag,
|
|
11939
12189
|
{
|
|
@@ -11969,7 +12219,7 @@ Tag.displayName = "Tag";
|
|
|
11969
12219
|
|
|
11970
12220
|
// src/components/WistiaLogo/WistiaLogo.tsx
|
|
11971
12221
|
var import_styled_components85 = __toESM(require("styled-components"));
|
|
11972
|
-
var
|
|
12222
|
+
var import_type_guards47 = require("@wistia/type-guards");
|
|
11973
12223
|
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
11974
12224
|
var renderBrandmark = (brandmarkColor, iconOnly) => {
|
|
11975
12225
|
if (iconOnly) {
|
|
@@ -12082,7 +12332,7 @@ var WistiaLogo = ({
|
|
|
12082
12332
|
...otherProps,
|
|
12083
12333
|
children: [
|
|
12084
12334
|
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)("title", { children: title }),
|
|
12085
|
-
(0,
|
|
12335
|
+
(0, import_type_guards47.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("desc", { children: description }) : null,
|
|
12086
12336
|
renderBrandmark(brandmarkColor, iconOnly),
|
|
12087
12337
|
renderLogotype(logotypeColor, iconOnly)
|
|
12088
12338
|
]
|
|
@@ -12178,10 +12428,12 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
12178
12428
|
useAriaLive,
|
|
12179
12429
|
useBoolean,
|
|
12180
12430
|
useFilePicker,
|
|
12431
|
+
useFocusTrap,
|
|
12181
12432
|
useFormState,
|
|
12182
12433
|
useImperativeFilePicker,
|
|
12183
12434
|
useKey,
|
|
12184
12435
|
useLocalStorage,
|
|
12436
|
+
useLockBodyScroll,
|
|
12185
12437
|
useMq,
|
|
12186
12438
|
useToast,
|
|
12187
12439
|
useWindowSize
|