@wistia/ui 0.6.36 → 0.6.37-beta.04788fdf.b895743
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 +540 -306
- 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 +358 -126
- 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.37-beta.04788fdf.b895743
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -119,11 +119,13 @@ __export(index_exports, {
|
|
|
119
119
|
ellipsisFlexParentStyle: () => ellipsisFlexParentStyle,
|
|
120
120
|
ellipsisStyle: () => ellipsisStyle,
|
|
121
121
|
iconSizeMap: () => iconSizeMap,
|
|
122
|
+
mergeRefs: () => mergeRefs,
|
|
122
123
|
mq: () => mq,
|
|
123
124
|
useActiveMq: () => useActiveMq,
|
|
124
125
|
useAriaLive: () => useAriaLive,
|
|
125
126
|
useBoolean: () => useBoolean,
|
|
126
127
|
useFilePicker: () => import_use_file_picker.useFilePicker,
|
|
128
|
+
useFocusTrap: () => useFocusTrap,
|
|
127
129
|
useFormState: () => useFormState,
|
|
128
130
|
useImperativeFilePicker: () => import_use_file_picker.useImperativeFilePicker,
|
|
129
131
|
useKey: () => useKey,
|
|
@@ -2006,6 +2008,20 @@ var dateTime = {
|
|
|
2006
2008
|
timeOnlyString
|
|
2007
2009
|
};
|
|
2008
2010
|
|
|
2011
|
+
// src/helpers/mergeRefs/mergeRefs.ts
|
|
2012
|
+
var import_type_guards5 = require("@wistia/type-guards");
|
|
2013
|
+
var mergeRefs = (refs) => (value) => {
|
|
2014
|
+
refs.forEach((ref) => {
|
|
2015
|
+
if ((0, import_type_guards5.isFunction)(ref)) {
|
|
2016
|
+
ref(value);
|
|
2017
|
+
return;
|
|
2018
|
+
}
|
|
2019
|
+
if ((0, import_type_guards5.isNotNil)(ref)) {
|
|
2020
|
+
ref.current = value;
|
|
2021
|
+
}
|
|
2022
|
+
});
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2009
2025
|
// src/helpers/mq/mq.ts
|
|
2010
2026
|
var import_polished = require("polished");
|
|
2011
2027
|
|
|
@@ -2054,10 +2070,10 @@ var mq = {
|
|
|
2054
2070
|
|
|
2055
2071
|
// src/hooks/useAriaLive/useAriaLive.tsx
|
|
2056
2072
|
var import_react3 = require("react");
|
|
2057
|
-
var
|
|
2073
|
+
var import_type_guards6 = require("@wistia/type-guards");
|
|
2058
2074
|
var useAriaLive = () => {
|
|
2059
2075
|
const context = (0, import_react3.useContext)(AriaLiveContext);
|
|
2060
|
-
if ((0,
|
|
2076
|
+
if ((0, import_type_guards6.isNil)(context)) {
|
|
2061
2077
|
throw new Error("useAriaLive must be used within an AriaLiveProvider");
|
|
2062
2078
|
}
|
|
2063
2079
|
return context;
|
|
@@ -2084,9 +2100,9 @@ var import_react6 = require("react");
|
|
|
2084
2100
|
var import_react5 = require("react");
|
|
2085
2101
|
|
|
2086
2102
|
// src/private/helpers/isValidRef/isValidRef.ts
|
|
2087
|
-
var
|
|
2103
|
+
var import_type_guards7 = require("@wistia/type-guards");
|
|
2088
2104
|
var isValidRef = (value) => {
|
|
2089
|
-
return (0,
|
|
2105
|
+
return (0, import_type_guards7.isNotNil)(value) && (0, import_type_guards7.isRecord)(value) && "current" in value;
|
|
2090
2106
|
};
|
|
2091
2107
|
|
|
2092
2108
|
// src/private/hooks/useEvent/useEvent.ts
|
|
@@ -2194,7 +2210,7 @@ var useLockBodyScroll = (locked) => {
|
|
|
2194
2210
|
};
|
|
2195
2211
|
|
|
2196
2212
|
// src/hooks/useMq/useMq.ts
|
|
2197
|
-
var
|
|
2213
|
+
var import_type_guards8 = require("@wistia/type-guards");
|
|
2198
2214
|
|
|
2199
2215
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
2200
2216
|
var import_react9 = require("react");
|
|
@@ -2256,7 +2272,7 @@ var useActiveMq = () => {
|
|
|
2256
2272
|
const keys = Object.keys(mq2);
|
|
2257
2273
|
return keys.filter((key) => {
|
|
2258
2274
|
const value = mq2[key];
|
|
2259
|
-
return (0,
|
|
2275
|
+
return (0, import_type_guards8.isBoolean)(value) && value;
|
|
2260
2276
|
});
|
|
2261
2277
|
};
|
|
2262
2278
|
|
|
@@ -2267,10 +2283,10 @@ var import_sonner2 = require("sonner");
|
|
|
2267
2283
|
// src/private/components/Toast/Toast.tsx
|
|
2268
2284
|
var import_react10 = require("react");
|
|
2269
2285
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
2270
|
-
var
|
|
2286
|
+
var import_type_guards10 = require("@wistia/type-guards");
|
|
2271
2287
|
|
|
2272
2288
|
// src/components/Ellipsis/Ellipsis.tsx
|
|
2273
|
-
var
|
|
2289
|
+
var import_type_guards9 = require("@wistia/type-guards");
|
|
2274
2290
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
2275
2291
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2276
2292
|
var ellipsisStyle = import_styled_components13.css`
|
|
@@ -2303,7 +2319,7 @@ var ellipsisFlexParentStyle = import_styled_components13.css`
|
|
|
2303
2319
|
var EllipsisComponent = import_styled_components13.default.span`
|
|
2304
2320
|
${ellipsisStyle};
|
|
2305
2321
|
${({ $lines }) => {
|
|
2306
|
-
if ((0,
|
|
2322
|
+
if ((0, import_type_guards9.isNotNil)($lines)) {
|
|
2307
2323
|
return import_styled_components13.css`
|
|
2308
2324
|
-webkit-box-orient: vertical;
|
|
2309
2325
|
-webkit-line-clamp: ${$lines};
|
|
@@ -2495,7 +2511,7 @@ var StyledToast = import_styled_components15.default.div`
|
|
|
2495
2511
|
}
|
|
2496
2512
|
`;
|
|
2497
2513
|
var Action = ({ actionButton }) => {
|
|
2498
|
-
if ((0,
|
|
2514
|
+
if ((0, import_type_guards10.isNotNil)(actionButton) && (0, import_react10.isValidElement)(actionButton)) {
|
|
2499
2515
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionWrapper, { children: (0, import_react10.cloneElement)(actionButton, {
|
|
2500
2516
|
variant: "soft",
|
|
2501
2517
|
// force Button variant
|
|
@@ -2519,7 +2535,7 @@ var Toast = ({
|
|
|
2519
2535
|
$colorScheme: colorScheme,
|
|
2520
2536
|
children: [
|
|
2521
2537
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(MessageWrapper, { children: [
|
|
2522
|
-
(0,
|
|
2538
|
+
(0, import_type_guards10.isNotNil)(icon) ? icon : null,
|
|
2523
2539
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Message, { lines: 3, children: message })
|
|
2524
2540
|
] }),
|
|
2525
2541
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Action, { actionButton: action })
|
|
@@ -2553,14 +2569,246 @@ var useToast = () => {
|
|
|
2553
2569
|
);
|
|
2554
2570
|
};
|
|
2555
2571
|
|
|
2572
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2573
|
+
var import_react12 = require("react");
|
|
2574
|
+
var import_type_guards11 = require("@wistia/type-guards");
|
|
2575
|
+
|
|
2576
|
+
// src/hooks/useFocusTrap/helpers.ts
|
|
2577
|
+
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]';
|
|
2578
|
+
var coerceToString = (value) => value === null || value === void 0 ? "" : String(value);
|
|
2579
|
+
var isHiddenElement = (element) => {
|
|
2580
|
+
const { display, visibility } = window.getComputedStyle(element);
|
|
2581
|
+
const isHidden = display === "none" || element.style.display === "none" || visibility === "none" || element.style.visibility === "hidden";
|
|
2582
|
+
return element.offsetWidth <= 0 && element.offsetHeight <= 0 || isHidden;
|
|
2583
|
+
};
|
|
2584
|
+
var isVisibleElement = (element) => {
|
|
2585
|
+
let parentElement = element;
|
|
2586
|
+
while (parentElement) {
|
|
2587
|
+
if (parentElement === document.body) {
|
|
2588
|
+
break;
|
|
2589
|
+
}
|
|
2590
|
+
if (isHiddenElement(parentElement)) {
|
|
2591
|
+
return false;
|
|
2592
|
+
}
|
|
2593
|
+
parentElement = parentElement.parentNode;
|
|
2594
|
+
}
|
|
2595
|
+
return true;
|
|
2596
|
+
};
|
|
2597
|
+
var getElementTabIndex = (element) => {
|
|
2598
|
+
const tabIndex = element.getAttribute("tabindex");
|
|
2599
|
+
return Number.parseInt(tabIndex ?? void 0, 10);
|
|
2600
|
+
};
|
|
2601
|
+
var isTabIndexNaN = (element) => {
|
|
2602
|
+
const tabIndex = getElementTabIndex(element);
|
|
2603
|
+
return Number.isNaN(tabIndex);
|
|
2604
|
+
};
|
|
2605
|
+
var isFocusableElement = (element) => {
|
|
2606
|
+
const tabbableNodeRegEx = /input|select|textarea|button|object/;
|
|
2607
|
+
const nodeName = element.nodeName.toLowerCase();
|
|
2608
|
+
const isTabIndexNotNaN = !isTabIndexNaN(element);
|
|
2609
|
+
const isFocusable = (
|
|
2610
|
+
// @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.
|
|
2611
|
+
tabbableNodeRegEx.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN)
|
|
2612
|
+
);
|
|
2613
|
+
return Boolean(isFocusable) && isVisibleElement(element);
|
|
2614
|
+
};
|
|
2615
|
+
var isTabbableElement = (element) => {
|
|
2616
|
+
const tabIndex = getElementTabIndex(element);
|
|
2617
|
+
return (isTabIndexNaN(element) || tabIndex >= 0) && isFocusableElement(element);
|
|
2618
|
+
};
|
|
2619
|
+
var findTabbableDescendants = (element) => Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter(
|
|
2620
|
+
isTabbableElement
|
|
2621
|
+
);
|
|
2622
|
+
var focusLaterElements = [];
|
|
2623
|
+
var focusElement = null;
|
|
2624
|
+
var needToFocus = false;
|
|
2625
|
+
var handleBlur = () => {
|
|
2626
|
+
needToFocus = true;
|
|
2627
|
+
};
|
|
2628
|
+
var handleFocus = () => {
|
|
2629
|
+
if (needToFocus) {
|
|
2630
|
+
needToFocus = false;
|
|
2631
|
+
if (!focusElement) {
|
|
2632
|
+
return;
|
|
2633
|
+
}
|
|
2634
|
+
if (focusElement.contains(document.activeElement)) {
|
|
2635
|
+
return;
|
|
2636
|
+
}
|
|
2637
|
+
const element = findTabbableDescendants(focusElement)[0] ?? focusElement;
|
|
2638
|
+
element.focus();
|
|
2639
|
+
}
|
|
2640
|
+
};
|
|
2641
|
+
var markForFocusLater = () => {
|
|
2642
|
+
const element = document.activeElement;
|
|
2643
|
+
if (element !== null) {
|
|
2644
|
+
focusLaterElements.push(element);
|
|
2645
|
+
}
|
|
2646
|
+
};
|
|
2647
|
+
var returnFocus = () => {
|
|
2648
|
+
let toFocus = null;
|
|
2649
|
+
try {
|
|
2650
|
+
toFocus = focusLaterElements.pop();
|
|
2651
|
+
if (toFocus) {
|
|
2652
|
+
toFocus.focus();
|
|
2653
|
+
}
|
|
2654
|
+
} catch {
|
|
2655
|
+
console.warn(
|
|
2656
|
+
`You tried to return focus to ${coerceToString(toFocus)} but it is not in the DOM anymore`
|
|
2657
|
+
);
|
|
2658
|
+
}
|
|
2659
|
+
};
|
|
2660
|
+
var setupScopedFocus = (element) => {
|
|
2661
|
+
focusElement = element;
|
|
2662
|
+
document.addEventListener("focusout", handleBlur, false);
|
|
2663
|
+
document.addEventListener("focusin", handleFocus, true);
|
|
2664
|
+
};
|
|
2665
|
+
var teardownScopedFocus = () => {
|
|
2666
|
+
focusElement = null;
|
|
2667
|
+
document.removeEventListener("focusout", handleBlur);
|
|
2668
|
+
document.removeEventListener("focusin", handleFocus);
|
|
2669
|
+
};
|
|
2670
|
+
var scopeTab = (node, event) => {
|
|
2671
|
+
const tabbable = findTabbableDescendants(node);
|
|
2672
|
+
if (!tabbable.length) {
|
|
2673
|
+
event.preventDefault();
|
|
2674
|
+
return;
|
|
2675
|
+
}
|
|
2676
|
+
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
|
|
2677
|
+
const leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
|
|
2678
|
+
if (!leavingFinalTabbable) {
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
event.preventDefault();
|
|
2682
|
+
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
|
|
2683
|
+
if (target) {
|
|
2684
|
+
target.focus();
|
|
2685
|
+
}
|
|
2686
|
+
};
|
|
2687
|
+
var createAriaHider = (containerNode, selector) => {
|
|
2688
|
+
if (selector === void 0) {
|
|
2689
|
+
selector = "body > :not(script)";
|
|
2690
|
+
}
|
|
2691
|
+
const rootNodes = Array.from(document.querySelectorAll(selector)).map((node) => {
|
|
2692
|
+
if (node.contains(containerNode)) {
|
|
2693
|
+
return void 0;
|
|
2694
|
+
}
|
|
2695
|
+
const ariaHidden = node.getAttribute("aria-hidden");
|
|
2696
|
+
if (ariaHidden === null || ariaHidden === "false") {
|
|
2697
|
+
node.setAttribute("aria-hidden", "true");
|
|
2698
|
+
}
|
|
2699
|
+
return {
|
|
2700
|
+
node,
|
|
2701
|
+
ariaHidden
|
|
2702
|
+
};
|
|
2703
|
+
});
|
|
2704
|
+
return () => {
|
|
2705
|
+
rootNodes.forEach((item) => {
|
|
2706
|
+
if (!item) {
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
if (item.ariaHidden === null) {
|
|
2710
|
+
item.node.removeAttribute("aria-hidden");
|
|
2711
|
+
} else {
|
|
2712
|
+
item.node.setAttribute("aria-hidden", item.ariaHidden);
|
|
2713
|
+
}
|
|
2714
|
+
});
|
|
2715
|
+
};
|
|
2716
|
+
};
|
|
2717
|
+
|
|
2718
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2719
|
+
var isRef = (val) => {
|
|
2720
|
+
return val !== null && typeof val === "object" && "current" in val;
|
|
2721
|
+
};
|
|
2722
|
+
var useFocusTrap = (active = true, options = {}) => {
|
|
2723
|
+
const ref = (0, import_react12.useRef)(null);
|
|
2724
|
+
const restoreAriaRef = (0, import_react12.useRef)(null);
|
|
2725
|
+
const setRef = (0, import_react12.useCallback)(
|
|
2726
|
+
(node) => {
|
|
2727
|
+
if (restoreAriaRef.current !== null) {
|
|
2728
|
+
restoreAriaRef.current();
|
|
2729
|
+
}
|
|
2730
|
+
if (ref.current) {
|
|
2731
|
+
returnFocus();
|
|
2732
|
+
teardownScopedFocus();
|
|
2733
|
+
}
|
|
2734
|
+
if (active && node !== null && node !== void 0) {
|
|
2735
|
+
setupScopedFocus(node);
|
|
2736
|
+
markForFocusLater();
|
|
2737
|
+
const processNode = (node2) => {
|
|
2738
|
+
restoreAriaRef.current = !(options.disableAriaHider ?? false) ? createAriaHider(node2) : null;
|
|
2739
|
+
let focusElement2 = null;
|
|
2740
|
+
if ((0, import_type_guards11.isNotUndefined)(options.focusSelector)) {
|
|
2741
|
+
if (isRef(options.focusSelector)) {
|
|
2742
|
+
focusElement2 = options.focusSelector.current;
|
|
2743
|
+
} else {
|
|
2744
|
+
focusElement2 = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
if (!focusElement2) {
|
|
2748
|
+
const children = Array.from(
|
|
2749
|
+
node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)
|
|
2750
|
+
);
|
|
2751
|
+
focusElement2 = // Prefer tabbable elements, But fallback to any focusable element
|
|
2752
|
+
children.find(isTabbableElement) ?? // But fallback to any focusable element
|
|
2753
|
+
children.find(isFocusableElement) ?? // Nothing found
|
|
2754
|
+
null;
|
|
2755
|
+
if (!focusElement2 && isFocusableElement(node2)) {
|
|
2756
|
+
focusElement2 = node2;
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
if (focusElement2) {
|
|
2760
|
+
focusElement2.focus();
|
|
2761
|
+
}
|
|
2762
|
+
if (!focusElement2 && process.env["NODE_ENV"] === "development") {
|
|
2763
|
+
console.warn(
|
|
2764
|
+
'[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.',
|
|
2765
|
+
node2
|
|
2766
|
+
);
|
|
2767
|
+
}
|
|
2768
|
+
};
|
|
2769
|
+
setTimeout(() => {
|
|
2770
|
+
if (node.ownerDocument) {
|
|
2771
|
+
processNode(node);
|
|
2772
|
+
}
|
|
2773
|
+
if (!node.ownerDocument && process.env["NODE_ENV"] === "development") {
|
|
2774
|
+
console.warn(
|
|
2775
|
+
"[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.",
|
|
2776
|
+
node
|
|
2777
|
+
);
|
|
2778
|
+
}
|
|
2779
|
+
});
|
|
2780
|
+
ref.current = node;
|
|
2781
|
+
} else {
|
|
2782
|
+
ref.current = null;
|
|
2783
|
+
}
|
|
2784
|
+
},
|
|
2785
|
+
[active, options.focusSelector, options.disableAriaHider]
|
|
2786
|
+
);
|
|
2787
|
+
(0, import_react12.useEffect)(() => {
|
|
2788
|
+
if (!active) {
|
|
2789
|
+
return void 0;
|
|
2790
|
+
}
|
|
2791
|
+
const handleKeyDown = (event) => {
|
|
2792
|
+
if (event.key === "Tab" && ref.current) {
|
|
2793
|
+
scopeTab(ref.current, event);
|
|
2794
|
+
}
|
|
2795
|
+
};
|
|
2796
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2797
|
+
return () => {
|
|
2798
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2799
|
+
};
|
|
2800
|
+
}, [active]);
|
|
2801
|
+
return setRef;
|
|
2802
|
+
};
|
|
2803
|
+
|
|
2556
2804
|
// src/components/ActionButton/ActionButton.tsx
|
|
2557
|
-
var
|
|
2805
|
+
var import_react16 = require("react");
|
|
2558
2806
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2559
2807
|
|
|
2560
2808
|
// src/components/Button/Button.tsx
|
|
2561
|
-
var
|
|
2809
|
+
var import_react15 = require("react");
|
|
2562
2810
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
2563
|
-
var
|
|
2811
|
+
var import_type_guards15 = require("@wistia/type-guards");
|
|
2564
2812
|
|
|
2565
2813
|
// src/css/buttonResetCss.tsx
|
|
2566
2814
|
var import_styled_components16 = require("styled-components");
|
|
@@ -2764,7 +3012,7 @@ var buttonSizeStyles = {
|
|
|
2764
3012
|
};
|
|
2765
3013
|
|
|
2766
3014
|
// src/components/Icon/Icon.tsx
|
|
2767
|
-
var
|
|
3015
|
+
var import_type_guards13 = require("@wistia/type-guards");
|
|
2768
3016
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
2769
3017
|
|
|
2770
3018
|
// src/components/Icon/icons/AbTestIcon.tsx
|
|
@@ -6619,17 +6867,17 @@ var iconMap = {
|
|
|
6619
6867
|
};
|
|
6620
6868
|
|
|
6621
6869
|
// src/private/hooks/useResponsiveProp/useResponsiveProp.ts
|
|
6622
|
-
var
|
|
6623
|
-
var
|
|
6870
|
+
var import_type_guards12 = require("@wistia/type-guards");
|
|
6871
|
+
var import_react13 = require("react");
|
|
6624
6872
|
var isResponsiveObject = (values) => {
|
|
6625
6873
|
return typeof values === "object" && values !== null && !Array.isArray(values) && "base" in values;
|
|
6626
6874
|
};
|
|
6627
6875
|
var useResponsiveProp = (values) => {
|
|
6628
6876
|
const activeMediaQueries = useActiveMq();
|
|
6629
|
-
return (0,
|
|
6630
|
-
if ((0,
|
|
6877
|
+
return (0, import_react13.useMemo)(() => {
|
|
6878
|
+
if ((0, import_type_guards12.isRecord)(values) && isResponsiveObject(values)) {
|
|
6631
6879
|
const mq2 = activeMediaQueries.find((key) => key in values);
|
|
6632
|
-
return (0,
|
|
6880
|
+
return (0, import_type_guards12.isNotUndefined)(mq2) && (0, import_type_guards12.isNotUndefined)(values[mq2]) ? values[mq2] : values.base;
|
|
6633
6881
|
}
|
|
6634
6882
|
return values;
|
|
6635
6883
|
}, [activeMediaQueries, values]);
|
|
@@ -6656,13 +6904,13 @@ var Icon = ({
|
|
|
6656
6904
|
...otherProps
|
|
6657
6905
|
}) => {
|
|
6658
6906
|
const responsiveSize = useResponsiveProp(size);
|
|
6659
|
-
if ((0,
|
|
6907
|
+
if ((0, import_type_guards13.isNil)(type)) {
|
|
6660
6908
|
throw new Error("An Icon component requires a `type` prop to be provided");
|
|
6661
6909
|
}
|
|
6662
|
-
if ((0,
|
|
6910
|
+
if ((0, import_type_guards13.isNil)(iconMap[type])) {
|
|
6663
6911
|
throw new Error(`Type "${type}" does not exist, please update type prop in Icon component.`);
|
|
6664
6912
|
}
|
|
6665
|
-
if ((0,
|
|
6913
|
+
if ((0, import_type_guards13.isNil)(iconSizeMap[responsiveSize])) {
|
|
6666
6914
|
throw new Error(
|
|
6667
6915
|
`Size "${responsiveSize}" does not exist, please update size prop in Icon component.`
|
|
6668
6916
|
);
|
|
@@ -6693,13 +6941,13 @@ var Icon = ({
|
|
|
6693
6941
|
Icon.displayName = "Icon";
|
|
6694
6942
|
|
|
6695
6943
|
// src/components/Link/Link.tsx
|
|
6696
|
-
var
|
|
6697
|
-
var
|
|
6944
|
+
var import_react14 = require("react");
|
|
6945
|
+
var import_type_guards14 = require("@wistia/type-guards");
|
|
6698
6946
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
6699
6947
|
var import_react_router_dom = require("react-router-dom");
|
|
6700
6948
|
var import_jsx_runtime192 = require("react/jsx-runtime");
|
|
6701
6949
|
var generateHref = (href, type, disabled) => {
|
|
6702
|
-
if (disabled || (0,
|
|
6950
|
+
if (disabled || (0, import_type_guards14.isNil)(href)) {
|
|
6703
6951
|
return void 0;
|
|
6704
6952
|
}
|
|
6705
6953
|
let to = href;
|
|
@@ -6711,12 +6959,12 @@ var generateHref = (href, type, disabled) => {
|
|
|
6711
6959
|
}
|
|
6712
6960
|
return to;
|
|
6713
6961
|
};
|
|
6714
|
-
var isButton = (props) => (0,
|
|
6715
|
-
var isLink = (props) => (0,
|
|
6962
|
+
var isButton = (props) => (0, import_type_guards14.isUndefined)(props.href);
|
|
6963
|
+
var isLink = (props) => (0, import_type_guards14.isNotUndefined)(props.href);
|
|
6716
6964
|
var StyledLink = import_styled_components19.default.a`
|
|
6717
6965
|
--link-icon-size: 14px;
|
|
6718
6966
|
|
|
6719
|
-
${({ href }) => (0,
|
|
6967
|
+
${({ href }) => (0, import_type_guards14.isNil)(href) && buttonResetCss};
|
|
6720
6968
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
6721
6969
|
cursor: pointer;
|
|
6722
6970
|
font-family: var(--wui-typography-family-default);
|
|
@@ -6733,7 +6981,7 @@ var StyledLink = import_styled_components19.default.a`
|
|
|
6733
6981
|
}
|
|
6734
6982
|
}
|
|
6735
6983
|
`;
|
|
6736
|
-
var Link = (0,
|
|
6984
|
+
var Link = (0, import_react14.forwardRef)(
|
|
6737
6985
|
({
|
|
6738
6986
|
beforeAction,
|
|
6739
6987
|
children,
|
|
@@ -6757,16 +7005,16 @@ var Link = (0, import_react13.forwardRef)(
|
|
|
6757
7005
|
} catch (error) {
|
|
6758
7006
|
console.error(error);
|
|
6759
7007
|
} finally {
|
|
6760
|
-
if ((0,
|
|
7008
|
+
if ((0, import_type_guards14.isFunction)(props.onClick)) {
|
|
6761
7009
|
props.onClick(event);
|
|
6762
7010
|
} else if (routingCallback !== null) {
|
|
6763
7011
|
routingCallback();
|
|
6764
|
-
} else if ((0,
|
|
7012
|
+
} else if ((0, import_type_guards14.isNotNil)(to)) {
|
|
6765
7013
|
window.location.assign(to);
|
|
6766
7014
|
} else {
|
|
6767
7015
|
}
|
|
6768
7016
|
}
|
|
6769
|
-
} else if ((0,
|
|
7017
|
+
} else if ((0, import_type_guards14.isFunction)(props.onClick)) {
|
|
6770
7018
|
props.onClick(event);
|
|
6771
7019
|
} else {
|
|
6772
7020
|
}
|
|
@@ -6827,7 +7075,7 @@ Link.displayName = "Link";
|
|
|
6827
7075
|
|
|
6828
7076
|
// src/components/Button/Button.tsx
|
|
6829
7077
|
var import_jsx_runtime193 = require("react/jsx-runtime");
|
|
6830
|
-
var isLink2 = (props) => (0,
|
|
7078
|
+
var isLink2 = (props) => (0, import_type_guards15.isNotUndefined)(props.href);
|
|
6831
7079
|
var StyledButton = import_styled_components20.default.button`
|
|
6832
7080
|
${buttonResetCss}
|
|
6833
7081
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -6867,8 +7115,8 @@ var ButtonContent = ({
|
|
|
6867
7115
|
/* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
6868
7116
|
StyledButtonContent,
|
|
6869
7117
|
{
|
|
6870
|
-
$hasLeftIcon: (0,
|
|
6871
|
-
$hasRightIcon: (0,
|
|
7118
|
+
$hasLeftIcon: (0, import_type_guards15.isNotNil)(leftIcon),
|
|
7119
|
+
$hasRightIcon: (0, import_type_guards15.isNotNil)(rightIcon),
|
|
6872
7120
|
$isLoading: isLoading,
|
|
6873
7121
|
children: [
|
|
6874
7122
|
leftIcon ?? null,
|
|
@@ -6879,7 +7127,7 @@ var ButtonContent = ({
|
|
|
6879
7127
|
)
|
|
6880
7128
|
] });
|
|
6881
7129
|
};
|
|
6882
|
-
var Button = (0,
|
|
7130
|
+
var Button = (0, import_react15.forwardRef)(
|
|
6883
7131
|
({
|
|
6884
7132
|
children,
|
|
6885
7133
|
forceState,
|
|
@@ -6936,7 +7184,7 @@ var Button = (0, import_react14.forwardRef)(
|
|
|
6936
7184
|
event.preventDefault();
|
|
6937
7185
|
return;
|
|
6938
7186
|
}
|
|
6939
|
-
if ((0,
|
|
7187
|
+
if ((0, import_type_guards15.isNotNil)(onClick)) {
|
|
6940
7188
|
onClick(event);
|
|
6941
7189
|
}
|
|
6942
7190
|
};
|
|
@@ -7058,7 +7306,7 @@ var StyledLabel = import_styled_components21.default.span`
|
|
|
7058
7306
|
grid-row: 2;
|
|
7059
7307
|
text-align: left;
|
|
7060
7308
|
`;
|
|
7061
|
-
var ActionButton = (0,
|
|
7309
|
+
var ActionButton = (0, import_react16.forwardRef)(
|
|
7062
7310
|
({
|
|
7063
7311
|
icon,
|
|
7064
7312
|
colorScheme = "default",
|
|
@@ -7102,8 +7350,8 @@ var ActionButton = (0, import_react15.forwardRef)(
|
|
|
7102
7350
|
ActionButton.displayName = "ActionButton";
|
|
7103
7351
|
|
|
7104
7352
|
// src/components/Avatar/Avatar.tsx
|
|
7105
|
-
var
|
|
7106
|
-
var
|
|
7353
|
+
var import_react17 = require("react");
|
|
7354
|
+
var import_type_guards17 = require("@wistia/type-guards");
|
|
7107
7355
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
7108
7356
|
|
|
7109
7357
|
// src/components/ColorSchemeWrapper/ColorSchemeWrapper.tsx
|
|
@@ -7146,13 +7394,13 @@ var ColorSchemeWrapper = ({
|
|
|
7146
7394
|
ColorSchemeWrapper.displayName = "ColorSchemeWrapper";
|
|
7147
7395
|
|
|
7148
7396
|
// src/components/Avatar/formatNameForDisplay.tsx
|
|
7149
|
-
var
|
|
7397
|
+
var import_type_guards16 = require("@wistia/type-guards");
|
|
7150
7398
|
var containsEmojiCharacter = (char) => {
|
|
7151
7399
|
const emojiRegex = /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu;
|
|
7152
7400
|
return emojiRegex.test(char);
|
|
7153
7401
|
};
|
|
7154
7402
|
var formatNameForDisplay = (name) => {
|
|
7155
|
-
if ((0,
|
|
7403
|
+
if ((0, import_type_guards16.isNil)(name) || !(0, import_type_guards16.isString)(name) || (0, import_type_guards16.isEmptyString)(name) || containsEmojiCharacter(name)) {
|
|
7156
7404
|
return "U";
|
|
7157
7405
|
}
|
|
7158
7406
|
const firstChar = name.trim().substring(0, 1);
|
|
@@ -7215,7 +7463,7 @@ var AvatarWrapper = import_styled_components23.default.div`
|
|
|
7215
7463
|
max-height: ${({ $maxHeight }) => $maxHeight}px;
|
|
7216
7464
|
`;
|
|
7217
7465
|
var chooseColorScheme = (name) => {
|
|
7218
|
-
if ((0,
|
|
7466
|
+
if ((0, import_type_guards17.isNil)(name) || name === "Anonymous") {
|
|
7219
7467
|
return "default";
|
|
7220
7468
|
}
|
|
7221
7469
|
const filteredColors = colorSchemeOptions.filter(
|
|
@@ -7234,8 +7482,8 @@ var Avatar = ({
|
|
|
7234
7482
|
onImageLoad,
|
|
7235
7483
|
...otherProps
|
|
7236
7484
|
}) => {
|
|
7237
|
-
const [imageLoadState, setImageLoadState] = (0,
|
|
7238
|
-
(0,
|
|
7485
|
+
const [imageLoadState, setImageLoadState] = (0, import_react17.useState)("loading");
|
|
7486
|
+
(0, import_react17.useEffect)(() => {
|
|
7239
7487
|
setImageLoadState("loading");
|
|
7240
7488
|
}, [imageUrl]);
|
|
7241
7489
|
const handleImageLoad = () => {
|
|
@@ -7247,8 +7495,8 @@ var Avatar = ({
|
|
|
7247
7495
|
onImageLoad?.({ state: "error", type: "initials" });
|
|
7248
7496
|
};
|
|
7249
7497
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
7250
|
-
const avatarColor = (0,
|
|
7251
|
-
const showInitials = (0,
|
|
7498
|
+
const avatarColor = (0, import_react17.useMemo)(() => chooseColorScheme(name), [name]);
|
|
7499
|
+
const showInitials = (0, import_type_guards17.isNil)(imageUrl) || imageLoadState === "error";
|
|
7252
7500
|
return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
7253
7501
|
AvatarWrapper,
|
|
7254
7502
|
{
|
|
@@ -7277,9 +7525,9 @@ var Avatar = ({
|
|
|
7277
7525
|
Avatar.displayName = "Avatar";
|
|
7278
7526
|
|
|
7279
7527
|
// src/components/Badge/Badge.tsx
|
|
7280
|
-
var
|
|
7528
|
+
var import_react18 = require("react");
|
|
7281
7529
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
7282
|
-
var
|
|
7530
|
+
var import_type_guards18 = require("@wistia/type-guards");
|
|
7283
7531
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
7284
7532
|
var StyledBadge = import_styled_components24.default.div`
|
|
7285
7533
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -7301,9 +7549,9 @@ var StyledBadge = import_styled_components24.default.div`
|
|
|
7301
7549
|
width: 12px;
|
|
7302
7550
|
}
|
|
7303
7551
|
`;
|
|
7304
|
-
var Badge = (0,
|
|
7552
|
+
var Badge = (0, import_react18.forwardRef)(
|
|
7305
7553
|
({ colorScheme = "inherit", label, icon, ...otherProps }, ref) => {
|
|
7306
|
-
const hasIcon = (0,
|
|
7554
|
+
const hasIcon = (0, import_type_guards18.isNotNil)(icon);
|
|
7307
7555
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
|
|
7308
7556
|
StyledBadge,
|
|
7309
7557
|
{
|
|
@@ -7322,9 +7570,9 @@ var Badge = (0, import_react17.forwardRef)(
|
|
|
7322
7570
|
Badge.displayName = "Badge";
|
|
7323
7571
|
|
|
7324
7572
|
// src/components/Box/Box.tsx
|
|
7325
|
-
var
|
|
7573
|
+
var import_react19 = require("react");
|
|
7326
7574
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
7327
|
-
var
|
|
7575
|
+
var import_type_guards19 = require("@wistia/type-guards");
|
|
7328
7576
|
|
|
7329
7577
|
// src/private/helpers/makePolymorphic/makePolymorphic.tsx
|
|
7330
7578
|
var makePolymorphic = (component) => {
|
|
@@ -7335,8 +7583,8 @@ var makePolymorphic = (component) => {
|
|
|
7335
7583
|
var import_jsx_runtime198 = require("react/jsx-runtime");
|
|
7336
7584
|
var isDev = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
|
|
7337
7585
|
var getGapStyle = (gap) => {
|
|
7338
|
-
if ((0,
|
|
7339
|
-
if ((0,
|
|
7586
|
+
if ((0, import_type_guards19.isNotNil)(gap)) {
|
|
7587
|
+
if ((0, import_type_guards19.isRecord)(gap)) {
|
|
7340
7588
|
return Object.entries(gap).map(([key, value]) => {
|
|
7341
7589
|
return `${key}-gap: var(--wui-${value})};`;
|
|
7342
7590
|
}).join("");
|
|
@@ -7411,8 +7659,8 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
7411
7659
|
align-content: ${({ $alignContent }) => $alignContent};
|
|
7412
7660
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
7413
7661
|
align-self: ${({ $alignSelf }) => $alignSelf ?? null};
|
|
7414
|
-
display: ${({ $inline }) => (0,
|
|
7415
|
-
flex-basis: ${({ $basis }) => (0,
|
|
7662
|
+
display: ${({ $inline }) => (0, import_type_guards19.isNotNil)($inline) && $inline ? "inline-flex" : "flex"};
|
|
7663
|
+
flex-basis: ${({ $basis }) => (0, import_type_guards19.isNotNil)($basis) ? $basis : null};
|
|
7416
7664
|
flex-direction: ${({ $flexDirection }) => $flexDirection};
|
|
7417
7665
|
${({ $fillBox: fill }) => getFillStyle(fill)};
|
|
7418
7666
|
${({ $fillViewport }) => getFillViewportStyle($fillViewport)};
|
|
@@ -7422,22 +7670,22 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
7422
7670
|
width: ${({ $width }) => $width ?? null};
|
|
7423
7671
|
|
|
7424
7672
|
/* Box children styles */
|
|
7425
|
-
flex-grow: ${({ $grow }) => (0,
|
|
7426
|
-
flex-shrink: ${({ $shrink }) => (0,
|
|
7673
|
+
flex-grow: ${({ $grow }) => (0, import_type_guards19.isNotNil)($grow) ? $grow : null};
|
|
7674
|
+
flex-shrink: ${({ $shrink }) => (0, import_type_guards19.isNotNil)($shrink) ? $shrink : null};
|
|
7427
7675
|
flex-wrap: ${({ $wrapItems }) => $wrapItems ? "wrap" : "nowrap"};
|
|
7428
7676
|
justify-content: ${({ $justifyContent }) => $justifyContent};
|
|
7429
|
-
order: ${({ $order }) => (0,
|
|
7677
|
+
order: ${({ $order }) => (0, import_type_guards19.isNotNil)($order) ? $order : null};
|
|
7430
7678
|
`;
|
|
7431
7679
|
var wrapChildren = (children) => {
|
|
7432
|
-
if ((0,
|
|
7680
|
+
if ((0, import_type_guards19.isNotNil)(children)) {
|
|
7433
7681
|
if (typeof children === "object" && isDev) {
|
|
7434
|
-
return
|
|
7435
|
-
if ((0,
|
|
7682
|
+
return import_react19.Children.map(children, (child) => {
|
|
7683
|
+
if ((0, import_type_guards19.isNil)(child)) return null;
|
|
7436
7684
|
const elementParams = {};
|
|
7437
7685
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
7438
7686
|
elementParams.hasBoxParent = true;
|
|
7439
7687
|
}
|
|
7440
|
-
return (0,
|
|
7688
|
+
return (0, import_react19.cloneElement)(child, elementParams);
|
|
7441
7689
|
});
|
|
7442
7690
|
}
|
|
7443
7691
|
return children;
|
|
@@ -7445,7 +7693,7 @@ var wrapChildren = (children) => {
|
|
|
7445
7693
|
return null;
|
|
7446
7694
|
};
|
|
7447
7695
|
var DEFAULT_ELEMENT = "div";
|
|
7448
|
-
var BoxComponent = (0,
|
|
7696
|
+
var BoxComponent = (0, import_react19.forwardRef)(
|
|
7449
7697
|
({
|
|
7450
7698
|
alignContent = "stretch",
|
|
7451
7699
|
alignItems = "flex-start",
|
|
@@ -7470,7 +7718,7 @@ var BoxComponent = (0, import_react18.forwardRef)(
|
|
|
7470
7718
|
flexMode,
|
|
7471
7719
|
...otherProps
|
|
7472
7720
|
}, ref) => {
|
|
7473
|
-
if ((0,
|
|
7721
|
+
if ((0, import_type_guards19.isNotUndefined)(height)) {
|
|
7474
7722
|
if (fill === true || fill === "vertical") {
|
|
7475
7723
|
throw new Error('Cannot use height prop with fill="vertical" or fill={true}');
|
|
7476
7724
|
}
|
|
@@ -7480,7 +7728,7 @@ var BoxComponent = (0, import_react18.forwardRef)(
|
|
|
7480
7728
|
);
|
|
7481
7729
|
}
|
|
7482
7730
|
}
|
|
7483
|
-
if ((0,
|
|
7731
|
+
if ((0, import_type_guards19.isNotUndefined)(width)) {
|
|
7484
7732
|
if (fill === true || fill === "horizontal") {
|
|
7485
7733
|
throw new Error('Cannot use width prop with fill="horizontal" or fill={true}');
|
|
7486
7734
|
}
|
|
@@ -7522,7 +7770,7 @@ BoxComponent.displayName = "Box";
|
|
|
7522
7770
|
var Box = makePolymorphic(BoxComponent);
|
|
7523
7771
|
|
|
7524
7772
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
7525
|
-
var
|
|
7773
|
+
var import_react20 = require("react");
|
|
7526
7774
|
var import_styled_components26 = __toESM(require("styled-components"));
|
|
7527
7775
|
var import_jsx_runtime199 = require("react/jsx-runtime");
|
|
7528
7776
|
var StyledBreadcrumbs = import_styled_components26.default.nav`
|
|
@@ -7538,7 +7786,7 @@ var StyledBreadcrumbs = import_styled_components26.default.nav`
|
|
|
7538
7786
|
var BUFFER_WIDTH = 10;
|
|
7539
7787
|
var Breadcrumbs = ({ children, ...props }) => {
|
|
7540
7788
|
const { isXsAndDown } = useMq();
|
|
7541
|
-
let crumbs =
|
|
7789
|
+
let crumbs = import_react20.Children.toArray(children);
|
|
7542
7790
|
if (isXsAndDown) {
|
|
7543
7791
|
crumbs = crumbs.slice(-1);
|
|
7544
7792
|
}
|
|
@@ -7605,7 +7853,7 @@ var Breadcrumb = ({ icon, href, children, ...props }) => {
|
|
|
7605
7853
|
|
|
7606
7854
|
// src/components/ButtonGroup/ButtonGroup.tsx
|
|
7607
7855
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
7608
|
-
var
|
|
7856
|
+
var import_type_guards20 = require("@wistia/type-guards");
|
|
7609
7857
|
var import_jsx_runtime201 = require("react/jsx-runtime");
|
|
7610
7858
|
var getAlignment = (align) => {
|
|
7611
7859
|
if (align === "center") {
|
|
@@ -7651,7 +7899,7 @@ var ButtonGroup = ({
|
|
|
7651
7899
|
collapseOnSmallScreens = true,
|
|
7652
7900
|
...otherProps
|
|
7653
7901
|
}) => {
|
|
7654
|
-
if ((0,
|
|
7902
|
+
if ((0, import_type_guards20.isNil)(children)) {
|
|
7655
7903
|
return null;
|
|
7656
7904
|
}
|
|
7657
7905
|
return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
|
|
@@ -7725,7 +7973,7 @@ var Card = ({
|
|
|
7725
7973
|
Card.displayName = "Card";
|
|
7726
7974
|
|
|
7727
7975
|
// src/components/Center/Center.tsx
|
|
7728
|
-
var
|
|
7976
|
+
var import_react21 = require("react");
|
|
7729
7977
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
7730
7978
|
var import_jsx_runtime203 = require("react/jsx-runtime");
|
|
7731
7979
|
var StyledCenter = import_styled_components30.default.div`
|
|
@@ -7740,7 +7988,7 @@ var StyledCenter = import_styled_components30.default.div`
|
|
|
7740
7988
|
align-items: center;
|
|
7741
7989
|
`}
|
|
7742
7990
|
`;
|
|
7743
|
-
var Center = (0,
|
|
7991
|
+
var Center = (0, import_react21.forwardRef)(
|
|
7744
7992
|
({ maxWidth = "100%", gutterWidth = "space-00", intrinsic = false, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
|
|
7745
7993
|
StyledCenter,
|
|
7746
7994
|
{
|
|
@@ -7756,17 +8004,17 @@ var Center = (0, import_react20.forwardRef)(
|
|
|
7756
8004
|
Center.displayName = "Center";
|
|
7757
8005
|
|
|
7758
8006
|
// src/components/Checkbox/Checkbox.tsx
|
|
7759
|
-
var
|
|
8007
|
+
var import_react22 = require("react");
|
|
7760
8008
|
var import_styled_components34 = __toESM(require("styled-components"));
|
|
7761
|
-
var
|
|
8009
|
+
var import_type_guards24 = require("@wistia/type-guards");
|
|
7762
8010
|
|
|
7763
8011
|
// src/private/components/FormControlLabel/FormControlLabel.tsx
|
|
7764
8012
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
7765
|
-
var
|
|
8013
|
+
var import_type_guards23 = require("@wistia/type-guards");
|
|
7766
8014
|
|
|
7767
8015
|
// src/private/components/FormControlLabel/FormControlLabelDescription.tsx
|
|
7768
8016
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
7769
|
-
var
|
|
8017
|
+
var import_type_guards21 = require("@wistia/type-guards");
|
|
7770
8018
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
7771
8019
|
var disabledStyle = import_styled_components31.css`
|
|
7772
8020
|
color: var(--wui-color-text-disabled);
|
|
@@ -7786,7 +8034,7 @@ var FormControlLabelDescription = ({
|
|
|
7786
8034
|
disabled = false,
|
|
7787
8035
|
...props
|
|
7788
8036
|
}) => {
|
|
7789
|
-
if ((0,
|
|
8037
|
+
if ((0, import_type_guards21.isNil)(children)) {
|
|
7790
8038
|
return null;
|
|
7791
8039
|
}
|
|
7792
8040
|
return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
|
|
@@ -7802,7 +8050,7 @@ FormControlLabelDescription.displayName = "FormControlLabelDescription";
|
|
|
7802
8050
|
|
|
7803
8051
|
// src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
|
|
7804
8052
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
7805
|
-
var
|
|
8053
|
+
var import_type_guards22 = require("@wistia/type-guards");
|
|
7806
8054
|
var import_jsx_runtime205 = require("react/jsx-runtime");
|
|
7807
8055
|
var VisuallyHidden = import_styled_components32.default.div({ ...visuallyHiddenStyle });
|
|
7808
8056
|
var VisuallyHiddenButFocusable = import_styled_components32.default.div({
|
|
@@ -7814,7 +8062,7 @@ var ScreenReaderOnly = ({
|
|
|
7814
8062
|
focusable = false,
|
|
7815
8063
|
...otherProps
|
|
7816
8064
|
}) => {
|
|
7817
|
-
const accessibleText = (0,
|
|
8065
|
+
const accessibleText = (0, import_type_guards22.isNotNil)(text) ? text : children;
|
|
7818
8066
|
if (focusable) {
|
|
7819
8067
|
return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(VisuallyHiddenButFocusable, { ...otherProps, children: accessibleText });
|
|
7820
8068
|
}
|
|
@@ -7854,7 +8102,7 @@ var FormControlLabel = ({
|
|
|
7854
8102
|
hideLabel = false,
|
|
7855
8103
|
...props
|
|
7856
8104
|
}) => {
|
|
7857
|
-
if ((0,
|
|
8105
|
+
if ((0, import_type_guards23.isNil)(label)) {
|
|
7858
8106
|
return null;
|
|
7859
8107
|
}
|
|
7860
8108
|
const labelContent = hideLabel ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(ScreenReaderOnly, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(StyledLabelWrapper, { children: [
|
|
@@ -7868,7 +8116,7 @@ var FormControlLabel = ({
|
|
|
7868
8116
|
htmlFor,
|
|
7869
8117
|
...props,
|
|
7870
8118
|
children: [
|
|
7871
|
-
(0,
|
|
8119
|
+
(0, import_type_guards23.isNotNil)(controlSlot) ? controlSlot : null,
|
|
7872
8120
|
labelContent
|
|
7873
8121
|
]
|
|
7874
8122
|
}
|
|
@@ -7976,7 +8224,7 @@ var StyledHiddenCheckboxInput = import_styled_components34.default.input`
|
|
|
7976
8224
|
display: block;
|
|
7977
8225
|
}
|
|
7978
8226
|
`;
|
|
7979
|
-
var Checkbox = (0,
|
|
8227
|
+
var Checkbox = (0, import_react22.forwardRef)(
|
|
7980
8228
|
({
|
|
7981
8229
|
checked,
|
|
7982
8230
|
disabled = false,
|
|
@@ -7991,8 +8239,8 @@ var Checkbox = (0, import_react21.forwardRef)(
|
|
|
7991
8239
|
hideLabel = false,
|
|
7992
8240
|
...props
|
|
7993
8241
|
}, ref) => {
|
|
7994
|
-
const generatedId = (0,
|
|
7995
|
-
const computedId = (0,
|
|
8242
|
+
const generatedId = (0, import_react22.useId)();
|
|
8243
|
+
const computedId = (0, import_type_guards24.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-${generatedId}`;
|
|
7996
8244
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(StyledCheckboxWrapper, { disabled, children: [
|
|
7997
8245
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
7998
8246
|
StyledHiddenCheckboxInput,
|
|
@@ -8034,9 +8282,9 @@ var Checkbox = (0, import_react21.forwardRef)(
|
|
|
8034
8282
|
Checkbox.displayName = "Checkbox";
|
|
8035
8283
|
|
|
8036
8284
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
8037
|
-
var
|
|
8285
|
+
var import_react23 = require("react");
|
|
8038
8286
|
var ClickRegion = ({ children, targetRef }) => {
|
|
8039
|
-
(0,
|
|
8287
|
+
(0, import_react23.useEffect)(() => {
|
|
8040
8288
|
if (targetRef.current && targetRef.current.tagName === "A") {
|
|
8041
8289
|
targetRef.current.setAttribute("data-click-region-target-link", "");
|
|
8042
8290
|
} else if (targetRef.current && targetRef.current.tagName === "BUTTON") {
|
|
@@ -8044,7 +8292,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8044
8292
|
} else {
|
|
8045
8293
|
}
|
|
8046
8294
|
}, [targetRef]);
|
|
8047
|
-
const handleClick = (0,
|
|
8295
|
+
const handleClick = (0, import_react23.useCallback)(
|
|
8048
8296
|
(event) => {
|
|
8049
8297
|
const node = targetRef.current;
|
|
8050
8298
|
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")) {
|
|
@@ -8061,7 +8309,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8061
8309
|
},
|
|
8062
8310
|
[targetRef]
|
|
8063
8311
|
);
|
|
8064
|
-
return (0,
|
|
8312
|
+
return (0, import_react23.cloneElement)(import_react23.Children.only(children), {
|
|
8065
8313
|
"data-click-region": true,
|
|
8066
8314
|
onClick: handleClick
|
|
8067
8315
|
});
|
|
@@ -8070,7 +8318,7 @@ ClickRegion.displayName = "ClickRegion";
|
|
|
8070
8318
|
|
|
8071
8319
|
// src/components/Collapsible/Collapsible.tsx
|
|
8072
8320
|
var import_react_collapsible = require("@radix-ui/react-collapsible");
|
|
8073
|
-
var
|
|
8321
|
+
var import_type_guards25 = require("@wistia/type-guards");
|
|
8074
8322
|
var import_styled_components35 = __toESM(require("styled-components"));
|
|
8075
8323
|
var import_jsx_runtime208 = require("react/jsx-runtime");
|
|
8076
8324
|
var StyledRoot = (0, import_styled_components35.default)(import_react_collapsible.Root)`
|
|
@@ -8087,31 +8335,31 @@ var Collapsible = ({
|
|
|
8087
8335
|
onOpenChange
|
|
8088
8336
|
}) => {
|
|
8089
8337
|
const controlProps = {
|
|
8090
|
-
...(0,
|
|
8338
|
+
...(0, import_type_guards25.isNotNil)(onOpenChange) && (0, import_type_guards25.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
8091
8339
|
};
|
|
8092
8340
|
return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(StyledRoot, { ...controlProps, children });
|
|
8093
8341
|
};
|
|
8094
8342
|
Collapsible.displayName = "Collapsible";
|
|
8095
8343
|
|
|
8096
8344
|
// src/components/Collapsible/CollapsibleTrigger.tsx
|
|
8097
|
-
var
|
|
8345
|
+
var import_react24 = require("react");
|
|
8098
8346
|
var import_react_collapsible2 = require("@radix-ui/react-collapsible");
|
|
8099
8347
|
var import_jsx_runtime209 = require("react/jsx-runtime");
|
|
8100
8348
|
var CollapsibleTrigger = ({ children }) => {
|
|
8101
|
-
|
|
8349
|
+
import_react24.Children.only(children);
|
|
8102
8350
|
return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_react_collapsible2.Trigger, { asChild: true, children });
|
|
8103
8351
|
};
|
|
8104
8352
|
|
|
8105
8353
|
// src/components/Collapsible/CollapsibleContent.tsx
|
|
8106
8354
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
8107
8355
|
var import_react_collapsible3 = require("@radix-ui/react-collapsible");
|
|
8108
|
-
var
|
|
8356
|
+
var import_type_guards26 = require("@wistia/type-guards");
|
|
8109
8357
|
var import_jsx_runtime210 = require("react/jsx-runtime");
|
|
8110
8358
|
var ClampedContent = import_styled_components36.default.div.attrs({ "data-wui-collapsible-content": true })`
|
|
8111
8359
|
--wui-collapsible-content-clamp-lines: ${({ $clamp }) => $clamp};
|
|
8112
8360
|
`;
|
|
8113
8361
|
var CollapsibleContent = ({ clamp, children }) => {
|
|
8114
|
-
if ((0,
|
|
8362
|
+
if ((0, import_type_guards26.isNotUndefined)(clamp)) {
|
|
8115
8363
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(ClampedContent, { $clamp: clamp, children });
|
|
8116
8364
|
}
|
|
8117
8365
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(import_react_collapsible3.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(import_jsx_runtime210.Fragment, { children: [
|
|
@@ -8122,10 +8370,10 @@ var CollapsibleContent = ({ clamp, children }) => {
|
|
|
8122
8370
|
|
|
8123
8371
|
// src/components/DataCards/DataCard.tsx
|
|
8124
8372
|
var import_styled_components38 = __toESM(require("styled-components"));
|
|
8125
|
-
var
|
|
8373
|
+
var import_type_guards27 = require("@wistia/type-guards");
|
|
8126
8374
|
|
|
8127
8375
|
// src/components/Heading/Heading.tsx
|
|
8128
|
-
var
|
|
8376
|
+
var import_react25 = require("react");
|
|
8129
8377
|
var import_styled_components37 = __toESM(require("styled-components"));
|
|
8130
8378
|
var import_jsx_runtime211 = require("react/jsx-runtime");
|
|
8131
8379
|
var heroStyle = import_styled_components37.css`
|
|
@@ -8212,7 +8460,7 @@ var variantElementMap = {
|
|
|
8212
8460
|
heading5: "h5",
|
|
8213
8461
|
heading6: "h6"
|
|
8214
8462
|
};
|
|
8215
|
-
var HeadingComponent = (0,
|
|
8463
|
+
var HeadingComponent = (0, import_react25.forwardRef)(
|
|
8216
8464
|
({
|
|
8217
8465
|
align = "left",
|
|
8218
8466
|
colorScheme = "inherit",
|
|
@@ -8331,8 +8579,8 @@ var DataCard = ({
|
|
|
8331
8579
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledLoadingValue, {}) : value
|
|
8332
8580
|
}
|
|
8333
8581
|
),
|
|
8334
|
-
(0,
|
|
8335
|
-
(0,
|
|
8582
|
+
(0, import_type_guards27.isNotNull)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledSlot, { children: upperRightSlot }),
|
|
8583
|
+
(0, import_type_guards27.isNotNull)(trend) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledDataCardTrendContainer, { children: trend })
|
|
8336
8584
|
]
|
|
8337
8585
|
}
|
|
8338
8586
|
);
|
|
@@ -8376,7 +8624,7 @@ DataCards.displayName = "DataCards";
|
|
|
8376
8624
|
var import_styled_components41 = __toESM(require("styled-components"));
|
|
8377
8625
|
|
|
8378
8626
|
// src/components/Text/Text.tsx
|
|
8379
|
-
var
|
|
8627
|
+
var import_react26 = require("react");
|
|
8380
8628
|
var import_styled_components40 = __toESM(require("styled-components"));
|
|
8381
8629
|
var import_jsx_runtime214 = require("react/jsx-runtime");
|
|
8382
8630
|
var bodyBoldStyles = import_styled_components40.css`
|
|
@@ -8542,7 +8790,7 @@ var StyledText = import_styled_components40.default.div`
|
|
|
8542
8790
|
}
|
|
8543
8791
|
`}
|
|
8544
8792
|
`;
|
|
8545
|
-
var TextComponent = (0,
|
|
8793
|
+
var TextComponent = (0, import_react26.forwardRef)(
|
|
8546
8794
|
({
|
|
8547
8795
|
align = "left",
|
|
8548
8796
|
colorScheme = "inherit",
|
|
@@ -8658,7 +8906,7 @@ Divider.displayName = "Divider";
|
|
|
8658
8906
|
|
|
8659
8907
|
// src/components/EditableHeading/EditableHeading.tsx
|
|
8660
8908
|
var import_styled_components45 = __toESM(require("styled-components"));
|
|
8661
|
-
var
|
|
8909
|
+
var import_react28 = require("react");
|
|
8662
8910
|
|
|
8663
8911
|
// src/components/Tooltip/Tooltip.tsx
|
|
8664
8912
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
@@ -8767,9 +9015,9 @@ var Tooltip = ({
|
|
|
8767
9015
|
Tooltip.displayName = "Tooltip";
|
|
8768
9016
|
|
|
8769
9017
|
// src/components/Input/Input.tsx
|
|
8770
|
-
var
|
|
9018
|
+
var import_react27 = require("react");
|
|
8771
9019
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
8772
|
-
var
|
|
9020
|
+
var import_type_guards28 = require("@wistia/type-guards");
|
|
8773
9021
|
var import_jsx_runtime218 = require("react/jsx-runtime");
|
|
8774
9022
|
var inputStyles = import_styled_components44.css`
|
|
8775
9023
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -8856,7 +9104,7 @@ var StyledInputContainer = import_styled_components44.default.div`
|
|
|
8856
9104
|
padding-right: 32px;
|
|
8857
9105
|
}
|
|
8858
9106
|
`;
|
|
8859
|
-
var Input = (0,
|
|
9107
|
+
var Input = (0, import_react27.forwardRef)(
|
|
8860
9108
|
({
|
|
8861
9109
|
fullWidth = true,
|
|
8862
9110
|
monospace = false,
|
|
@@ -8866,30 +9114,30 @@ var Input = (0, import_react26.forwardRef)(
|
|
|
8866
9114
|
rightIcon,
|
|
8867
9115
|
...props
|
|
8868
9116
|
}, externalRef) => {
|
|
8869
|
-
const internalRef = (0,
|
|
9117
|
+
const internalRef = (0, import_react27.useRef)();
|
|
8870
9118
|
const ref = (
|
|
8871
9119
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
8872
|
-
(0,
|
|
9120
|
+
(0, import_type_guards28.isNotNil)(externalRef) && (0, import_type_guards28.isRecord)(externalRef) && "current" in externalRef ? externalRef : internalRef
|
|
8873
9121
|
);
|
|
8874
9122
|
let leftIconToDisplay = leftIcon;
|
|
8875
|
-
if ((0,
|
|
9123
|
+
if ((0, import_type_guards28.isNil)(leftIcon) && type === "search") {
|
|
8876
9124
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(Icon, { type: "search" });
|
|
8877
9125
|
}
|
|
8878
|
-
if ((0,
|
|
8879
|
-
leftIconToDisplay = (0,
|
|
9126
|
+
if ((0, import_type_guards28.isNotNil)(leftIconToDisplay)) {
|
|
9127
|
+
leftIconToDisplay = (0, import_react27.cloneElement)(leftIconToDisplay, {
|
|
8880
9128
|
size: "md",
|
|
8881
9129
|
className: "wui-input-left-icon"
|
|
8882
9130
|
});
|
|
8883
9131
|
}
|
|
8884
9132
|
let rightIconToDisplay = rightIcon;
|
|
8885
|
-
if ((0,
|
|
8886
|
-
rightIconToDisplay = (0,
|
|
9133
|
+
if ((0, import_type_guards28.isNotNil)(rightIconToDisplay)) {
|
|
9134
|
+
rightIconToDisplay = (0, import_react27.cloneElement)(rightIconToDisplay, {
|
|
8887
9135
|
size: "md",
|
|
8888
9136
|
className: "wui-input-right-icon"
|
|
8889
9137
|
});
|
|
8890
9138
|
}
|
|
8891
|
-
const
|
|
8892
|
-
if ((0,
|
|
9139
|
+
const handleFocus2 = (event) => {
|
|
9140
|
+
if ((0, import_type_guards28.isNotNil)(props.onFocus)) {
|
|
8893
9141
|
props.onFocus(event);
|
|
8894
9142
|
}
|
|
8895
9143
|
if (autoSelect && isValidRef(ref) && "current" in ref) {
|
|
@@ -8910,14 +9158,14 @@ var Input = (0, import_react26.forwardRef)(
|
|
|
8910
9158
|
{
|
|
8911
9159
|
...props,
|
|
8912
9160
|
ref,
|
|
8913
|
-
onFocus:
|
|
9161
|
+
onFocus: handleFocus2
|
|
8914
9162
|
}
|
|
8915
9163
|
) : /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
|
|
8916
9164
|
"input",
|
|
8917
9165
|
{
|
|
8918
9166
|
...props,
|
|
8919
9167
|
ref,
|
|
8920
|
-
onFocus:
|
|
9168
|
+
onFocus: handleFocus2,
|
|
8921
9169
|
type
|
|
8922
9170
|
}
|
|
8923
9171
|
),
|
|
@@ -8978,11 +9226,11 @@ var EditableHeading = ({
|
|
|
8978
9226
|
forceEditing = false,
|
|
8979
9227
|
editingDisabled = false
|
|
8980
9228
|
}) => {
|
|
8981
|
-
const [isEditing, setIsEditing] = (0,
|
|
8982
|
-
const [value, setValue] = (0,
|
|
8983
|
-
const [previousValue, setPreviousValue] = (0,
|
|
8984
|
-
const [headingHeight, setHeadingHeight] = (0,
|
|
8985
|
-
const headingRef = (0,
|
|
9229
|
+
const [isEditing, setIsEditing] = (0, import_react28.useState)(false);
|
|
9230
|
+
const [value, setValue] = (0, import_react28.useState)(children);
|
|
9231
|
+
const [previousValue, setPreviousValue] = (0, import_react28.useState)(children);
|
|
9232
|
+
const [headingHeight, setHeadingHeight] = (0, import_react28.useState)("60");
|
|
9233
|
+
const headingRef = (0, import_react28.useRef)(null);
|
|
8986
9234
|
const handleSetEditing = (editing) => {
|
|
8987
9235
|
if (editingDisabled) return;
|
|
8988
9236
|
if (editing && headingRef.current) {
|
|
@@ -9068,12 +9316,12 @@ var EditableHeading = ({
|
|
|
9068
9316
|
};
|
|
9069
9317
|
|
|
9070
9318
|
// src/components/Form/Form.tsx
|
|
9071
|
-
var
|
|
9319
|
+
var import_react30 = require("react");
|
|
9072
9320
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
9073
|
-
var
|
|
9321
|
+
var import_type_guards29 = require("@wistia/type-guards");
|
|
9074
9322
|
|
|
9075
9323
|
// src/components/Stack/Stack.tsx
|
|
9076
|
-
var
|
|
9324
|
+
var import_react29 = require("react");
|
|
9077
9325
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
9078
9326
|
var import_jsx_runtime220 = require("react/jsx-runtime");
|
|
9079
9327
|
var DEFAULT_ELEMENT4 = "div";
|
|
@@ -9083,7 +9331,7 @@ var StyledStack = import_styled_components46.default.div`
|
|
|
9083
9331
|
gap: ${({ $gap }) => `var(--wui-${$gap})`};
|
|
9084
9332
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
9085
9333
|
`;
|
|
9086
|
-
var StackComponent = (0,
|
|
9334
|
+
var StackComponent = (0, import_react29.forwardRef)(
|
|
9087
9335
|
({ renderAs, direction = "vertical", gap = "space-02", alignItems = "stretch", ...props }, ref) => {
|
|
9088
9336
|
const responsiveGap = useResponsiveProp(gap);
|
|
9089
9337
|
const responsiveDirection = useResponsiveProp(direction);
|
|
@@ -9112,7 +9360,7 @@ var StyledForm = import_styled_components47.default.form`
|
|
|
9112
9360
|
max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
|
|
9113
9361
|
align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
|
|
9114
9362
|
`;
|
|
9115
|
-
var FormContext = (0,
|
|
9363
|
+
var FormContext = (0, import_react30.createContext)({
|
|
9116
9364
|
values: {},
|
|
9117
9365
|
errors: {},
|
|
9118
9366
|
hasSubmitted: false,
|
|
@@ -9128,25 +9376,25 @@ var FormComponent = ({
|
|
|
9128
9376
|
fullWidth = false,
|
|
9129
9377
|
...props
|
|
9130
9378
|
}, forwardedRef) => {
|
|
9131
|
-
const [errors, setErrors] = (0,
|
|
9132
|
-
const [hasSubmitted, setHasSubmitted] = (0,
|
|
9133
|
-
const innerRef = (0,
|
|
9379
|
+
const [errors, setErrors] = (0, import_react30.useState)({});
|
|
9380
|
+
const [hasSubmitted, setHasSubmitted] = (0, import_react30.useState)(false);
|
|
9381
|
+
const innerRef = (0, import_react30.useRef)();
|
|
9134
9382
|
const ref = forwardedRef ?? innerRef;
|
|
9135
|
-
const autoId = (0,
|
|
9383
|
+
const autoId = (0, import_react30.useId)();
|
|
9136
9384
|
const id = props.id ?? autoId;
|
|
9137
9385
|
const handleValidate = (nextFormData) => {
|
|
9138
9386
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
9139
|
-
if ((0,
|
|
9387
|
+
if ((0, import_type_guards29.isUndefined)(validate)) {
|
|
9140
9388
|
return {};
|
|
9141
9389
|
}
|
|
9142
9390
|
return validate(nextData);
|
|
9143
9391
|
};
|
|
9144
|
-
const
|
|
9392
|
+
const handleBlur2 = (event) => {
|
|
9145
9393
|
if (props.onBlur) {
|
|
9146
9394
|
props.onBlur(event);
|
|
9147
9395
|
}
|
|
9148
9396
|
const formData = new FormData(event.currentTarget);
|
|
9149
|
-
if ((0,
|
|
9397
|
+
if ((0, import_type_guards29.isNotUndefined)(validate)) {
|
|
9150
9398
|
handleValidate(formData);
|
|
9151
9399
|
}
|
|
9152
9400
|
};
|
|
@@ -9174,7 +9422,7 @@ var FormComponent = ({
|
|
|
9174
9422
|
void action(null);
|
|
9175
9423
|
}
|
|
9176
9424
|
};
|
|
9177
|
-
const context = (0,
|
|
9425
|
+
const context = (0, import_react30.useMemo)(() => {
|
|
9178
9426
|
return {
|
|
9179
9427
|
values,
|
|
9180
9428
|
errors,
|
|
@@ -9194,7 +9442,7 @@ var FormComponent = ({
|
|
|
9194
9442
|
as: StyledForm,
|
|
9195
9443
|
gap: "space-05",
|
|
9196
9444
|
id,
|
|
9197
|
-
onBlur:
|
|
9445
|
+
onBlur: handleBlur2,
|
|
9198
9446
|
onReset: handleReset,
|
|
9199
9447
|
onSubmit: handleSubmit,
|
|
9200
9448
|
children
|
|
@@ -9203,15 +9451,15 @@ var FormComponent = ({
|
|
|
9203
9451
|
);
|
|
9204
9452
|
};
|
|
9205
9453
|
FormComponent.displayName = "Form";
|
|
9206
|
-
var Form = (0,
|
|
9454
|
+
var Form = (0, import_react30.forwardRef)(FormComponent);
|
|
9207
9455
|
|
|
9208
9456
|
// src/components/Form/useFormState.tsx
|
|
9209
|
-
var
|
|
9457
|
+
var import_react31 = require("react");
|
|
9210
9458
|
var useFormState = (action, initialData = {}) => {
|
|
9211
|
-
const [data, setData] = (0,
|
|
9212
|
-
const [isPending, setIsPending] = (0,
|
|
9213
|
-
const [error, setError] = (0,
|
|
9214
|
-
const formAction = (0,
|
|
9459
|
+
const [data, setData] = (0, import_react31.useState)(initialData);
|
|
9460
|
+
const [isPending, setIsPending] = (0, import_react31.useState)(false);
|
|
9461
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
9462
|
+
const formAction = (0, import_react31.useCallback)(
|
|
9215
9463
|
async (nextFormData) => {
|
|
9216
9464
|
if (nextFormData === null) {
|
|
9217
9465
|
setData(initialData);
|
|
@@ -9242,23 +9490,23 @@ var useFormState = (action, initialData = {}) => {
|
|
|
9242
9490
|
};
|
|
9243
9491
|
|
|
9244
9492
|
// src/components/Form/FormErrorSummary.tsx
|
|
9245
|
-
var
|
|
9246
|
-
var
|
|
9493
|
+
var import_react32 = require("react");
|
|
9494
|
+
var import_type_guards30 = require("@wistia/type-guards");
|
|
9247
9495
|
var import_jsx_runtime222 = require("react/jsx-runtime");
|
|
9248
9496
|
var ErrorItem = ({ name, error, formId }) => {
|
|
9249
9497
|
return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(Link, { href: `#${formId}-${name}`, children: error }) }, name);
|
|
9250
9498
|
};
|
|
9251
9499
|
var FormErrorSummary = ({ description }) => {
|
|
9252
|
-
const ref = (0,
|
|
9253
|
-
const { formId, errors, hasSubmitted } = (0,
|
|
9500
|
+
const ref = (0, import_react32.useRef)(null);
|
|
9501
|
+
const { formId, errors, hasSubmitted } = (0, import_react32.useContext)(FormContext);
|
|
9254
9502
|
const isValid = Object.keys(errors).length === 0;
|
|
9255
9503
|
if (isValid || !hasSubmitted) {
|
|
9256
9504
|
return null;
|
|
9257
9505
|
}
|
|
9258
9506
|
return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { ref, children: [
|
|
9259
9507
|
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { children: description }),
|
|
9260
|
-
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0,
|
|
9261
|
-
([name, error]) => (0,
|
|
9508
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0, import_type_guards30.isNotUndefined)(error)).map(
|
|
9509
|
+
([name, error]) => (0, import_type_guards30.isArray)(error) ? error.map((err) => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
9262
9510
|
ErrorItem,
|
|
9263
9511
|
{
|
|
9264
9512
|
error: err,
|
|
@@ -9280,9 +9528,9 @@ var FormErrorSummary = ({ description }) => {
|
|
|
9280
9528
|
};
|
|
9281
9529
|
|
|
9282
9530
|
// src/components/FormField/FormField.tsx
|
|
9283
|
-
var
|
|
9531
|
+
var import_react35 = require("react");
|
|
9284
9532
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
9285
|
-
var
|
|
9533
|
+
var import_type_guards31 = require("@wistia/type-guards");
|
|
9286
9534
|
|
|
9287
9535
|
// src/components/Label/Label.tsx
|
|
9288
9536
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
@@ -9345,11 +9593,11 @@ var Label = ({
|
|
|
9345
9593
|
Label.displayName = "Label";
|
|
9346
9594
|
|
|
9347
9595
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9348
|
-
var
|
|
9596
|
+
var import_react34 = require("react");
|
|
9349
9597
|
|
|
9350
9598
|
// src/components/FormGroup/FormGroup.tsx
|
|
9351
9599
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
9352
|
-
var
|
|
9600
|
+
var import_react33 = require("react");
|
|
9353
9601
|
var import_jsx_runtime224 = require("react/jsx-runtime");
|
|
9354
9602
|
var StyledFieldset = import_styled_components49.default.fieldset`
|
|
9355
9603
|
border: 0;
|
|
@@ -9358,7 +9606,7 @@ var StyledLegend = import_styled_components49.default.legend`
|
|
|
9358
9606
|
margin-bottom: var(--space-01);
|
|
9359
9607
|
`;
|
|
9360
9608
|
var FormGroup = ({ children, label, ...props }) => {
|
|
9361
|
-
const ref = (0,
|
|
9609
|
+
const ref = (0, import_react33.useRef)();
|
|
9362
9610
|
return /* @__PURE__ */ (0, import_jsx_runtime224.jsxs)(
|
|
9363
9611
|
Stack,
|
|
9364
9612
|
{
|
|
@@ -9383,7 +9631,7 @@ FormGroup.displayName = "FormGroup";
|
|
|
9383
9631
|
|
|
9384
9632
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9385
9633
|
var import_jsx_runtime225 = require("react/jsx-runtime");
|
|
9386
|
-
var CheckboxGroupContext = (0,
|
|
9634
|
+
var CheckboxGroupContext = (0, import_react34.createContext)(null);
|
|
9387
9635
|
var CheckboxGroup = ({
|
|
9388
9636
|
children,
|
|
9389
9637
|
name,
|
|
@@ -9391,7 +9639,7 @@ var CheckboxGroup = ({
|
|
|
9391
9639
|
value,
|
|
9392
9640
|
...props
|
|
9393
9641
|
}) => {
|
|
9394
|
-
const context = (0,
|
|
9642
|
+
const context = (0, import_react34.useMemo)(() => {
|
|
9395
9643
|
return {
|
|
9396
9644
|
name,
|
|
9397
9645
|
onChange
|
|
@@ -9442,7 +9690,7 @@ var StyledErrorList = import_styled_components50.default.ul`
|
|
|
9442
9690
|
gap: var(--wui-space-01);
|
|
9443
9691
|
`;
|
|
9444
9692
|
var ErrorMessages = ({ errors, id }) => {
|
|
9445
|
-
const isMultipleErrors = (0,
|
|
9693
|
+
const isMultipleErrors = (0, import_type_guards31.isArray)(errors);
|
|
9446
9694
|
return isMultipleErrors ? /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(StyledErrorList, { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
|
|
9447
9695
|
Text,
|
|
9448
9696
|
{
|
|
@@ -9476,8 +9724,8 @@ var FormField = ({
|
|
|
9476
9724
|
value,
|
|
9477
9725
|
...props
|
|
9478
9726
|
}) => {
|
|
9479
|
-
const formState = (0,
|
|
9480
|
-
const checkboxGroup = (0,
|
|
9727
|
+
const formState = (0, import_react35.useContext)(FormContext);
|
|
9728
|
+
const checkboxGroup = (0, import_react35.useContext)(CheckboxGroupContext);
|
|
9481
9729
|
const defaultValue = formState.values[name];
|
|
9482
9730
|
const isIntegratedLabel = children.type === Checkbox;
|
|
9483
9731
|
const computedId = id ?? `${formState.formId}-${name}`;
|
|
@@ -9492,19 +9740,19 @@ var FormField = ({
|
|
|
9492
9740
|
"aria-describedby": ariaDescribedby,
|
|
9493
9741
|
...props
|
|
9494
9742
|
};
|
|
9495
|
-
if ((0,
|
|
9743
|
+
if ((0, import_type_guards31.isUndefined)(value) && (0, import_type_guards31.isNotUndefined)(defaultValue)) {
|
|
9496
9744
|
childProps = {
|
|
9497
9745
|
...childProps,
|
|
9498
9746
|
defaultValue
|
|
9499
9747
|
};
|
|
9500
9748
|
}
|
|
9501
|
-
if ((0,
|
|
9502
|
-
const computedName = (0,
|
|
9749
|
+
if ((0, import_type_guards31.isNotNil)(checkboxGroup)) {
|
|
9750
|
+
const computedName = (0, import_type_guards31.isNotNil)(checkboxGroup.name) ? `${checkboxGroup.name}[${name}]` : name;
|
|
9503
9751
|
const handleChange = (event) => {
|
|
9504
|
-
if ((0,
|
|
9752
|
+
if ((0, import_type_guards31.isNotUndefined)(props.onChange)) {
|
|
9505
9753
|
props.onChange(event);
|
|
9506
9754
|
}
|
|
9507
|
-
if ((0,
|
|
9755
|
+
if ((0, import_type_guards31.isNotUndefined)(checkboxGroup.onChange)) {
|
|
9508
9756
|
checkboxGroup.onChange(event);
|
|
9509
9757
|
}
|
|
9510
9758
|
};
|
|
@@ -9512,10 +9760,10 @@ var FormField = ({
|
|
|
9512
9760
|
...childProps,
|
|
9513
9761
|
name: computedName,
|
|
9514
9762
|
onChange: handleChange,
|
|
9515
|
-
"aria-invalid": (0,
|
|
9763
|
+
"aria-invalid": (0, import_type_guards31.isNotNil)(error)
|
|
9516
9764
|
};
|
|
9517
9765
|
}
|
|
9518
|
-
|
|
9766
|
+
import_react35.Children.only(children);
|
|
9519
9767
|
return /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(
|
|
9520
9768
|
StyledFormField,
|
|
9521
9769
|
{
|
|
@@ -9523,9 +9771,9 @@ var FormField = ({
|
|
|
9523
9771
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
9524
9772
|
children: [
|
|
9525
9773
|
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(Label, { htmlFor: computedId, children: label }),
|
|
9526
|
-
(0,
|
|
9527
|
-
(0,
|
|
9528
|
-
(0,
|
|
9774
|
+
(0, import_type_guards31.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
9775
|
+
(0, import_react35.cloneElement)(children, childProps),
|
|
9776
|
+
(0, import_type_guards31.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(import_jsx_runtime226.Fragment, { children: [
|
|
9529
9777
|
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)("div", {}),
|
|
9530
9778
|
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
|
|
9531
9779
|
ErrorMessages,
|
|
@@ -9542,9 +9790,9 @@ var FormField = ({
|
|
|
9542
9790
|
FormField.displayName = "FormField";
|
|
9543
9791
|
|
|
9544
9792
|
// src/components/FormGroup/RadioGroup.tsx
|
|
9545
|
-
var
|
|
9793
|
+
var import_react36 = require("react");
|
|
9546
9794
|
var import_jsx_runtime227 = require("react/jsx-runtime");
|
|
9547
|
-
var RadioGroupContext = (0,
|
|
9795
|
+
var RadioGroupContext = (0, import_react36.createContext)(null);
|
|
9548
9796
|
var RadioGroup = ({
|
|
9549
9797
|
children,
|
|
9550
9798
|
name,
|
|
@@ -9552,7 +9800,7 @@ var RadioGroup = ({
|
|
|
9552
9800
|
value,
|
|
9553
9801
|
...props
|
|
9554
9802
|
}) => {
|
|
9555
|
-
const context = (0,
|
|
9803
|
+
const context = (0, import_react36.useMemo)(() => {
|
|
9556
9804
|
return {
|
|
9557
9805
|
name,
|
|
9558
9806
|
onChange
|
|
@@ -9563,7 +9811,7 @@ var RadioGroup = ({
|
|
|
9563
9811
|
RadioGroup.displayName = "RadioGroup";
|
|
9564
9812
|
|
|
9565
9813
|
// src/components/IconButton/IconButton.tsx
|
|
9566
|
-
var
|
|
9814
|
+
var import_react37 = require("react");
|
|
9567
9815
|
var import_styled_components51 = __toESM(require("styled-components"));
|
|
9568
9816
|
var import_jsx_runtime228 = require("react/jsx-runtime");
|
|
9569
9817
|
var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
@@ -9580,7 +9828,7 @@ var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
|
9580
9828
|
align-items: center;
|
|
9581
9829
|
line-height: 1;
|
|
9582
9830
|
`;
|
|
9583
|
-
var IconButton = (0,
|
|
9831
|
+
var IconButton = (0, import_react37.forwardRef)(
|
|
9584
9832
|
({ children, label, size = "md", ...props }, ref) => {
|
|
9585
9833
|
const responsiveSize = useResponsiveProp(size);
|
|
9586
9834
|
return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
@@ -9591,7 +9839,7 @@ var IconButton = (0, import_react36.forwardRef)(
|
|
|
9591
9839
|
"aria-label": label,
|
|
9592
9840
|
"data-wistia-ui-icon-button": true,
|
|
9593
9841
|
size: responsiveSize,
|
|
9594
|
-
children: (0,
|
|
9842
|
+
children: (0, import_react37.cloneElement)(import_react37.Children.only(children), {
|
|
9595
9843
|
size: responsiveSize
|
|
9596
9844
|
})
|
|
9597
9845
|
}
|
|
@@ -9602,7 +9850,7 @@ IconButton.displayName = "IconButton";
|
|
|
9602
9850
|
|
|
9603
9851
|
// src/components/Image/Image.tsx
|
|
9604
9852
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
9605
|
-
var
|
|
9853
|
+
var import_type_guards32 = require("@wistia/type-guards");
|
|
9606
9854
|
var import_jsx_runtime229 = require("react/jsx-runtime");
|
|
9607
9855
|
var getFillStyle2 = (fillContainer) => {
|
|
9608
9856
|
if (fillContainer === "horizontal") {
|
|
@@ -9620,7 +9868,7 @@ var getFillStyle2 = (fillContainer) => {
|
|
|
9620
9868
|
return void 0;
|
|
9621
9869
|
};
|
|
9622
9870
|
var StyledImage = import_styled_components52.default.img`
|
|
9623
|
-
border-radius: ${({ $borderRadius }) => (0,
|
|
9871
|
+
border-radius: ${({ $borderRadius }) => (0, import_type_guards32.isNotNil)($borderRadius) ? `var(--wui-${$borderRadius})` : void 0};
|
|
9624
9872
|
${({ $fillContainer }) => getFillStyle2($fillContainer)};
|
|
9625
9873
|
object-fit: ${({ $objFit }) => $objFit};
|
|
9626
9874
|
object-position: ${({ $objPosition }) => $objPosition};
|
|
@@ -9652,13 +9900,13 @@ Image.displayName = "Image";
|
|
|
9652
9900
|
// src/components/Menu/Menu.tsx
|
|
9653
9901
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
9654
9902
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
9655
|
-
var
|
|
9656
|
-
var
|
|
9903
|
+
var import_type_guards33 = require("@wistia/type-guards");
|
|
9904
|
+
var import_react39 = require("react");
|
|
9657
9905
|
|
|
9658
9906
|
// src/components/Menu/MenuContext.tsx
|
|
9659
|
-
var
|
|
9660
|
-
var MenuContext = (0,
|
|
9661
|
-
var useMenuContext = () => (0,
|
|
9907
|
+
var import_react38 = require("react");
|
|
9908
|
+
var MenuContext = (0, import_react38.createContext)({ compact: false });
|
|
9909
|
+
var useMenuContext = () => (0, import_react38.useContext)(MenuContext);
|
|
9662
9910
|
|
|
9663
9911
|
// src/components/Menu/Menu.tsx
|
|
9664
9912
|
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
@@ -9762,9 +10010,9 @@ var Menu = ({
|
|
|
9762
10010
|
onInteractOutside,
|
|
9763
10011
|
...props
|
|
9764
10012
|
}) => {
|
|
9765
|
-
const contextValue = (0,
|
|
10013
|
+
const contextValue = (0, import_react39.useMemo)(() => ({ compact }), [compact]);
|
|
9766
10014
|
let controlProps = {
|
|
9767
|
-
...(0,
|
|
10015
|
+
...(0, import_type_guards33.isNotNil)(onOpenChange) && (0, import_type_guards33.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
9768
10016
|
};
|
|
9769
10017
|
if (disabled) {
|
|
9770
10018
|
controlProps = {
|
|
@@ -9778,7 +10026,7 @@ var Menu = ({
|
|
|
9778
10026
|
modal: false,
|
|
9779
10027
|
...controlProps,
|
|
9780
10028
|
children: [
|
|
9781
|
-
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0,
|
|
10029
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0, import_type_guards33.isNotUndefined)(trigger) ? trigger : /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
9782
10030
|
Button,
|
|
9783
10031
|
{
|
|
9784
10032
|
"aria-expanded": isOpen,
|
|
@@ -9836,15 +10084,15 @@ var MenuLabel = ({ children, ...props }) => {
|
|
|
9836
10084
|
MenuLabel.displayName = "MenuLabel";
|
|
9837
10085
|
|
|
9838
10086
|
// src/components/Menu/SubMenu.tsx
|
|
9839
|
-
var
|
|
10087
|
+
var import_react41 = require("react");
|
|
9840
10088
|
var import_styled_components57 = __toESM(require("styled-components"));
|
|
9841
10089
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
9842
|
-
var
|
|
10090
|
+
var import_type_guards35 = require("@wistia/type-guards");
|
|
9843
10091
|
|
|
9844
10092
|
// src/components/Menu/MenuItemButton.tsx
|
|
9845
|
-
var
|
|
10093
|
+
var import_react40 = require("react");
|
|
9846
10094
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
9847
|
-
var
|
|
10095
|
+
var import_type_guards34 = require("@wistia/type-guards");
|
|
9848
10096
|
var import_jsx_runtime232 = require("react/jsx-runtime");
|
|
9849
10097
|
var StyledButton3 = (0, import_styled_components55.default)(Button)`
|
|
9850
10098
|
${({ colorScheme }) => getColorScheme(colorScheme)};
|
|
@@ -9919,10 +10167,10 @@ var StyledBadgeContainer = import_styled_components55.default.div`
|
|
|
9919
10167
|
font-size: var(--wui-typography-label-4-size);
|
|
9920
10168
|
color: var(--wui-color-text-secondary);
|
|
9921
10169
|
`;
|
|
9922
|
-
var MenuItemButton = (0,
|
|
10170
|
+
var MenuItemButton = (0, import_react40.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
9923
10171
|
let { colorScheme, badge } = props;
|
|
9924
10172
|
if (appearance === "dangerous") {
|
|
9925
|
-
if ((0,
|
|
10173
|
+
if ((0, import_type_guards34.isNotUndefined)(colorScheme)) {
|
|
9926
10174
|
console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
9927
10175
|
}
|
|
9928
10176
|
colorScheme = "error";
|
|
@@ -9952,7 +10200,7 @@ var MenuItemButton = (0, import_react39.forwardRef)(({ children, appearance, com
|
|
|
9952
10200
|
children: [
|
|
9953
10201
|
props.leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
9954
10202
|
/* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledLabelAndDescriptionContainer, { children }),
|
|
9955
|
-
(0,
|
|
10203
|
+
(0, import_type_guards34.isNotNil)(badge) || (0, import_type_guards34.isNotNil)(command) ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledBadgeContainer, { children: badge ?? command }) : null,
|
|
9956
10204
|
props.rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
9957
10205
|
]
|
|
9958
10206
|
}
|
|
@@ -10015,12 +10263,12 @@ var SubMenu = ({
|
|
|
10015
10263
|
...props
|
|
10016
10264
|
}) => {
|
|
10017
10265
|
const { isSmAndUp } = useMq();
|
|
10018
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
10266
|
+
const [isExpanded, setIsExpanded] = (0, import_react41.useState)(false);
|
|
10019
10267
|
const { compact } = useMenuContext();
|
|
10020
10268
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
10021
10269
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
10022
10270
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(MenuItemLabel, { children: label }),
|
|
10023
|
-
(0,
|
|
10271
|
+
(0, import_type_guards35.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(MenuItemDescription, { children: description }) : null
|
|
10024
10272
|
] }),
|
|
10025
10273
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(import_react_dropdown_menu3.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(SubMenuContent, { $compact: compact, children }) })
|
|
10026
10274
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(import_react_dropdown_menu3.DropdownMenuGroup, { children: [
|
|
@@ -10044,10 +10292,10 @@ var SubMenu = ({
|
|
|
10044
10292
|
SubMenu.displayName = "SubMenu";
|
|
10045
10293
|
|
|
10046
10294
|
// src/components/Menu/MenuItem.tsx
|
|
10047
|
-
var
|
|
10295
|
+
var import_react42 = require("react");
|
|
10048
10296
|
var import_react_dropdown_menu4 = require("@radix-ui/react-dropdown-menu");
|
|
10049
10297
|
var import_jsx_runtime235 = require("react/jsx-runtime");
|
|
10050
|
-
var MenuItem = (0,
|
|
10298
|
+
var MenuItem = (0, import_react42.forwardRef)(
|
|
10051
10299
|
({ onSelect = () => null, ...props }, ref) => {
|
|
10052
10300
|
return /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
10053
10301
|
import_react_dropdown_menu4.DropdownMenuItem,
|
|
@@ -10197,10 +10445,10 @@ var CheckboxMenuItem = ({
|
|
|
10197
10445
|
CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
10198
10446
|
|
|
10199
10447
|
// src/components/Modal/Modal.tsx
|
|
10200
|
-
var
|
|
10448
|
+
var import_react46 = require("react");
|
|
10201
10449
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
10202
10450
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
10203
|
-
var
|
|
10451
|
+
var import_type_guards37 = require("@wistia/type-guards");
|
|
10204
10452
|
|
|
10205
10453
|
// src/components/Modal/ModalHeader.tsx
|
|
10206
10454
|
var import_styled_components59 = __toESM(require("styled-components"));
|
|
@@ -10257,21 +10505,21 @@ var ModalHeader = ({
|
|
|
10257
10505
|
};
|
|
10258
10506
|
|
|
10259
10507
|
// src/components/Modal/ModalContent.tsx
|
|
10260
|
-
var
|
|
10508
|
+
var import_react44 = require("react");
|
|
10261
10509
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
10262
10510
|
var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
10263
10511
|
|
|
10264
10512
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
10265
|
-
var
|
|
10266
|
-
var
|
|
10513
|
+
var import_react43 = require("react");
|
|
10514
|
+
var import_type_guards36 = require("@wistia/type-guards");
|
|
10267
10515
|
var useFocusRestore = () => {
|
|
10268
|
-
const previouslyFocusedRef = (0,
|
|
10269
|
-
(0,
|
|
10516
|
+
const previouslyFocusedRef = (0, import_react43.useRef)(null);
|
|
10517
|
+
(0, import_react43.useEffect)(() => {
|
|
10270
10518
|
previouslyFocusedRef.current = document.activeElement;
|
|
10271
10519
|
}, []);
|
|
10272
|
-
(0,
|
|
10520
|
+
(0, import_react43.useEffect)(() => {
|
|
10273
10521
|
return () => {
|
|
10274
|
-
if ((0,
|
|
10522
|
+
if ((0, import_type_guards36.isNotNil)(previouslyFocusedRef.current)) {
|
|
10275
10523
|
setTimeout(() => {
|
|
10276
10524
|
previouslyFocusedRef.current?.focus();
|
|
10277
10525
|
}, 0);
|
|
@@ -10323,7 +10571,7 @@ var StyledModalContent = (0, import_styled_components60.default)(import_react_di
|
|
|
10323
10571
|
}
|
|
10324
10572
|
}
|
|
10325
10573
|
`;
|
|
10326
|
-
var ModalContent = (0,
|
|
10574
|
+
var ModalContent = (0, import_react44.forwardRef)(
|
|
10327
10575
|
({ fullHeight, width, children, ...otherProps }, ref) => {
|
|
10328
10576
|
useFocusRestore();
|
|
10329
10577
|
return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
|
|
@@ -10341,7 +10589,7 @@ var ModalContent = (0, import_react43.forwardRef)(
|
|
|
10341
10589
|
);
|
|
10342
10590
|
|
|
10343
10591
|
// src/private/components/Backdrop/Backdrop.tsx
|
|
10344
|
-
var
|
|
10592
|
+
var import_react45 = require("react");
|
|
10345
10593
|
var import_styled_components61 = __toESM(require("styled-components"));
|
|
10346
10594
|
var import_jsx_runtime242 = require("react/jsx-runtime");
|
|
10347
10595
|
var backdropAnimationDuration = 150;
|
|
@@ -10379,7 +10627,7 @@ var BackdropComponent = import_styled_components61.default.div`
|
|
|
10379
10627
|
}
|
|
10380
10628
|
}
|
|
10381
10629
|
`;
|
|
10382
|
-
var Backdrop = (0,
|
|
10630
|
+
var Backdrop = (0, import_react45.forwardRef)(
|
|
10383
10631
|
({ alignHorizontal = "center", alignVertical = "center", children, ...otherProps }, ref) => /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
|
|
10384
10632
|
BackdropComponent,
|
|
10385
10633
|
{
|
|
@@ -10401,7 +10649,7 @@ var ModalBody = import_styled_components62.default.div`
|
|
|
10401
10649
|
display: flex;
|
|
10402
10650
|
order: 2;
|
|
10403
10651
|
`;
|
|
10404
|
-
var Modal = (0,
|
|
10652
|
+
var Modal = (0, import_react46.forwardRef)(
|
|
10405
10653
|
({
|
|
10406
10654
|
children,
|
|
10407
10655
|
fullHeight = false,
|
|
@@ -10418,7 +10666,7 @@ var Modal = (0, import_react45.forwardRef)(
|
|
|
10418
10666
|
import_react_dialog4.Root,
|
|
10419
10667
|
{
|
|
10420
10668
|
onOpenChange: (open2) => {
|
|
10421
|
-
if (!open2 && (0,
|
|
10669
|
+
if (!open2 && (0, import_type_guards37.isNotNil)(onRequestClose)) {
|
|
10422
10670
|
onRequestClose();
|
|
10423
10671
|
}
|
|
10424
10672
|
},
|
|
@@ -10431,7 +10679,7 @@ var Modal = (0, import_react45.forwardRef)(
|
|
|
10431
10679
|
ref,
|
|
10432
10680
|
fullHeight,
|
|
10433
10681
|
onOpenAutoFocus: (event) => {
|
|
10434
|
-
if ((0,
|
|
10682
|
+
if ((0, import_type_guards37.isNotNil)(initialFocusRef) && initialFocusRef.current) {
|
|
10435
10683
|
event.preventDefault();
|
|
10436
10684
|
requestAnimationFrame(() => {
|
|
10437
10685
|
initialFocusRef.current?.focus();
|
|
@@ -10465,9 +10713,9 @@ var import_react_popover = require("@radix-ui/react-popover");
|
|
|
10465
10713
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
10466
10714
|
|
|
10467
10715
|
// src/private/helpers/getControls/getControlProps.tsx
|
|
10468
|
-
var
|
|
10716
|
+
var import_type_guards38 = require("@wistia/type-guards");
|
|
10469
10717
|
var getControlProps = (isOpen, onOpenChange) => {
|
|
10470
|
-
return (0,
|
|
10718
|
+
return (0, import_type_guards38.isNotNil)(onOpenChange) && (0, import_type_guards38.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {};
|
|
10471
10719
|
};
|
|
10472
10720
|
|
|
10473
10721
|
// src/components/Popover/Popover.tsx
|
|
@@ -10526,7 +10774,7 @@ Popover.displayName = "Popover";
|
|
|
10526
10774
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
10527
10775
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
10528
10776
|
var import_react_progress = require("@radix-ui/react-progress");
|
|
10529
|
-
var
|
|
10777
|
+
var import_type_guards39 = require("@wistia/type-guards");
|
|
10530
10778
|
var import_jsx_runtime245 = require("react/jsx-runtime");
|
|
10531
10779
|
var ProgressBarWrapper = import_styled_components64.default.div`
|
|
10532
10780
|
--progress-bar-height: 8px;
|
|
@@ -10581,7 +10829,7 @@ var ProgressBar = ({
|
|
|
10581
10829
|
...props
|
|
10582
10830
|
}) => {
|
|
10583
10831
|
return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(ProgressBarWrapper, { children: [
|
|
10584
|
-
(0,
|
|
10832
|
+
(0, import_type_guards39.isNotNil)(labelLeft) ? /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ProgressBarLabel, { children: labelLeft }) : null,
|
|
10585
10833
|
/* @__PURE__ */ (0, import_jsx_runtime245.jsx)(
|
|
10586
10834
|
StyledProgressBar,
|
|
10587
10835
|
{
|
|
@@ -10597,15 +10845,15 @@ var ProgressBar = ({
|
|
|
10597
10845
|
)
|
|
10598
10846
|
}
|
|
10599
10847
|
),
|
|
10600
|
-
(0,
|
|
10848
|
+
(0, import_type_guards39.isNotNil)(labelRight) ? /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ProgressBarLabel, { children: labelRight }) : null
|
|
10601
10849
|
] });
|
|
10602
10850
|
};
|
|
10603
10851
|
ProgressBar.displayName = "ProgressBar";
|
|
10604
10852
|
|
|
10605
10853
|
// src/components/Radio/Radio.tsx
|
|
10606
|
-
var
|
|
10854
|
+
var import_react47 = require("react");
|
|
10607
10855
|
var import_styled_components65 = __toESM(require("styled-components"));
|
|
10608
|
-
var
|
|
10856
|
+
var import_type_guards40 = require("@wistia/type-guards");
|
|
10609
10857
|
var import_jsx_runtime246 = require("react/jsx-runtime");
|
|
10610
10858
|
var RadioIcon = () => /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
|
|
10611
10859
|
"svg",
|
|
@@ -10706,7 +10954,7 @@ var StyledHiddenRadioInput = import_styled_components65.default.input`
|
|
|
10706
10954
|
display: block;
|
|
10707
10955
|
}
|
|
10708
10956
|
`;
|
|
10709
|
-
var Radio = (0,
|
|
10957
|
+
var Radio = (0, import_react47.forwardRef)(
|
|
10710
10958
|
({
|
|
10711
10959
|
checked,
|
|
10712
10960
|
disabled = false,
|
|
@@ -10721,8 +10969,8 @@ var Radio = (0, import_react46.forwardRef)(
|
|
|
10721
10969
|
hideLabel = false,
|
|
10722
10970
|
...props
|
|
10723
10971
|
}, ref) => {
|
|
10724
|
-
const generatedId = (0,
|
|
10725
|
-
const computedId = (0,
|
|
10972
|
+
const generatedId = (0, import_react47.useId)();
|
|
10973
|
+
const computedId = (0, import_type_guards40.isNonEmptyString)(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
10726
10974
|
return /* @__PURE__ */ (0, import_jsx_runtime246.jsxs)(
|
|
10727
10975
|
StyledRadioWrapper,
|
|
10728
10976
|
{
|
|
@@ -10771,22 +11019,22 @@ var Radio = (0, import_react46.forwardRef)(
|
|
|
10771
11019
|
Radio.displayName = "Radio";
|
|
10772
11020
|
|
|
10773
11021
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
10774
|
-
var
|
|
11022
|
+
var import_react51 = require("react");
|
|
10775
11023
|
var import_styled_components67 = __toESM(require("styled-components"));
|
|
10776
11024
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
10777
|
-
var
|
|
11025
|
+
var import_type_guards41 = require("@wistia/type-guards");
|
|
10778
11026
|
|
|
10779
11027
|
// src/components/SegmentedControl/useSelectedItemMeasurements.tsx
|
|
10780
|
-
var
|
|
11028
|
+
var import_react48 = require("react");
|
|
10781
11029
|
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
10782
|
-
var SelectedItemMeasurementsContext = (0,
|
|
11030
|
+
var SelectedItemMeasurementsContext = (0, import_react48.createContext)(
|
|
10783
11031
|
null
|
|
10784
11032
|
);
|
|
10785
11033
|
var SelectedItemMeasurementsProvider = ({
|
|
10786
11034
|
children
|
|
10787
11035
|
}) => {
|
|
10788
|
-
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0,
|
|
10789
|
-
const contextValue = (0,
|
|
11036
|
+
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0, import_react48.useState)(null);
|
|
11037
|
+
const contextValue = (0, import_react48.useMemo)(
|
|
10790
11038
|
() => ({
|
|
10791
11039
|
setSelectedItemMeasurements,
|
|
10792
11040
|
selectedItemMeasurements
|
|
@@ -10796,7 +11044,7 @@ var SelectedItemMeasurementsProvider = ({
|
|
|
10796
11044
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(SelectedItemMeasurementsContext.Provider, { value: contextValue, children });
|
|
10797
11045
|
};
|
|
10798
11046
|
var useSelectedItemMeasurements = () => {
|
|
10799
|
-
const context = (0,
|
|
11047
|
+
const context = (0, import_react48.useContext)(SelectedItemMeasurementsContext);
|
|
10800
11048
|
if (context === null) {
|
|
10801
11049
|
throw new Error(
|
|
10802
11050
|
"useSelectedItemMeasurements must be used within a SelectedItemMeasurementsProvider"
|
|
@@ -10806,15 +11054,15 @@ var useSelectedItemMeasurements = () => {
|
|
|
10806
11054
|
};
|
|
10807
11055
|
|
|
10808
11056
|
// src/components/SegmentedControl/SelectedItemIndicator.tsx
|
|
10809
|
-
var
|
|
11057
|
+
var import_react50 = require("react");
|
|
10810
11058
|
var import_styled_components66 = __toESM(require("styled-components"));
|
|
10811
11059
|
|
|
10812
11060
|
// src/components/SegmentedControl/useSegmentedControlValue.tsx
|
|
10813
|
-
var
|
|
10814
|
-
var SegmentedControlValueContext = (0,
|
|
11061
|
+
var import_react49 = require("react");
|
|
11062
|
+
var SegmentedControlValueContext = (0, import_react49.createContext)(null);
|
|
10815
11063
|
var SegmentedControlValueProvider = SegmentedControlValueContext.Provider;
|
|
10816
11064
|
var useSegmentedControlValue = () => {
|
|
10817
|
-
const context = (0,
|
|
11065
|
+
const context = (0, import_react49.useContext)(SegmentedControlValueContext);
|
|
10818
11066
|
if (context === null) {
|
|
10819
11067
|
throw new Error("useSegmentedControlValue must be used within a SegmentedControlValueProvider");
|
|
10820
11068
|
}
|
|
@@ -10838,7 +11086,7 @@ var SelectedItemIndicatorDiv = import_styled_components66.default.div`
|
|
|
10838
11086
|
var SelectedItemIndicator = () => {
|
|
10839
11087
|
const selectedValue = useSegmentedControlValue();
|
|
10840
11088
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
10841
|
-
const selectedItemIndicatorStyle = (0,
|
|
11089
|
+
const selectedItemIndicatorStyle = (0, import_react50.useMemo)(
|
|
10842
11090
|
() => selectedItemMeasurements != null ? {
|
|
10843
11091
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
10844
11092
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -10876,7 +11124,7 @@ var segmentedControlStyles = import_styled_components67.css`
|
|
|
10876
11124
|
var StyledSegmentedControl = (0, import_styled_components67.default)(import_react_toggle_group.Root)`
|
|
10877
11125
|
${segmentedControlStyles}
|
|
10878
11126
|
`;
|
|
10879
|
-
var SegmentedControl = (0,
|
|
11127
|
+
var SegmentedControl = (0, import_react51.forwardRef)(
|
|
10880
11128
|
({
|
|
10881
11129
|
children,
|
|
10882
11130
|
disabled = false,
|
|
@@ -10885,7 +11133,7 @@ var SegmentedControl = (0, import_react50.forwardRef)(
|
|
|
10885
11133
|
onSelectedValueChange,
|
|
10886
11134
|
...props
|
|
10887
11135
|
}, ref) => {
|
|
10888
|
-
if ((0,
|
|
11136
|
+
if ((0, import_type_guards41.isNil)(children)) {
|
|
10889
11137
|
return null;
|
|
10890
11138
|
}
|
|
10891
11139
|
return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
|
|
@@ -10911,26 +11159,10 @@ var SegmentedControl = (0, import_react50.forwardRef)(
|
|
|
10911
11159
|
SegmentedControl.displayName = "SegmentedControl";
|
|
10912
11160
|
|
|
10913
11161
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
10914
|
-
var
|
|
11162
|
+
var import_react52 = require("react");
|
|
10915
11163
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
10916
11164
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
10917
|
-
var
|
|
10918
|
-
|
|
10919
|
-
// src/private/helpers/mergeRefs/mergeRefs.ts
|
|
10920
|
-
var import_type_guards40 = require("@wistia/type-guards");
|
|
10921
|
-
var mergeRefs = (refs) => (value) => {
|
|
10922
|
-
refs.forEach((ref) => {
|
|
10923
|
-
if ((0, import_type_guards40.isFunction)(ref)) {
|
|
10924
|
-
ref(value);
|
|
10925
|
-
return;
|
|
10926
|
-
}
|
|
10927
|
-
if ((0, import_type_guards40.isNotNil)(ref)) {
|
|
10928
|
-
ref.current = value;
|
|
10929
|
-
}
|
|
10930
|
-
});
|
|
10931
|
-
};
|
|
10932
|
-
|
|
10933
|
-
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
11165
|
+
var import_type_guards42 = require("@wistia/type-guards");
|
|
10934
11166
|
var import_jsx_runtime250 = require("react/jsx-runtime");
|
|
10935
11167
|
var segmentedControlItemStyles = import_styled_components68.css`
|
|
10936
11168
|
all: unset; /* ToggleGroupItem is a button element */
|
|
@@ -10994,11 +11226,11 @@ var segmentedControlItemStyles = import_styled_components68.css`
|
|
|
10994
11226
|
var StyledSegmentedControlItem = (0, import_styled_components68.default)(import_react_toggle_group2.Item)`
|
|
10995
11227
|
${segmentedControlItemStyles}
|
|
10996
11228
|
`;
|
|
10997
|
-
var SegmentedControlItem = (0,
|
|
11229
|
+
var SegmentedControlItem = (0, import_react52.forwardRef)(
|
|
10998
11230
|
({ disabled, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
10999
11231
|
const selectedValue = useSegmentedControlValue();
|
|
11000
11232
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11001
|
-
const buttonRef = (0,
|
|
11233
|
+
const buttonRef = (0, import_react52.useRef)(null);
|
|
11002
11234
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11003
11235
|
const handleClick = (event) => {
|
|
11004
11236
|
const target = event.target;
|
|
@@ -11007,7 +11239,7 @@ var SegmentedControlItem = (0, import_react51.forwardRef)(
|
|
|
11007
11239
|
event.preventDefault();
|
|
11008
11240
|
}
|
|
11009
11241
|
};
|
|
11010
|
-
(0,
|
|
11242
|
+
(0, import_react52.useEffect)(() => {
|
|
11011
11243
|
const buttonElem = buttonRef.current;
|
|
11012
11244
|
if (!buttonElem) {
|
|
11013
11245
|
return void 0;
|
|
@@ -11036,8 +11268,8 @@ var SegmentedControlItem = (0, import_react51.forwardRef)(
|
|
|
11036
11268
|
StyledSegmentedControlItem,
|
|
11037
11269
|
{
|
|
11038
11270
|
ref: combinedRef,
|
|
11039
|
-
$hasLabel: (0,
|
|
11040
|
-
"aria-label": (0,
|
|
11271
|
+
$hasLabel: (0, import_type_guards42.isNotNil)(label),
|
|
11272
|
+
"aria-label": (0, import_type_guards42.isNotNil)(label) ? void 0 : ariaLabel,
|
|
11041
11273
|
disabled,
|
|
11042
11274
|
onClick: handleClick,
|
|
11043
11275
|
value,
|
|
@@ -11053,7 +11285,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
11053
11285
|
|
|
11054
11286
|
// src/components/Select/Select.tsx
|
|
11055
11287
|
var import_react_select = require("@radix-ui/react-select");
|
|
11056
|
-
var
|
|
11288
|
+
var import_react53 = require("react");
|
|
11057
11289
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
11058
11290
|
var import_jsx_runtime251 = require("react/jsx-runtime");
|
|
11059
11291
|
var StyledTrigger = (0, import_styled_components69.default)(import_react_select.Trigger)`
|
|
@@ -11122,7 +11354,7 @@ var StyledContent3 = (0, import_styled_components69.default)(import_react_select
|
|
|
11122
11354
|
max-height: var(--radix-select-content-available-height);
|
|
11123
11355
|
z-index: var(--wui-zindex-select);
|
|
11124
11356
|
`;
|
|
11125
|
-
var Select = (0,
|
|
11357
|
+
var Select = (0, import_react53.forwardRef)(
|
|
11126
11358
|
({
|
|
11127
11359
|
colorScheme = "inherit",
|
|
11128
11360
|
children,
|
|
@@ -11171,7 +11403,7 @@ Select.displayName = "Select";
|
|
|
11171
11403
|
|
|
11172
11404
|
// src/components/Select/SelectOption.tsx
|
|
11173
11405
|
var import_react_select2 = require("@radix-ui/react-select");
|
|
11174
|
-
var
|
|
11406
|
+
var import_react54 = require("react");
|
|
11175
11407
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
11176
11408
|
var import_jsx_runtime252 = require("react/jsx-runtime");
|
|
11177
11409
|
var StyledItem = (0, import_styled_components70.default)(import_react_select2.Item)`
|
|
@@ -11200,7 +11432,7 @@ var StyledItem = (0, import_styled_components70.default)(import_react_select2.It
|
|
|
11200
11432
|
var StyledIconContainer = import_styled_components70.default.span`
|
|
11201
11433
|
width: 12px;
|
|
11202
11434
|
`;
|
|
11203
|
-
var SelectOption = (0,
|
|
11435
|
+
var SelectOption = (0, import_react54.forwardRef)(
|
|
11204
11436
|
({ children, ...props }, forwardedRef) => {
|
|
11205
11437
|
return /* @__PURE__ */ (0, import_jsx_runtime252.jsxs)(
|
|
11206
11438
|
StyledItem,
|
|
@@ -11245,9 +11477,9 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
11245
11477
|
};
|
|
11246
11478
|
|
|
11247
11479
|
// src/components/Switch/Switch.tsx
|
|
11248
|
-
var
|
|
11480
|
+
var import_react55 = require("react");
|
|
11249
11481
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
11250
|
-
var
|
|
11482
|
+
var import_type_guards43 = require("@wistia/type-guards");
|
|
11251
11483
|
var import_jsx_runtime254 = require("react/jsx-runtime");
|
|
11252
11484
|
var sizeSmall3 = import_styled_components72.css`
|
|
11253
11485
|
--wui-size-small-width: 24px;
|
|
@@ -11350,7 +11582,7 @@ var StyledHiddenSwitchInput = import_styled_components72.default.input`
|
|
|
11350
11582
|
}
|
|
11351
11583
|
}
|
|
11352
11584
|
`;
|
|
11353
|
-
var Switch = (0,
|
|
11585
|
+
var Switch = (0, import_react55.forwardRef)(
|
|
11354
11586
|
({
|
|
11355
11587
|
checked,
|
|
11356
11588
|
disabled = false,
|
|
@@ -11365,8 +11597,8 @@ var Switch = (0, import_react54.forwardRef)(
|
|
|
11365
11597
|
hideLabel = false,
|
|
11366
11598
|
...props
|
|
11367
11599
|
}, ref) => {
|
|
11368
|
-
const generatedId = (0,
|
|
11369
|
-
const computedId = (0,
|
|
11600
|
+
const generatedId = (0, import_react55.useId)();
|
|
11601
|
+
const computedId = (0, import_type_guards43.isNonEmptyString)(id) ? id : `wistia-ui-switch-${generatedId}`;
|
|
11370
11602
|
return /* @__PURE__ */ (0, import_jsx_runtime254.jsxs)(StyledSwitchWrapper, { $disabled: disabled, children: [
|
|
11371
11603
|
/* @__PURE__ */ (0, import_jsx_runtime254.jsx)(
|
|
11372
11604
|
StyledHiddenSwitchInput,
|
|
@@ -11447,8 +11679,8 @@ var Table = ({
|
|
|
11447
11679
|
var import_styled_components74 = __toESM(require("styled-components"));
|
|
11448
11680
|
|
|
11449
11681
|
// src/components/Table/TableSectionContext.ts
|
|
11450
|
-
var
|
|
11451
|
-
var TableSectionContext = (0,
|
|
11682
|
+
var import_react56 = require("react");
|
|
11683
|
+
var TableSectionContext = (0, import_react56.createContext)(null);
|
|
11452
11684
|
|
|
11453
11685
|
// src/components/Table/TableBody.tsx
|
|
11454
11686
|
var import_jsx_runtime256 = require("react/jsx-runtime");
|
|
@@ -11458,7 +11690,7 @@ var TableBody = ({ children, ...props }) => {
|
|
|
11458
11690
|
};
|
|
11459
11691
|
|
|
11460
11692
|
// src/components/Table/TableCell.tsx
|
|
11461
|
-
var
|
|
11693
|
+
var import_react57 = require("react");
|
|
11462
11694
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
11463
11695
|
var import_jsx_runtime257 = require("react/jsx-runtime");
|
|
11464
11696
|
var sharedStyles = import_styled_components75.css`
|
|
@@ -11479,7 +11711,7 @@ var StyledTd = import_styled_components75.default.td`
|
|
|
11479
11711
|
line-height: var(--wui-typography-body-2-line-height);
|
|
11480
11712
|
`;
|
|
11481
11713
|
var TableCell = ({ children, ...props }) => {
|
|
11482
|
-
const section = (0,
|
|
11714
|
+
const section = (0, import_react57.useContext)(TableSectionContext);
|
|
11483
11715
|
if (section === "head") {
|
|
11484
11716
|
return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(StyledTh, { ...props, children });
|
|
11485
11717
|
}
|
|
@@ -11511,9 +11743,9 @@ var TableRow = ({ children, ...props }) => {
|
|
|
11511
11743
|
};
|
|
11512
11744
|
|
|
11513
11745
|
// src/components/Tabs/Tabs.tsx
|
|
11514
|
-
var
|
|
11746
|
+
var import_react62 = require("react");
|
|
11515
11747
|
var import_react_tabs4 = require("@radix-ui/react-tabs");
|
|
11516
|
-
var
|
|
11748
|
+
var import_type_guards45 = require("@wistia/type-guards");
|
|
11517
11749
|
var import_styled_components83 = __toESM(require("styled-components"));
|
|
11518
11750
|
|
|
11519
11751
|
// src/components/Tabs/TabPanel.tsx
|
|
@@ -11566,17 +11798,17 @@ var TabList = ({
|
|
|
11566
11798
|
TabList.displayName = "TabList";
|
|
11567
11799
|
|
|
11568
11800
|
// src/components/Tabs/TabItem.tsx
|
|
11569
|
-
var
|
|
11801
|
+
var import_react59 = require("react");
|
|
11570
11802
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
11571
11803
|
var import_react_tabs3 = require("@radix-ui/react-tabs");
|
|
11572
|
-
var
|
|
11804
|
+
var import_type_guards44 = require("@wistia/type-guards");
|
|
11573
11805
|
|
|
11574
11806
|
// src/components/Tabs/useTabsValue.tsx
|
|
11575
|
-
var
|
|
11576
|
-
var TabsValueContext = (0,
|
|
11807
|
+
var import_react58 = require("react");
|
|
11808
|
+
var TabsValueContext = (0, import_react58.createContext)(null);
|
|
11577
11809
|
var TabsValueProvider = TabsValueContext.Provider;
|
|
11578
11810
|
var useTabsValue = () => {
|
|
11579
|
-
const context = (0,
|
|
11811
|
+
const context = (0, import_react58.useContext)(TabsValueContext);
|
|
11580
11812
|
if (context === null) {
|
|
11581
11813
|
throw new Error("useTabsValue must be used within a TabsValueProvider");
|
|
11582
11814
|
}
|
|
@@ -11592,13 +11824,13 @@ var StyledTabItem = (0, import_styled_components81.default)(import_react_tabs3.T
|
|
|
11592
11824
|
outline: none;
|
|
11593
11825
|
}
|
|
11594
11826
|
`;
|
|
11595
|
-
var TabItem = (0,
|
|
11827
|
+
var TabItem = (0, import_react59.forwardRef)(
|
|
11596
11828
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11597
11829
|
const selectedValue = useTabsValue();
|
|
11598
11830
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11599
|
-
const buttonRef = (0,
|
|
11831
|
+
const buttonRef = (0, import_react59.useRef)(null);
|
|
11600
11832
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11601
|
-
(0,
|
|
11833
|
+
(0, import_react59.useEffect)(() => {
|
|
11602
11834
|
const buttonElem = buttonRef.current;
|
|
11603
11835
|
if (!buttonElem) {
|
|
11604
11836
|
return void 0;
|
|
@@ -11627,8 +11859,8 @@ var TabItem = (0, import_react58.forwardRef)(
|
|
|
11627
11859
|
StyledTabItem,
|
|
11628
11860
|
{
|
|
11629
11861
|
ref: combinedRef,
|
|
11630
|
-
$hasLabel: (0,
|
|
11631
|
-
"aria-label": (0,
|
|
11862
|
+
$hasLabel: (0, import_type_guards44.isNotNil)(label),
|
|
11863
|
+
"aria-label": (0, import_type_guards44.isNotNil)(label) ? void 0 : ariaLabel,
|
|
11632
11864
|
disabled,
|
|
11633
11865
|
value,
|
|
11634
11866
|
children: [
|
|
@@ -11642,16 +11874,16 @@ var TabItem = (0, import_react58.forwardRef)(
|
|
|
11642
11874
|
TabItem.displayName = "TabItem";
|
|
11643
11875
|
|
|
11644
11876
|
// src/components/Tabs/extractTabItems.ts
|
|
11645
|
-
var
|
|
11877
|
+
var import_react60 = require("react");
|
|
11646
11878
|
var extractTabItems = (children) => {
|
|
11647
11879
|
const tabItems = [];
|
|
11648
|
-
|
|
11649
|
-
if (!(0,
|
|
11880
|
+
import_react60.Children.forEach(children, (child) => {
|
|
11881
|
+
if (!(0, import_react60.isValidElement)(child)) {
|
|
11650
11882
|
return;
|
|
11651
11883
|
}
|
|
11652
11884
|
if (typeof child.type !== "string" && child.type.displayName === "Tab") {
|
|
11653
11885
|
tabItems.push(child);
|
|
11654
|
-
} else if (child.type ===
|
|
11886
|
+
} else if (child.type === import_react60.Fragment) {
|
|
11655
11887
|
const fragmentElement = child;
|
|
11656
11888
|
tabItems.push(...extractTabItems(fragmentElement.props.children));
|
|
11657
11889
|
} else if ((child.props.children ?? null) != null) {
|
|
@@ -11664,7 +11896,7 @@ var extractTabItems = (children) => {
|
|
|
11664
11896
|
};
|
|
11665
11897
|
|
|
11666
11898
|
// src/components/Tabs/SelectedItemIndicator.tsx
|
|
11667
|
-
var
|
|
11899
|
+
var import_react61 = require("react");
|
|
11668
11900
|
var import_styled_components82 = __toESM(require("styled-components"));
|
|
11669
11901
|
var import_jsx_runtime264 = require("react/jsx-runtime");
|
|
11670
11902
|
var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(SelectedItemIndicatorDiv)`
|
|
@@ -11675,7 +11907,7 @@ var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(Selec
|
|
|
11675
11907
|
var SelectedItemIndicator2 = () => {
|
|
11676
11908
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11677
11909
|
const selectedValue = useTabsValue();
|
|
11678
|
-
const selectedItemIndicatorStyle = (0,
|
|
11910
|
+
const selectedItemIndicatorStyle = (0, import_react61.useMemo)(
|
|
11679
11911
|
() => selectedItemMeasurements != null ? {
|
|
11680
11912
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
11681
11913
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -11716,7 +11948,7 @@ var StyledTabsRoot = (0, import_styled_components83.default)(import_react_tabs4.
|
|
|
11716
11948
|
flex-direction: column;
|
|
11717
11949
|
height: ${({ $stickyHeaders }) => $stickyHeaders ? "100%" : "auto"};
|
|
11718
11950
|
`;
|
|
11719
|
-
var Tabs = (0,
|
|
11951
|
+
var Tabs = (0, import_react62.forwardRef)(
|
|
11720
11952
|
({
|
|
11721
11953
|
children,
|
|
11722
11954
|
fullWidth = true,
|
|
@@ -11728,7 +11960,7 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
11728
11960
|
...otherProps
|
|
11729
11961
|
}, ref) => {
|
|
11730
11962
|
const tabItems = extractTabItems(children);
|
|
11731
|
-
const [internalSelectedValue, setInternalSelectedValue] = (0,
|
|
11963
|
+
const [internalSelectedValue, setInternalSelectedValue] = (0, import_react62.useState)(defaultSelectedValue);
|
|
11732
11964
|
const modeProps = defaultSelectedValue !== void 0 ? {
|
|
11733
11965
|
defaultValue: defaultSelectedValue,
|
|
11734
11966
|
onValueChange: setInternalSelectedValue
|
|
@@ -11758,7 +11990,7 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
11758
11990
|
label,
|
|
11759
11991
|
"aria-label": ariaLabelForTab
|
|
11760
11992
|
} = tab.props;
|
|
11761
|
-
if ((0,
|
|
11993
|
+
if ((0, import_type_guards45.isNil)(icon)) {
|
|
11762
11994
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11763
11995
|
TabItem,
|
|
11764
11996
|
{
|
|
@@ -11769,7 +12001,7 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
11769
12001
|
value
|
|
11770
12002
|
);
|
|
11771
12003
|
}
|
|
11772
|
-
if ((0,
|
|
12004
|
+
if ((0, import_type_guards45.isNotNil)(label)) {
|
|
11773
12005
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11774
12006
|
TabItem,
|
|
11775
12007
|
{
|
|
@@ -11781,7 +12013,7 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
11781
12013
|
value
|
|
11782
12014
|
);
|
|
11783
12015
|
}
|
|
11784
|
-
if ((0,
|
|
12016
|
+
if ((0, import_type_guards45.isNotNil)(ariaLabelForTab)) {
|
|
11785
12017
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11786
12018
|
TabItem,
|
|
11787
12019
|
{
|
|
@@ -11814,17 +12046,17 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
11814
12046
|
Tabs.displayName = "Tabs";
|
|
11815
12047
|
|
|
11816
12048
|
// src/components/Tabs/Tab.tsx
|
|
11817
|
-
var
|
|
12049
|
+
var import_react63 = require("react");
|
|
11818
12050
|
var import_jsx_runtime266 = require("react/jsx-runtime");
|
|
11819
|
-
var Tab = (0,
|
|
12051
|
+
var Tab = (0, import_react63.forwardRef)(({ children }, ref) => {
|
|
11820
12052
|
return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { ref, children });
|
|
11821
12053
|
});
|
|
11822
12054
|
Tab.displayName = "Tab";
|
|
11823
12055
|
|
|
11824
12056
|
// src/components/Tag/Tag.tsx
|
|
11825
|
-
var
|
|
12057
|
+
var import_react64 = require("react");
|
|
11826
12058
|
var import_styled_components84 = __toESM(require("styled-components"));
|
|
11827
|
-
var
|
|
12059
|
+
var import_type_guards46 = require("@wistia/type-guards");
|
|
11828
12060
|
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
11829
12061
|
var TagLabel = import_styled_components84.default.a`
|
|
11830
12062
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -11909,10 +12141,10 @@ var StyledTag = import_styled_components84.default.div`
|
|
|
11909
12141
|
}
|
|
11910
12142
|
`;
|
|
11911
12143
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
11912
|
-
if ((0,
|
|
12144
|
+
if ((0, import_type_guards46.isNil)(onClickRemove)) {
|
|
11913
12145
|
return null;
|
|
11914
12146
|
}
|
|
11915
|
-
if ((0,
|
|
12147
|
+
if ((0, import_type_guards46.isNil)(onClickRemoveLabel)) {
|
|
11916
12148
|
throw new Error(
|
|
11917
12149
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
11918
12150
|
);
|
|
@@ -11939,7 +12171,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
11939
12171
|
)
|
|
11940
12172
|
] });
|
|
11941
12173
|
};
|
|
11942
|
-
var Tag = (0,
|
|
12174
|
+
var Tag = (0, import_react64.forwardRef)(
|
|
11943
12175
|
({
|
|
11944
12176
|
onClickRemove,
|
|
11945
12177
|
colorScheme = "inherit",
|
|
@@ -11949,8 +12181,8 @@ var Tag = (0, import_react63.forwardRef)(
|
|
|
11949
12181
|
onClickRemoveLabel,
|
|
11950
12182
|
...otherProps
|
|
11951
12183
|
}, ref) => {
|
|
11952
|
-
const hasIcon = (0,
|
|
11953
|
-
const labelProps = (0,
|
|
12184
|
+
const hasIcon = (0, import_type_guards46.isNotNil)(icon);
|
|
12185
|
+
const labelProps = (0, import_type_guards46.isNotNil)(href) && (0, import_type_guards46.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
11954
12186
|
return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
|
|
11955
12187
|
StyledTag,
|
|
11956
12188
|
{
|
|
@@ -11986,7 +12218,7 @@ Tag.displayName = "Tag";
|
|
|
11986
12218
|
|
|
11987
12219
|
// src/components/WistiaLogo/WistiaLogo.tsx
|
|
11988
12220
|
var import_styled_components85 = __toESM(require("styled-components"));
|
|
11989
|
-
var
|
|
12221
|
+
var import_type_guards47 = require("@wistia/type-guards");
|
|
11990
12222
|
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
11991
12223
|
var renderBrandmark = (brandmarkColor, iconOnly) => {
|
|
11992
12224
|
if (iconOnly) {
|
|
@@ -12099,7 +12331,7 @@ var WistiaLogo = ({
|
|
|
12099
12331
|
...otherProps,
|
|
12100
12332
|
children: [
|
|
12101
12333
|
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)("title", { children: title }),
|
|
12102
|
-
(0,
|
|
12334
|
+
(0, import_type_guards47.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("desc", { children: description }) : null,
|
|
12103
12335
|
renderBrandmark(brandmarkColor, iconOnly),
|
|
12104
12336
|
renderLogotype(logotypeColor, iconOnly)
|
|
12105
12337
|
]
|
|
@@ -12190,11 +12422,13 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
12190
12422
|
ellipsisFlexParentStyle,
|
|
12191
12423
|
ellipsisStyle,
|
|
12192
12424
|
iconSizeMap,
|
|
12425
|
+
mergeRefs,
|
|
12193
12426
|
mq,
|
|
12194
12427
|
useActiveMq,
|
|
12195
12428
|
useAriaLive,
|
|
12196
12429
|
useBoolean,
|
|
12197
12430
|
useFilePicker,
|
|
12431
|
+
useFocusTrap,
|
|
12198
12432
|
useFormState,
|
|
12199
12433
|
useImperativeFilePicker,
|
|
12200
12434
|
useKey,
|