@wistia/ui 0.6.34-beta.51fa53c3.a37ade7 → 0.6.35
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 +282 -516
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -8
- package/dist/index.d.ts +2 -8
- package/dist/index.mjs +56 -289
- 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.35
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -124,7 +124,6 @@ __export(index_exports, {
|
|
|
124
124
|
useAriaLive: () => useAriaLive,
|
|
125
125
|
useBoolean: () => useBoolean,
|
|
126
126
|
useFilePicker: () => import_use_file_picker.useFilePicker,
|
|
127
|
-
useFocusTrap: () => useFocusTrap,
|
|
128
127
|
useFormState: () => useFormState,
|
|
129
128
|
useImperativeFilePicker: () => import_use_file_picker.useImperativeFilePicker,
|
|
130
129
|
useKey: () => useKey,
|
|
@@ -2537,246 +2536,14 @@ var useToast = () => {
|
|
|
2537
2536
|
);
|
|
2538
2537
|
};
|
|
2539
2538
|
|
|
2540
|
-
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2541
|
-
var import_react11 = require("react");
|
|
2542
|
-
var import_type_guards10 = require("@wistia/type-guards");
|
|
2543
|
-
|
|
2544
|
-
// src/hooks/useFocusTrap/helpers.ts
|
|
2545
|
-
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]';
|
|
2546
|
-
var coerceToString = (value) => value === null || value === void 0 ? "" : String(value);
|
|
2547
|
-
var isHiddenElement = (element) => {
|
|
2548
|
-
const { display, visibility } = window.getComputedStyle(element);
|
|
2549
|
-
const isHidden = display === "none" || element.style.display === "none" || visibility === "none" || element.style.visibility === "hidden";
|
|
2550
|
-
return element.offsetWidth <= 0 && element.offsetHeight <= 0 || isHidden;
|
|
2551
|
-
};
|
|
2552
|
-
var isVisibleElement = (element) => {
|
|
2553
|
-
let parentElement = element;
|
|
2554
|
-
while (parentElement) {
|
|
2555
|
-
if (parentElement === document.body) {
|
|
2556
|
-
break;
|
|
2557
|
-
}
|
|
2558
|
-
if (isHiddenElement(parentElement)) {
|
|
2559
|
-
return false;
|
|
2560
|
-
}
|
|
2561
|
-
parentElement = parentElement.parentNode;
|
|
2562
|
-
}
|
|
2563
|
-
return true;
|
|
2564
|
-
};
|
|
2565
|
-
var getElementTabIndex = (element) => {
|
|
2566
|
-
const tabIndex = element.getAttribute("tabindex");
|
|
2567
|
-
return Number.parseInt(tabIndex ?? void 0, 10);
|
|
2568
|
-
};
|
|
2569
|
-
var isTabIndexNaN = (element) => {
|
|
2570
|
-
const tabIndex = getElementTabIndex(element);
|
|
2571
|
-
return Number.isNaN(tabIndex);
|
|
2572
|
-
};
|
|
2573
|
-
var isFocusableElement = (element) => {
|
|
2574
|
-
const tabbableNodeRegEx = /input|select|textarea|button|object/;
|
|
2575
|
-
const nodeName = element.nodeName.toLowerCase();
|
|
2576
|
-
const isTabIndexNotNaN = !isTabIndexNaN(element);
|
|
2577
|
-
const isFocusable = (
|
|
2578
|
-
// @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.
|
|
2579
|
-
tabbableNodeRegEx.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN)
|
|
2580
|
-
);
|
|
2581
|
-
return Boolean(isFocusable) && isVisibleElement(element);
|
|
2582
|
-
};
|
|
2583
|
-
var isTabbableElement = (element) => {
|
|
2584
|
-
const tabIndex = getElementTabIndex(element);
|
|
2585
|
-
return (isTabIndexNaN(element) || tabIndex >= 0) && isFocusableElement(element);
|
|
2586
|
-
};
|
|
2587
|
-
var findTabbableDescendants = (element) => Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter(
|
|
2588
|
-
isTabbableElement
|
|
2589
|
-
);
|
|
2590
|
-
var focusLaterElements = [];
|
|
2591
|
-
var focusElement = null;
|
|
2592
|
-
var needToFocus = false;
|
|
2593
|
-
var handleBlur = () => {
|
|
2594
|
-
needToFocus = true;
|
|
2595
|
-
};
|
|
2596
|
-
var handleFocus = () => {
|
|
2597
|
-
if (needToFocus) {
|
|
2598
|
-
needToFocus = false;
|
|
2599
|
-
if (!focusElement) {
|
|
2600
|
-
return;
|
|
2601
|
-
}
|
|
2602
|
-
if (focusElement.contains(document.activeElement)) {
|
|
2603
|
-
return;
|
|
2604
|
-
}
|
|
2605
|
-
const element = findTabbableDescendants(focusElement)[0] ?? focusElement;
|
|
2606
|
-
element.focus();
|
|
2607
|
-
}
|
|
2608
|
-
};
|
|
2609
|
-
var markForFocusLater = () => {
|
|
2610
|
-
const element = document.activeElement;
|
|
2611
|
-
if (element !== null) {
|
|
2612
|
-
focusLaterElements.push(element);
|
|
2613
|
-
}
|
|
2614
|
-
};
|
|
2615
|
-
var returnFocus = () => {
|
|
2616
|
-
let toFocus = null;
|
|
2617
|
-
try {
|
|
2618
|
-
toFocus = focusLaterElements.pop();
|
|
2619
|
-
if (toFocus) {
|
|
2620
|
-
toFocus.focus();
|
|
2621
|
-
}
|
|
2622
|
-
} catch {
|
|
2623
|
-
console.warn(
|
|
2624
|
-
`You tried to return focus to ${coerceToString(toFocus)} but it is not in the DOM anymore`
|
|
2625
|
-
);
|
|
2626
|
-
}
|
|
2627
|
-
};
|
|
2628
|
-
var setupScopedFocus = (element) => {
|
|
2629
|
-
focusElement = element;
|
|
2630
|
-
document.addEventListener("focusout", handleBlur, false);
|
|
2631
|
-
document.addEventListener("focusin", handleFocus, true);
|
|
2632
|
-
};
|
|
2633
|
-
var teardownScopedFocus = () => {
|
|
2634
|
-
focusElement = null;
|
|
2635
|
-
document.removeEventListener("focusout", handleBlur);
|
|
2636
|
-
document.removeEventListener("focusin", handleFocus);
|
|
2637
|
-
};
|
|
2638
|
-
var scopeTab = (node, event) => {
|
|
2639
|
-
const tabbable = findTabbableDescendants(node);
|
|
2640
|
-
if (!tabbable.length) {
|
|
2641
|
-
event.preventDefault();
|
|
2642
|
-
return;
|
|
2643
|
-
}
|
|
2644
|
-
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
|
|
2645
|
-
const leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
|
|
2646
|
-
if (!leavingFinalTabbable) {
|
|
2647
|
-
return;
|
|
2648
|
-
}
|
|
2649
|
-
event.preventDefault();
|
|
2650
|
-
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
|
|
2651
|
-
if (target) {
|
|
2652
|
-
target.focus();
|
|
2653
|
-
}
|
|
2654
|
-
};
|
|
2655
|
-
var createAriaHider = (containerNode, selector) => {
|
|
2656
|
-
if (selector === void 0) {
|
|
2657
|
-
selector = "body > :not(script)";
|
|
2658
|
-
}
|
|
2659
|
-
const rootNodes = Array.from(document.querySelectorAll(selector)).map((node) => {
|
|
2660
|
-
if (node.contains(containerNode)) {
|
|
2661
|
-
return void 0;
|
|
2662
|
-
}
|
|
2663
|
-
const ariaHidden = node.getAttribute("aria-hidden");
|
|
2664
|
-
if (ariaHidden === null || ariaHidden === "false") {
|
|
2665
|
-
node.setAttribute("aria-hidden", "true");
|
|
2666
|
-
}
|
|
2667
|
-
return {
|
|
2668
|
-
node,
|
|
2669
|
-
ariaHidden
|
|
2670
|
-
};
|
|
2671
|
-
});
|
|
2672
|
-
return () => {
|
|
2673
|
-
rootNodes.forEach((item) => {
|
|
2674
|
-
if (!item) {
|
|
2675
|
-
return;
|
|
2676
|
-
}
|
|
2677
|
-
if (item.ariaHidden === null) {
|
|
2678
|
-
item.node.removeAttribute("aria-hidden");
|
|
2679
|
-
} else {
|
|
2680
|
-
item.node.setAttribute("aria-hidden", item.ariaHidden);
|
|
2681
|
-
}
|
|
2682
|
-
});
|
|
2683
|
-
};
|
|
2684
|
-
};
|
|
2685
|
-
|
|
2686
|
-
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2687
|
-
var isRef = (val) => {
|
|
2688
|
-
return val !== null && typeof val === "object" && "current" in val;
|
|
2689
|
-
};
|
|
2690
|
-
var useFocusTrap = (active = true, options = {}) => {
|
|
2691
|
-
const ref = (0, import_react11.useRef)(null);
|
|
2692
|
-
const restoreAriaRef = (0, import_react11.useRef)(null);
|
|
2693
|
-
const setRef = (0, import_react11.useCallback)(
|
|
2694
|
-
(node) => {
|
|
2695
|
-
if (restoreAriaRef.current !== null) {
|
|
2696
|
-
restoreAriaRef.current();
|
|
2697
|
-
}
|
|
2698
|
-
if (ref.current) {
|
|
2699
|
-
returnFocus();
|
|
2700
|
-
teardownScopedFocus();
|
|
2701
|
-
}
|
|
2702
|
-
if (active && node !== null && node !== void 0) {
|
|
2703
|
-
setupScopedFocus(node);
|
|
2704
|
-
markForFocusLater();
|
|
2705
|
-
const processNode = (node2) => {
|
|
2706
|
-
restoreAriaRef.current = !(options.disableAriaHider ?? false) ? createAriaHider(node2) : null;
|
|
2707
|
-
let focusElement2 = null;
|
|
2708
|
-
if ((0, import_type_guards10.isNotUndefined)(options.focusSelector)) {
|
|
2709
|
-
if (isRef(options.focusSelector)) {
|
|
2710
|
-
focusElement2 = options.focusSelector.current;
|
|
2711
|
-
} else {
|
|
2712
|
-
focusElement2 = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
|
|
2713
|
-
}
|
|
2714
|
-
}
|
|
2715
|
-
if (!focusElement2) {
|
|
2716
|
-
const children = Array.from(
|
|
2717
|
-
node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)
|
|
2718
|
-
);
|
|
2719
|
-
focusElement2 = // Prefer tabbable elements, But fallback to any focusable element
|
|
2720
|
-
children.find(isTabbableElement) ?? // But fallback to any focusable element
|
|
2721
|
-
children.find(isFocusableElement) ?? // Nothing found
|
|
2722
|
-
null;
|
|
2723
|
-
if (!focusElement2 && isFocusableElement(node2)) {
|
|
2724
|
-
focusElement2 = node2;
|
|
2725
|
-
}
|
|
2726
|
-
}
|
|
2727
|
-
if (focusElement2) {
|
|
2728
|
-
focusElement2.focus();
|
|
2729
|
-
}
|
|
2730
|
-
if (!focusElement2 && process.env["NODE_ENV"] === "development") {
|
|
2731
|
-
console.warn(
|
|
2732
|
-
'[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.',
|
|
2733
|
-
node2
|
|
2734
|
-
);
|
|
2735
|
-
}
|
|
2736
|
-
};
|
|
2737
|
-
setTimeout(() => {
|
|
2738
|
-
if (node.ownerDocument) {
|
|
2739
|
-
processNode(node);
|
|
2740
|
-
}
|
|
2741
|
-
if (!node.ownerDocument && process.env["NODE_ENV"] === "development") {
|
|
2742
|
-
console.warn(
|
|
2743
|
-
"[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.",
|
|
2744
|
-
node
|
|
2745
|
-
);
|
|
2746
|
-
}
|
|
2747
|
-
});
|
|
2748
|
-
ref.current = node;
|
|
2749
|
-
} else {
|
|
2750
|
-
ref.current = null;
|
|
2751
|
-
}
|
|
2752
|
-
},
|
|
2753
|
-
[active, options.focusSelector, options.disableAriaHider]
|
|
2754
|
-
);
|
|
2755
|
-
(0, import_react11.useEffect)(() => {
|
|
2756
|
-
if (!active) {
|
|
2757
|
-
return void 0;
|
|
2758
|
-
}
|
|
2759
|
-
const handleKeyDown = (event) => {
|
|
2760
|
-
if (event.key === "Tab" && ref.current) {
|
|
2761
|
-
scopeTab(ref.current, event);
|
|
2762
|
-
}
|
|
2763
|
-
};
|
|
2764
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
2765
|
-
return () => {
|
|
2766
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
2767
|
-
};
|
|
2768
|
-
}, [active]);
|
|
2769
|
-
return setRef;
|
|
2770
|
-
};
|
|
2771
|
-
|
|
2772
2539
|
// src/components/ActionButton/ActionButton.tsx
|
|
2773
|
-
var
|
|
2540
|
+
var import_react14 = require("react");
|
|
2774
2541
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2775
2542
|
|
|
2776
2543
|
// src/components/Button/Button.tsx
|
|
2777
|
-
var
|
|
2544
|
+
var import_react13 = require("react");
|
|
2778
2545
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
2779
|
-
var
|
|
2546
|
+
var import_type_guards13 = require("@wistia/type-guards");
|
|
2780
2547
|
|
|
2781
2548
|
// src/css/buttonResetCss.tsx
|
|
2782
2549
|
var import_styled_components16 = require("styled-components");
|
|
@@ -2980,7 +2747,7 @@ var buttonSizeStyles = {
|
|
|
2980
2747
|
};
|
|
2981
2748
|
|
|
2982
2749
|
// src/components/Icon/Icon.tsx
|
|
2983
|
-
var
|
|
2750
|
+
var import_type_guards11 = require("@wistia/type-guards");
|
|
2984
2751
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
2985
2752
|
|
|
2986
2753
|
// src/components/Icon/icons/AbTestIcon.tsx
|
|
@@ -6835,17 +6602,17 @@ var iconMap = {
|
|
|
6835
6602
|
};
|
|
6836
6603
|
|
|
6837
6604
|
// src/private/hooks/useResponsiveProp/useResponsiveProp.ts
|
|
6838
|
-
var
|
|
6839
|
-
var
|
|
6605
|
+
var import_type_guards10 = require("@wistia/type-guards");
|
|
6606
|
+
var import_react11 = require("react");
|
|
6840
6607
|
var isResponsiveObject = (values) => {
|
|
6841
6608
|
return typeof values === "object" && values !== null && !Array.isArray(values) && "base" in values;
|
|
6842
6609
|
};
|
|
6843
6610
|
var useResponsiveProp = (values) => {
|
|
6844
6611
|
const activeMediaQueries = useActiveMq();
|
|
6845
|
-
return (0,
|
|
6846
|
-
if ((0,
|
|
6612
|
+
return (0, import_react11.useMemo)(() => {
|
|
6613
|
+
if ((0, import_type_guards10.isRecord)(values) && isResponsiveObject(values)) {
|
|
6847
6614
|
const mq2 = activeMediaQueries.find((key) => key in values);
|
|
6848
|
-
return (0,
|
|
6615
|
+
return (0, import_type_guards10.isNotUndefined)(mq2) && (0, import_type_guards10.isNotUndefined)(values[mq2]) ? values[mq2] : values.base;
|
|
6849
6616
|
}
|
|
6850
6617
|
return values;
|
|
6851
6618
|
}, [activeMediaQueries, values]);
|
|
@@ -6872,13 +6639,13 @@ var Icon = ({
|
|
|
6872
6639
|
...otherProps
|
|
6873
6640
|
}) => {
|
|
6874
6641
|
const responsiveSize = useResponsiveProp(size);
|
|
6875
|
-
if ((0,
|
|
6642
|
+
if ((0, import_type_guards11.isNil)(type)) {
|
|
6876
6643
|
throw new Error("An Icon component requires a `type` prop to be provided");
|
|
6877
6644
|
}
|
|
6878
|
-
if ((0,
|
|
6645
|
+
if ((0, import_type_guards11.isNil)(iconMap[type])) {
|
|
6879
6646
|
throw new Error(`Type "${type}" does not exist, please update type prop in Icon component.`);
|
|
6880
6647
|
}
|
|
6881
|
-
if ((0,
|
|
6648
|
+
if ((0, import_type_guards11.isNil)(iconSizeMap[responsiveSize])) {
|
|
6882
6649
|
throw new Error(
|
|
6883
6650
|
`Size "${responsiveSize}" does not exist, please update size prop in Icon component.`
|
|
6884
6651
|
);
|
|
@@ -6909,13 +6676,13 @@ var Icon = ({
|
|
|
6909
6676
|
Icon.displayName = "Icon";
|
|
6910
6677
|
|
|
6911
6678
|
// src/components/Link/Link.tsx
|
|
6912
|
-
var
|
|
6913
|
-
var
|
|
6679
|
+
var import_react12 = require("react");
|
|
6680
|
+
var import_type_guards12 = require("@wistia/type-guards");
|
|
6914
6681
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
6915
6682
|
var import_react_router_dom = require("react-router-dom");
|
|
6916
6683
|
var import_jsx_runtime192 = require("react/jsx-runtime");
|
|
6917
6684
|
var generateHref = (href, type, disabled) => {
|
|
6918
|
-
if (disabled || (0,
|
|
6685
|
+
if (disabled || (0, import_type_guards12.isNil)(href)) {
|
|
6919
6686
|
return void 0;
|
|
6920
6687
|
}
|
|
6921
6688
|
let to = href;
|
|
@@ -6927,12 +6694,12 @@ var generateHref = (href, type, disabled) => {
|
|
|
6927
6694
|
}
|
|
6928
6695
|
return to;
|
|
6929
6696
|
};
|
|
6930
|
-
var isButton = (props) => (0,
|
|
6931
|
-
var isLink = (props) => (0,
|
|
6697
|
+
var isButton = (props) => (0, import_type_guards12.isUndefined)(props.href);
|
|
6698
|
+
var isLink = (props) => (0, import_type_guards12.isNotUndefined)(props.href);
|
|
6932
6699
|
var StyledLink = import_styled_components19.default.a`
|
|
6933
6700
|
--link-icon-size: 14px;
|
|
6934
6701
|
|
|
6935
|
-
${({ href }) => (0,
|
|
6702
|
+
${({ href }) => (0, import_type_guards12.isNil)(href) && buttonResetCss};
|
|
6936
6703
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
6937
6704
|
cursor: pointer;
|
|
6938
6705
|
font-family: var(--wui-typography-family-default);
|
|
@@ -6949,7 +6716,7 @@ var StyledLink = import_styled_components19.default.a`
|
|
|
6949
6716
|
}
|
|
6950
6717
|
}
|
|
6951
6718
|
`;
|
|
6952
|
-
var Link = (0,
|
|
6719
|
+
var Link = (0, import_react12.forwardRef)(
|
|
6953
6720
|
({
|
|
6954
6721
|
beforeAction,
|
|
6955
6722
|
children,
|
|
@@ -6973,16 +6740,16 @@ var Link = (0, import_react13.forwardRef)(
|
|
|
6973
6740
|
} catch (error) {
|
|
6974
6741
|
console.error(error);
|
|
6975
6742
|
} finally {
|
|
6976
|
-
if ((0,
|
|
6743
|
+
if ((0, import_type_guards12.isFunction)(props.onClick)) {
|
|
6977
6744
|
props.onClick(event);
|
|
6978
6745
|
} else if (routingCallback !== null) {
|
|
6979
6746
|
routingCallback();
|
|
6980
|
-
} else if ((0,
|
|
6747
|
+
} else if ((0, import_type_guards12.isNotNil)(to)) {
|
|
6981
6748
|
window.location.assign(to);
|
|
6982
6749
|
} else {
|
|
6983
6750
|
}
|
|
6984
6751
|
}
|
|
6985
|
-
} else if ((0,
|
|
6752
|
+
} else if ((0, import_type_guards12.isFunction)(props.onClick)) {
|
|
6986
6753
|
props.onClick(event);
|
|
6987
6754
|
} else {
|
|
6988
6755
|
}
|
|
@@ -7043,7 +6810,7 @@ Link.displayName = "Link";
|
|
|
7043
6810
|
|
|
7044
6811
|
// src/components/Button/Button.tsx
|
|
7045
6812
|
var import_jsx_runtime193 = require("react/jsx-runtime");
|
|
7046
|
-
var isLink2 = (props) => (0,
|
|
6813
|
+
var isLink2 = (props) => (0, import_type_guards13.isNotUndefined)(props.href);
|
|
7047
6814
|
var StyledButton = import_styled_components20.default.button`
|
|
7048
6815
|
${buttonResetCss}
|
|
7049
6816
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -7083,8 +6850,8 @@ var ButtonContent = ({
|
|
|
7083
6850
|
/* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
7084
6851
|
StyledButtonContent,
|
|
7085
6852
|
{
|
|
7086
|
-
$hasLeftIcon: (0,
|
|
7087
|
-
$hasRightIcon: (0,
|
|
6853
|
+
$hasLeftIcon: (0, import_type_guards13.isNotNil)(leftIcon),
|
|
6854
|
+
$hasRightIcon: (0, import_type_guards13.isNotNil)(rightIcon),
|
|
7088
6855
|
$isLoading: isLoading,
|
|
7089
6856
|
children: [
|
|
7090
6857
|
leftIcon ?? null,
|
|
@@ -7095,7 +6862,7 @@ var ButtonContent = ({
|
|
|
7095
6862
|
)
|
|
7096
6863
|
] });
|
|
7097
6864
|
};
|
|
7098
|
-
var Button = (0,
|
|
6865
|
+
var Button = (0, import_react13.forwardRef)(
|
|
7099
6866
|
({
|
|
7100
6867
|
children,
|
|
7101
6868
|
forceState,
|
|
@@ -7152,7 +6919,7 @@ var Button = (0, import_react14.forwardRef)(
|
|
|
7152
6919
|
event.preventDefault();
|
|
7153
6920
|
return;
|
|
7154
6921
|
}
|
|
7155
|
-
if ((0,
|
|
6922
|
+
if ((0, import_type_guards13.isNotNil)(onClick)) {
|
|
7156
6923
|
onClick(event);
|
|
7157
6924
|
}
|
|
7158
6925
|
};
|
|
@@ -7274,7 +7041,7 @@ var StyledLabel = import_styled_components21.default.span`
|
|
|
7274
7041
|
grid-row: 2;
|
|
7275
7042
|
text-align: left;
|
|
7276
7043
|
`;
|
|
7277
|
-
var ActionButton = (0,
|
|
7044
|
+
var ActionButton = (0, import_react14.forwardRef)(
|
|
7278
7045
|
({
|
|
7279
7046
|
icon,
|
|
7280
7047
|
colorScheme = "default",
|
|
@@ -7318,8 +7085,8 @@ var ActionButton = (0, import_react15.forwardRef)(
|
|
|
7318
7085
|
ActionButton.displayName = "ActionButton";
|
|
7319
7086
|
|
|
7320
7087
|
// src/components/Avatar/Avatar.tsx
|
|
7321
|
-
var
|
|
7322
|
-
var
|
|
7088
|
+
var import_react15 = require("react");
|
|
7089
|
+
var import_type_guards15 = require("@wistia/type-guards");
|
|
7323
7090
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
7324
7091
|
|
|
7325
7092
|
// src/components/ColorSchemeWrapper/ColorSchemeWrapper.tsx
|
|
@@ -7362,13 +7129,13 @@ var ColorSchemeWrapper = ({
|
|
|
7362
7129
|
ColorSchemeWrapper.displayName = "ColorSchemeWrapper";
|
|
7363
7130
|
|
|
7364
7131
|
// src/components/Avatar/formatNameForDisplay.tsx
|
|
7365
|
-
var
|
|
7132
|
+
var import_type_guards14 = require("@wistia/type-guards");
|
|
7366
7133
|
var containsEmojiCharacter = (char) => {
|
|
7367
7134
|
const emojiRegex = /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu;
|
|
7368
7135
|
return emojiRegex.test(char);
|
|
7369
7136
|
};
|
|
7370
7137
|
var formatNameForDisplay = (name) => {
|
|
7371
|
-
if ((0,
|
|
7138
|
+
if ((0, import_type_guards14.isNil)(name) || !(0, import_type_guards14.isString)(name) || (0, import_type_guards14.isEmptyString)(name) || containsEmojiCharacter(name)) {
|
|
7372
7139
|
return "U";
|
|
7373
7140
|
}
|
|
7374
7141
|
const firstChar = name.trim().substring(0, 1);
|
|
@@ -7431,7 +7198,7 @@ var AvatarWrapper = import_styled_components23.default.div`
|
|
|
7431
7198
|
max-height: ${({ $maxHeight }) => $maxHeight}px;
|
|
7432
7199
|
`;
|
|
7433
7200
|
var chooseColorScheme = (name) => {
|
|
7434
|
-
if ((0,
|
|
7201
|
+
if ((0, import_type_guards15.isNil)(name) || name === "Anonymous") {
|
|
7435
7202
|
return "default";
|
|
7436
7203
|
}
|
|
7437
7204
|
const filteredColors = colorSchemeOptions.filter(
|
|
@@ -7450,8 +7217,8 @@ var Avatar = ({
|
|
|
7450
7217
|
onImageLoad,
|
|
7451
7218
|
...otherProps
|
|
7452
7219
|
}) => {
|
|
7453
|
-
const [imageLoadState, setImageLoadState] = (0,
|
|
7454
|
-
(0,
|
|
7220
|
+
const [imageLoadState, setImageLoadState] = (0, import_react15.useState)("loading");
|
|
7221
|
+
(0, import_react15.useEffect)(() => {
|
|
7455
7222
|
setImageLoadState("loading");
|
|
7456
7223
|
}, [imageUrl]);
|
|
7457
7224
|
const handleImageLoad = () => {
|
|
@@ -7463,8 +7230,8 @@ var Avatar = ({
|
|
|
7463
7230
|
onImageLoad?.({ state: "error", type: "initials" });
|
|
7464
7231
|
};
|
|
7465
7232
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
7466
|
-
const avatarColor = (0,
|
|
7467
|
-
const showInitials = (0,
|
|
7233
|
+
const avatarColor = (0, import_react15.useMemo)(() => chooseColorScheme(name), [name]);
|
|
7234
|
+
const showInitials = (0, import_type_guards15.isNil)(imageUrl) || imageLoadState === "error";
|
|
7468
7235
|
return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
7469
7236
|
AvatarWrapper,
|
|
7470
7237
|
{
|
|
@@ -7493,9 +7260,9 @@ var Avatar = ({
|
|
|
7493
7260
|
Avatar.displayName = "Avatar";
|
|
7494
7261
|
|
|
7495
7262
|
// src/components/Badge/Badge.tsx
|
|
7496
|
-
var
|
|
7263
|
+
var import_react16 = require("react");
|
|
7497
7264
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
7498
|
-
var
|
|
7265
|
+
var import_type_guards16 = require("@wistia/type-guards");
|
|
7499
7266
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
7500
7267
|
var StyledBadge = import_styled_components24.default.div`
|
|
7501
7268
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -7517,9 +7284,9 @@ var StyledBadge = import_styled_components24.default.div`
|
|
|
7517
7284
|
width: 12px;
|
|
7518
7285
|
}
|
|
7519
7286
|
`;
|
|
7520
|
-
var Badge = (0,
|
|
7287
|
+
var Badge = (0, import_react16.forwardRef)(
|
|
7521
7288
|
({ colorScheme = "inherit", label, icon, ...otherProps }, ref) => {
|
|
7522
|
-
const hasIcon = (0,
|
|
7289
|
+
const hasIcon = (0, import_type_guards16.isNotNil)(icon);
|
|
7523
7290
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
|
|
7524
7291
|
StyledBadge,
|
|
7525
7292
|
{
|
|
@@ -7538,9 +7305,9 @@ var Badge = (0, import_react17.forwardRef)(
|
|
|
7538
7305
|
Badge.displayName = "Badge";
|
|
7539
7306
|
|
|
7540
7307
|
// src/components/Box/Box.tsx
|
|
7541
|
-
var
|
|
7308
|
+
var import_react17 = require("react");
|
|
7542
7309
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
7543
|
-
var
|
|
7310
|
+
var import_type_guards17 = require("@wistia/type-guards");
|
|
7544
7311
|
|
|
7545
7312
|
// src/private/helpers/makePolymorphic/makePolymorphic.tsx
|
|
7546
7313
|
var makePolymorphic = (component) => {
|
|
@@ -7551,8 +7318,8 @@ var makePolymorphic = (component) => {
|
|
|
7551
7318
|
var import_jsx_runtime198 = require("react/jsx-runtime");
|
|
7552
7319
|
var isDev = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
|
|
7553
7320
|
var getGapStyle = (gap) => {
|
|
7554
|
-
if ((0,
|
|
7555
|
-
if ((0,
|
|
7321
|
+
if ((0, import_type_guards17.isNotNil)(gap)) {
|
|
7322
|
+
if ((0, import_type_guards17.isRecord)(gap)) {
|
|
7556
7323
|
return Object.entries(gap).map(([key, value]) => {
|
|
7557
7324
|
return `${key}-gap: var(--wui-${value})};`;
|
|
7558
7325
|
}).join("");
|
|
@@ -7627,8 +7394,8 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
7627
7394
|
align-content: ${({ $alignContent }) => $alignContent};
|
|
7628
7395
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
7629
7396
|
align-self: ${({ $alignSelf }) => $alignSelf ?? null};
|
|
7630
|
-
display: ${({ $inline }) => (0,
|
|
7631
|
-
flex-basis: ${({ $basis }) => (0,
|
|
7397
|
+
display: ${({ $inline }) => (0, import_type_guards17.isNotNil)($inline) && $inline ? "inline-flex" : "flex"};
|
|
7398
|
+
flex-basis: ${({ $basis }) => (0, import_type_guards17.isNotNil)($basis) ? $basis : null};
|
|
7632
7399
|
flex-direction: ${({ $flexDirection }) => $flexDirection};
|
|
7633
7400
|
${({ $fillBox: fill }) => getFillStyle(fill)};
|
|
7634
7401
|
${({ $fillViewport }) => getFillViewportStyle($fillViewport)};
|
|
@@ -7638,22 +7405,22 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
7638
7405
|
width: ${({ $width }) => $width ?? null};
|
|
7639
7406
|
|
|
7640
7407
|
/* Box children styles */
|
|
7641
|
-
flex-grow: ${({ $grow }) => (0,
|
|
7642
|
-
flex-shrink: ${({ $shrink }) => (0,
|
|
7408
|
+
flex-grow: ${({ $grow }) => (0, import_type_guards17.isNotNil)($grow) ? $grow : null};
|
|
7409
|
+
flex-shrink: ${({ $shrink }) => (0, import_type_guards17.isNotNil)($shrink) ? $shrink : null};
|
|
7643
7410
|
flex-wrap: ${({ $wrapItems }) => $wrapItems ? "wrap" : "nowrap"};
|
|
7644
7411
|
justify-content: ${({ $justifyContent }) => $justifyContent};
|
|
7645
|
-
order: ${({ $order }) => (0,
|
|
7412
|
+
order: ${({ $order }) => (0, import_type_guards17.isNotNil)($order) ? $order : null};
|
|
7646
7413
|
`;
|
|
7647
7414
|
var wrapChildren = (children) => {
|
|
7648
|
-
if ((0,
|
|
7415
|
+
if ((0, import_type_guards17.isNotNil)(children)) {
|
|
7649
7416
|
if (typeof children === "object" && isDev) {
|
|
7650
|
-
return
|
|
7651
|
-
if ((0,
|
|
7417
|
+
return import_react17.Children.map(children, (child) => {
|
|
7418
|
+
if ((0, import_type_guards17.isNil)(child)) return null;
|
|
7652
7419
|
const elementParams = {};
|
|
7653
7420
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
7654
7421
|
elementParams.hasBoxParent = true;
|
|
7655
7422
|
}
|
|
7656
|
-
return (0,
|
|
7423
|
+
return (0, import_react17.cloneElement)(child, elementParams);
|
|
7657
7424
|
});
|
|
7658
7425
|
}
|
|
7659
7426
|
return children;
|
|
@@ -7661,7 +7428,7 @@ var wrapChildren = (children) => {
|
|
|
7661
7428
|
return null;
|
|
7662
7429
|
};
|
|
7663
7430
|
var DEFAULT_ELEMENT = "div";
|
|
7664
|
-
var BoxComponent = (0,
|
|
7431
|
+
var BoxComponent = (0, import_react17.forwardRef)(
|
|
7665
7432
|
({
|
|
7666
7433
|
alignContent = "stretch",
|
|
7667
7434
|
alignItems = "flex-start",
|
|
@@ -7686,7 +7453,7 @@ var BoxComponent = (0, import_react18.forwardRef)(
|
|
|
7686
7453
|
flexMode,
|
|
7687
7454
|
...otherProps
|
|
7688
7455
|
}, ref) => {
|
|
7689
|
-
if ((0,
|
|
7456
|
+
if ((0, import_type_guards17.isNotUndefined)(height)) {
|
|
7690
7457
|
if (fill === true || fill === "vertical") {
|
|
7691
7458
|
throw new Error('Cannot use height prop with fill="vertical" or fill={true}');
|
|
7692
7459
|
}
|
|
@@ -7696,7 +7463,7 @@ var BoxComponent = (0, import_react18.forwardRef)(
|
|
|
7696
7463
|
);
|
|
7697
7464
|
}
|
|
7698
7465
|
}
|
|
7699
|
-
if ((0,
|
|
7466
|
+
if ((0, import_type_guards17.isNotUndefined)(width)) {
|
|
7700
7467
|
if (fill === true || fill === "horizontal") {
|
|
7701
7468
|
throw new Error('Cannot use width prop with fill="horizontal" or fill={true}');
|
|
7702
7469
|
}
|
|
@@ -7738,7 +7505,7 @@ BoxComponent.displayName = "Box";
|
|
|
7738
7505
|
var Box = makePolymorphic(BoxComponent);
|
|
7739
7506
|
|
|
7740
7507
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
7741
|
-
var
|
|
7508
|
+
var import_react18 = require("react");
|
|
7742
7509
|
var import_styled_components26 = __toESM(require("styled-components"));
|
|
7743
7510
|
var import_jsx_runtime199 = require("react/jsx-runtime");
|
|
7744
7511
|
var StyledBreadcrumbs = import_styled_components26.default.nav`
|
|
@@ -7754,7 +7521,7 @@ var StyledBreadcrumbs = import_styled_components26.default.nav`
|
|
|
7754
7521
|
var BUFFER_WIDTH = 10;
|
|
7755
7522
|
var Breadcrumbs = ({ children, ...props }) => {
|
|
7756
7523
|
const { isXsAndDown } = useMq();
|
|
7757
|
-
let crumbs =
|
|
7524
|
+
let crumbs = import_react18.Children.toArray(children);
|
|
7758
7525
|
if (isXsAndDown) {
|
|
7759
7526
|
crumbs = crumbs.slice(-1);
|
|
7760
7527
|
}
|
|
@@ -7821,7 +7588,7 @@ var Breadcrumb = ({ icon, href, children, ...props }) => {
|
|
|
7821
7588
|
|
|
7822
7589
|
// src/components/ButtonGroup/ButtonGroup.tsx
|
|
7823
7590
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
7824
|
-
var
|
|
7591
|
+
var import_type_guards18 = require("@wistia/type-guards");
|
|
7825
7592
|
var import_jsx_runtime201 = require("react/jsx-runtime");
|
|
7826
7593
|
var getAlignment = (align) => {
|
|
7827
7594
|
if (align === "center") {
|
|
@@ -7867,7 +7634,7 @@ var ButtonGroup = ({
|
|
|
7867
7634
|
collapseOnSmallScreens = true,
|
|
7868
7635
|
...otherProps
|
|
7869
7636
|
}) => {
|
|
7870
|
-
if ((0,
|
|
7637
|
+
if ((0, import_type_guards18.isNil)(children)) {
|
|
7871
7638
|
return null;
|
|
7872
7639
|
}
|
|
7873
7640
|
return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
|
|
@@ -7941,7 +7708,7 @@ var Card = ({
|
|
|
7941
7708
|
Card.displayName = "Card";
|
|
7942
7709
|
|
|
7943
7710
|
// src/components/Center/Center.tsx
|
|
7944
|
-
var
|
|
7711
|
+
var import_react19 = require("react");
|
|
7945
7712
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
7946
7713
|
var import_jsx_runtime203 = require("react/jsx-runtime");
|
|
7947
7714
|
var StyledCenter = import_styled_components30.default.div`
|
|
@@ -7956,7 +7723,7 @@ var StyledCenter = import_styled_components30.default.div`
|
|
|
7956
7723
|
align-items: center;
|
|
7957
7724
|
`}
|
|
7958
7725
|
`;
|
|
7959
|
-
var Center = (0,
|
|
7726
|
+
var Center = (0, import_react19.forwardRef)(
|
|
7960
7727
|
({ maxWidth = "100%", gutterWidth = "space-00", intrinsic = false, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
|
|
7961
7728
|
StyledCenter,
|
|
7962
7729
|
{
|
|
@@ -7972,17 +7739,17 @@ var Center = (0, import_react20.forwardRef)(
|
|
|
7972
7739
|
Center.displayName = "Center";
|
|
7973
7740
|
|
|
7974
7741
|
// src/components/Checkbox/Checkbox.tsx
|
|
7975
|
-
var
|
|
7742
|
+
var import_react20 = require("react");
|
|
7976
7743
|
var import_styled_components34 = __toESM(require("styled-components"));
|
|
7977
|
-
var
|
|
7744
|
+
var import_type_guards22 = require("@wistia/type-guards");
|
|
7978
7745
|
|
|
7979
7746
|
// src/private/components/FormControlLabel/FormControlLabel.tsx
|
|
7980
7747
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
7981
|
-
var
|
|
7748
|
+
var import_type_guards21 = require("@wistia/type-guards");
|
|
7982
7749
|
|
|
7983
7750
|
// src/private/components/FormControlLabel/FormControlLabelDescription.tsx
|
|
7984
7751
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
7985
|
-
var
|
|
7752
|
+
var import_type_guards19 = require("@wistia/type-guards");
|
|
7986
7753
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
7987
7754
|
var disabledStyle = import_styled_components31.css`
|
|
7988
7755
|
color: var(--wui-color-text-disabled);
|
|
@@ -8002,7 +7769,7 @@ var FormControlLabelDescription = ({
|
|
|
8002
7769
|
disabled = false,
|
|
8003
7770
|
...props
|
|
8004
7771
|
}) => {
|
|
8005
|
-
if ((0,
|
|
7772
|
+
if ((0, import_type_guards19.isNil)(children)) {
|
|
8006
7773
|
return null;
|
|
8007
7774
|
}
|
|
8008
7775
|
return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
|
|
@@ -8018,7 +7785,7 @@ FormControlLabelDescription.displayName = "FormControlLabelDescription";
|
|
|
8018
7785
|
|
|
8019
7786
|
// src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
|
|
8020
7787
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
8021
|
-
var
|
|
7788
|
+
var import_type_guards20 = require("@wistia/type-guards");
|
|
8022
7789
|
var import_jsx_runtime205 = require("react/jsx-runtime");
|
|
8023
7790
|
var VisuallyHidden = import_styled_components32.default.div({ ...visuallyHiddenStyle });
|
|
8024
7791
|
var VisuallyHiddenButFocusable = import_styled_components32.default.div({
|
|
@@ -8030,7 +7797,7 @@ var ScreenReaderOnly = ({
|
|
|
8030
7797
|
focusable = false,
|
|
8031
7798
|
...otherProps
|
|
8032
7799
|
}) => {
|
|
8033
|
-
const accessibleText = (0,
|
|
7800
|
+
const accessibleText = (0, import_type_guards20.isNotNil)(text) ? text : children;
|
|
8034
7801
|
if (focusable) {
|
|
8035
7802
|
return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(VisuallyHiddenButFocusable, { ...otherProps, children: accessibleText });
|
|
8036
7803
|
}
|
|
@@ -8070,7 +7837,7 @@ var FormControlLabel = ({
|
|
|
8070
7837
|
hideLabel = false,
|
|
8071
7838
|
...props
|
|
8072
7839
|
}) => {
|
|
8073
|
-
if ((0,
|
|
7840
|
+
if ((0, import_type_guards21.isNil)(label)) {
|
|
8074
7841
|
return null;
|
|
8075
7842
|
}
|
|
8076
7843
|
const labelContent = hideLabel ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(ScreenReaderOnly, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(StyledLabelWrapper, { children: [
|
|
@@ -8084,7 +7851,7 @@ var FormControlLabel = ({
|
|
|
8084
7851
|
htmlFor,
|
|
8085
7852
|
...props,
|
|
8086
7853
|
children: [
|
|
8087
|
-
(0,
|
|
7854
|
+
(0, import_type_guards21.isNotNil)(controlSlot) ? controlSlot : null,
|
|
8088
7855
|
labelContent
|
|
8089
7856
|
]
|
|
8090
7857
|
}
|
|
@@ -8192,7 +7959,7 @@ var StyledHiddenCheckboxInput = import_styled_components34.default.input`
|
|
|
8192
7959
|
display: block;
|
|
8193
7960
|
}
|
|
8194
7961
|
`;
|
|
8195
|
-
var Checkbox = (0,
|
|
7962
|
+
var Checkbox = (0, import_react20.forwardRef)(
|
|
8196
7963
|
({
|
|
8197
7964
|
checked,
|
|
8198
7965
|
disabled = false,
|
|
@@ -8207,8 +7974,8 @@ var Checkbox = (0, import_react21.forwardRef)(
|
|
|
8207
7974
|
hideLabel = false,
|
|
8208
7975
|
...props
|
|
8209
7976
|
}, ref) => {
|
|
8210
|
-
const generatedId = (0,
|
|
8211
|
-
const computedId = (0,
|
|
7977
|
+
const generatedId = (0, import_react20.useId)();
|
|
7978
|
+
const computedId = (0, import_type_guards22.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-${generatedId}`;
|
|
8212
7979
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(StyledCheckboxWrapper, { disabled, children: [
|
|
8213
7980
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
8214
7981
|
StyledHiddenCheckboxInput,
|
|
@@ -8250,9 +8017,9 @@ var Checkbox = (0, import_react21.forwardRef)(
|
|
|
8250
8017
|
Checkbox.displayName = "Checkbox";
|
|
8251
8018
|
|
|
8252
8019
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
8253
|
-
var
|
|
8020
|
+
var import_react21 = require("react");
|
|
8254
8021
|
var ClickRegion = ({ children, targetRef }) => {
|
|
8255
|
-
(0,
|
|
8022
|
+
(0, import_react21.useEffect)(() => {
|
|
8256
8023
|
if (targetRef.current && targetRef.current.tagName === "A") {
|
|
8257
8024
|
targetRef.current.setAttribute("data-click-region-target-link", "");
|
|
8258
8025
|
} else if (targetRef.current && targetRef.current.tagName === "BUTTON") {
|
|
@@ -8260,7 +8027,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8260
8027
|
} else {
|
|
8261
8028
|
}
|
|
8262
8029
|
}, [targetRef]);
|
|
8263
|
-
const handleClick = (0,
|
|
8030
|
+
const handleClick = (0, import_react21.useCallback)(
|
|
8264
8031
|
(event) => {
|
|
8265
8032
|
const node = targetRef.current;
|
|
8266
8033
|
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")) {
|
|
@@ -8277,7 +8044,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8277
8044
|
},
|
|
8278
8045
|
[targetRef]
|
|
8279
8046
|
);
|
|
8280
|
-
return (0,
|
|
8047
|
+
return (0, import_react21.cloneElement)(import_react21.Children.only(children), {
|
|
8281
8048
|
"data-click-region": true,
|
|
8282
8049
|
onClick: handleClick
|
|
8283
8050
|
});
|
|
@@ -8286,7 +8053,7 @@ ClickRegion.displayName = "ClickRegion";
|
|
|
8286
8053
|
|
|
8287
8054
|
// src/components/Collapsible/Collapsible.tsx
|
|
8288
8055
|
var import_react_collapsible = require("@radix-ui/react-collapsible");
|
|
8289
|
-
var
|
|
8056
|
+
var import_type_guards23 = require("@wistia/type-guards");
|
|
8290
8057
|
var import_styled_components35 = __toESM(require("styled-components"));
|
|
8291
8058
|
var import_jsx_runtime208 = require("react/jsx-runtime");
|
|
8292
8059
|
var StyledRoot = (0, import_styled_components35.default)(import_react_collapsible.Root)`
|
|
@@ -8303,31 +8070,31 @@ var Collapsible = ({
|
|
|
8303
8070
|
onOpenChange
|
|
8304
8071
|
}) => {
|
|
8305
8072
|
const controlProps = {
|
|
8306
|
-
...(0,
|
|
8073
|
+
...(0, import_type_guards23.isNotNil)(onOpenChange) && (0, import_type_guards23.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
8307
8074
|
};
|
|
8308
8075
|
return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(StyledRoot, { ...controlProps, children });
|
|
8309
8076
|
};
|
|
8310
8077
|
Collapsible.displayName = "Collapsible";
|
|
8311
8078
|
|
|
8312
8079
|
// src/components/Collapsible/CollapsibleTrigger.tsx
|
|
8313
|
-
var
|
|
8080
|
+
var import_react22 = require("react");
|
|
8314
8081
|
var import_react_collapsible2 = require("@radix-ui/react-collapsible");
|
|
8315
8082
|
var import_jsx_runtime209 = require("react/jsx-runtime");
|
|
8316
8083
|
var CollapsibleTrigger = ({ children }) => {
|
|
8317
|
-
|
|
8084
|
+
import_react22.Children.only(children);
|
|
8318
8085
|
return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_react_collapsible2.Trigger, { asChild: true, children });
|
|
8319
8086
|
};
|
|
8320
8087
|
|
|
8321
8088
|
// src/components/Collapsible/CollapsibleContent.tsx
|
|
8322
8089
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
8323
8090
|
var import_react_collapsible3 = require("@radix-ui/react-collapsible");
|
|
8324
|
-
var
|
|
8091
|
+
var import_type_guards24 = require("@wistia/type-guards");
|
|
8325
8092
|
var import_jsx_runtime210 = require("react/jsx-runtime");
|
|
8326
8093
|
var ClampedContent = import_styled_components36.default.div.attrs({ "data-wui-collapsible-content": true })`
|
|
8327
8094
|
--wui-collapsible-content-clamp-lines: ${({ $clamp }) => $clamp};
|
|
8328
8095
|
`;
|
|
8329
8096
|
var CollapsibleContent = ({ clamp, children }) => {
|
|
8330
|
-
if ((0,
|
|
8097
|
+
if ((0, import_type_guards24.isNotUndefined)(clamp)) {
|
|
8331
8098
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(ClampedContent, { $clamp: clamp, children });
|
|
8332
8099
|
}
|
|
8333
8100
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(import_react_collapsible3.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(import_jsx_runtime210.Fragment, { children: [
|
|
@@ -8338,10 +8105,10 @@ var CollapsibleContent = ({ clamp, children }) => {
|
|
|
8338
8105
|
|
|
8339
8106
|
// src/components/DataCards/DataCard.tsx
|
|
8340
8107
|
var import_styled_components38 = __toESM(require("styled-components"));
|
|
8341
|
-
var
|
|
8108
|
+
var import_type_guards25 = require("@wistia/type-guards");
|
|
8342
8109
|
|
|
8343
8110
|
// src/components/Heading/Heading.tsx
|
|
8344
|
-
var
|
|
8111
|
+
var import_react23 = require("react");
|
|
8345
8112
|
var import_styled_components37 = __toESM(require("styled-components"));
|
|
8346
8113
|
var import_jsx_runtime211 = require("react/jsx-runtime");
|
|
8347
8114
|
var heroStyle = import_styled_components37.css`
|
|
@@ -8428,7 +8195,7 @@ var variantElementMap = {
|
|
|
8428
8195
|
heading5: "h5",
|
|
8429
8196
|
heading6: "h6"
|
|
8430
8197
|
};
|
|
8431
|
-
var HeadingComponent = (0,
|
|
8198
|
+
var HeadingComponent = (0, import_react23.forwardRef)(
|
|
8432
8199
|
({
|
|
8433
8200
|
align = "left",
|
|
8434
8201
|
colorScheme = "inherit",
|
|
@@ -8547,8 +8314,8 @@ var DataCard = ({
|
|
|
8547
8314
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledLoadingValue, {}) : value
|
|
8548
8315
|
}
|
|
8549
8316
|
),
|
|
8550
|
-
(0,
|
|
8551
|
-
(0,
|
|
8317
|
+
(0, import_type_guards25.isNotNull)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledSlot, { children: upperRightSlot }),
|
|
8318
|
+
(0, import_type_guards25.isNotNull)(trend) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledDataCardTrendContainer, { children: trend })
|
|
8552
8319
|
]
|
|
8553
8320
|
}
|
|
8554
8321
|
);
|
|
@@ -8592,7 +8359,7 @@ DataCards.displayName = "DataCards";
|
|
|
8592
8359
|
var import_styled_components41 = __toESM(require("styled-components"));
|
|
8593
8360
|
|
|
8594
8361
|
// src/components/Text/Text.tsx
|
|
8595
|
-
var
|
|
8362
|
+
var import_react24 = require("react");
|
|
8596
8363
|
var import_styled_components40 = __toESM(require("styled-components"));
|
|
8597
8364
|
var import_jsx_runtime214 = require("react/jsx-runtime");
|
|
8598
8365
|
var bodyBoldStyles = import_styled_components40.css`
|
|
@@ -8758,7 +8525,7 @@ var StyledText = import_styled_components40.default.div`
|
|
|
8758
8525
|
}
|
|
8759
8526
|
`}
|
|
8760
8527
|
`;
|
|
8761
|
-
var TextComponent = (0,
|
|
8528
|
+
var TextComponent = (0, import_react24.forwardRef)(
|
|
8762
8529
|
({
|
|
8763
8530
|
align = "left",
|
|
8764
8531
|
colorScheme = "inherit",
|
|
@@ -8874,7 +8641,7 @@ Divider.displayName = "Divider";
|
|
|
8874
8641
|
|
|
8875
8642
|
// src/components/EditableHeading/EditableHeading.tsx
|
|
8876
8643
|
var import_styled_components45 = __toESM(require("styled-components"));
|
|
8877
|
-
var
|
|
8644
|
+
var import_react26 = require("react");
|
|
8878
8645
|
|
|
8879
8646
|
// src/components/Tooltip/Tooltip.tsx
|
|
8880
8647
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
@@ -8983,9 +8750,9 @@ var Tooltip = ({
|
|
|
8983
8750
|
Tooltip.displayName = "Tooltip";
|
|
8984
8751
|
|
|
8985
8752
|
// src/components/Input/Input.tsx
|
|
8986
|
-
var
|
|
8753
|
+
var import_react25 = require("react");
|
|
8987
8754
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
8988
|
-
var
|
|
8755
|
+
var import_type_guards26 = require("@wistia/type-guards");
|
|
8989
8756
|
var import_jsx_runtime218 = require("react/jsx-runtime");
|
|
8990
8757
|
var inputStyles = import_styled_components44.css`
|
|
8991
8758
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -9072,7 +8839,7 @@ var StyledInputContainer = import_styled_components44.default.div`
|
|
|
9072
8839
|
padding-right: 32px;
|
|
9073
8840
|
}
|
|
9074
8841
|
`;
|
|
9075
|
-
var Input = (0,
|
|
8842
|
+
var Input = (0, import_react25.forwardRef)(
|
|
9076
8843
|
({
|
|
9077
8844
|
fullWidth = true,
|
|
9078
8845
|
monospace = false,
|
|
@@ -9082,30 +8849,30 @@ var Input = (0, import_react26.forwardRef)(
|
|
|
9082
8849
|
rightIcon,
|
|
9083
8850
|
...props
|
|
9084
8851
|
}, externalRef) => {
|
|
9085
|
-
const internalRef = (0,
|
|
8852
|
+
const internalRef = (0, import_react25.useRef)();
|
|
9086
8853
|
const ref = (
|
|
9087
8854
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
9088
|
-
(0,
|
|
8855
|
+
(0, import_type_guards26.isNotNil)(externalRef) && (0, import_type_guards26.isRecord)(externalRef) && "current" in externalRef ? externalRef : internalRef
|
|
9089
8856
|
);
|
|
9090
8857
|
let leftIconToDisplay = leftIcon;
|
|
9091
|
-
if ((0,
|
|
8858
|
+
if ((0, import_type_guards26.isNil)(leftIcon) && type === "search") {
|
|
9092
8859
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(Icon, { type: "search" });
|
|
9093
8860
|
}
|
|
9094
|
-
if ((0,
|
|
9095
|
-
leftIconToDisplay = (0,
|
|
8861
|
+
if ((0, import_type_guards26.isNotNil)(leftIconToDisplay)) {
|
|
8862
|
+
leftIconToDisplay = (0, import_react25.cloneElement)(leftIconToDisplay, {
|
|
9096
8863
|
size: "md",
|
|
9097
8864
|
className: "wui-input-left-icon"
|
|
9098
8865
|
});
|
|
9099
8866
|
}
|
|
9100
8867
|
let rightIconToDisplay = rightIcon;
|
|
9101
|
-
if ((0,
|
|
9102
|
-
rightIconToDisplay = (0,
|
|
8868
|
+
if ((0, import_type_guards26.isNotNil)(rightIconToDisplay)) {
|
|
8869
|
+
rightIconToDisplay = (0, import_react25.cloneElement)(rightIconToDisplay, {
|
|
9103
8870
|
size: "md",
|
|
9104
8871
|
className: "wui-input-right-icon"
|
|
9105
8872
|
});
|
|
9106
8873
|
}
|
|
9107
|
-
const
|
|
9108
|
-
if ((0,
|
|
8874
|
+
const handleFocus = (event) => {
|
|
8875
|
+
if ((0, import_type_guards26.isNotNil)(props.onFocus)) {
|
|
9109
8876
|
props.onFocus(event);
|
|
9110
8877
|
}
|
|
9111
8878
|
if (autoSelect && isValidRef(ref) && "current" in ref) {
|
|
@@ -9126,14 +8893,14 @@ var Input = (0, import_react26.forwardRef)(
|
|
|
9126
8893
|
{
|
|
9127
8894
|
...props,
|
|
9128
8895
|
ref,
|
|
9129
|
-
onFocus:
|
|
8896
|
+
onFocus: handleFocus
|
|
9130
8897
|
}
|
|
9131
8898
|
) : /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
|
|
9132
8899
|
"input",
|
|
9133
8900
|
{
|
|
9134
8901
|
...props,
|
|
9135
8902
|
ref,
|
|
9136
|
-
onFocus:
|
|
8903
|
+
onFocus: handleFocus,
|
|
9137
8904
|
type
|
|
9138
8905
|
}
|
|
9139
8906
|
),
|
|
@@ -9194,11 +8961,11 @@ var EditableHeading = ({
|
|
|
9194
8961
|
forceEditing = false,
|
|
9195
8962
|
editingDisabled = false
|
|
9196
8963
|
}) => {
|
|
9197
|
-
const [isEditing, setIsEditing] = (0,
|
|
9198
|
-
const [value, setValue] = (0,
|
|
9199
|
-
const [previousValue, setPreviousValue] = (0,
|
|
9200
|
-
const [headingHeight, setHeadingHeight] = (0,
|
|
9201
|
-
const headingRef = (0,
|
|
8964
|
+
const [isEditing, setIsEditing] = (0, import_react26.useState)(false);
|
|
8965
|
+
const [value, setValue] = (0, import_react26.useState)(children);
|
|
8966
|
+
const [previousValue, setPreviousValue] = (0, import_react26.useState)(children);
|
|
8967
|
+
const [headingHeight, setHeadingHeight] = (0, import_react26.useState)("60");
|
|
8968
|
+
const headingRef = (0, import_react26.useRef)(null);
|
|
9202
8969
|
const handleSetEditing = (editing) => {
|
|
9203
8970
|
if (editingDisabled) return;
|
|
9204
8971
|
if (editing && headingRef.current) {
|
|
@@ -9284,12 +9051,12 @@ var EditableHeading = ({
|
|
|
9284
9051
|
};
|
|
9285
9052
|
|
|
9286
9053
|
// src/components/Form/Form.tsx
|
|
9287
|
-
var
|
|
9054
|
+
var import_react28 = require("react");
|
|
9288
9055
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
9289
|
-
var
|
|
9056
|
+
var import_type_guards27 = require("@wistia/type-guards");
|
|
9290
9057
|
|
|
9291
9058
|
// src/components/Stack/Stack.tsx
|
|
9292
|
-
var
|
|
9059
|
+
var import_react27 = require("react");
|
|
9293
9060
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
9294
9061
|
var import_jsx_runtime220 = require("react/jsx-runtime");
|
|
9295
9062
|
var DEFAULT_ELEMENT4 = "div";
|
|
@@ -9299,7 +9066,7 @@ var StyledStack = import_styled_components46.default.div`
|
|
|
9299
9066
|
gap: ${({ $gap }) => `var(--wui-${$gap})`};
|
|
9300
9067
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
9301
9068
|
`;
|
|
9302
|
-
var StackComponent = (0,
|
|
9069
|
+
var StackComponent = (0, import_react27.forwardRef)(
|
|
9303
9070
|
({ renderAs, direction = "vertical", gap = "space-02", alignItems = "stretch", ...props }, ref) => {
|
|
9304
9071
|
const responsiveGap = useResponsiveProp(gap);
|
|
9305
9072
|
const responsiveDirection = useResponsiveProp(direction);
|
|
@@ -9328,7 +9095,7 @@ var StyledForm = import_styled_components47.default.form`
|
|
|
9328
9095
|
max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
|
|
9329
9096
|
align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
|
|
9330
9097
|
`;
|
|
9331
|
-
var FormContext = (0,
|
|
9098
|
+
var FormContext = (0, import_react28.createContext)({
|
|
9332
9099
|
values: {},
|
|
9333
9100
|
errors: {},
|
|
9334
9101
|
hasSubmitted: false,
|
|
@@ -9344,25 +9111,25 @@ var FormComponent = ({
|
|
|
9344
9111
|
fullWidth = false,
|
|
9345
9112
|
...props
|
|
9346
9113
|
}, forwardedRef) => {
|
|
9347
|
-
const [errors, setErrors] = (0,
|
|
9348
|
-
const [hasSubmitted, setHasSubmitted] = (0,
|
|
9349
|
-
const innerRef = (0,
|
|
9114
|
+
const [errors, setErrors] = (0, import_react28.useState)({});
|
|
9115
|
+
const [hasSubmitted, setHasSubmitted] = (0, import_react28.useState)(false);
|
|
9116
|
+
const innerRef = (0, import_react28.useRef)();
|
|
9350
9117
|
const ref = forwardedRef ?? innerRef;
|
|
9351
|
-
const autoId = (0,
|
|
9118
|
+
const autoId = (0, import_react28.useId)();
|
|
9352
9119
|
const id = props.id ?? autoId;
|
|
9353
9120
|
const handleValidate = (nextFormData) => {
|
|
9354
9121
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
9355
|
-
if ((0,
|
|
9122
|
+
if ((0, import_type_guards27.isUndefined)(validate)) {
|
|
9356
9123
|
return {};
|
|
9357
9124
|
}
|
|
9358
9125
|
return validate(nextData);
|
|
9359
9126
|
};
|
|
9360
|
-
const
|
|
9127
|
+
const handleBlur = (event) => {
|
|
9361
9128
|
if (props.onBlur) {
|
|
9362
9129
|
props.onBlur(event);
|
|
9363
9130
|
}
|
|
9364
9131
|
const formData = new FormData(event.currentTarget);
|
|
9365
|
-
if ((0,
|
|
9132
|
+
if ((0, import_type_guards27.isNotUndefined)(validate)) {
|
|
9366
9133
|
handleValidate(formData);
|
|
9367
9134
|
}
|
|
9368
9135
|
};
|
|
@@ -9390,7 +9157,7 @@ var FormComponent = ({
|
|
|
9390
9157
|
void action(null);
|
|
9391
9158
|
}
|
|
9392
9159
|
};
|
|
9393
|
-
const context = (0,
|
|
9160
|
+
const context = (0, import_react28.useMemo)(() => {
|
|
9394
9161
|
return {
|
|
9395
9162
|
values,
|
|
9396
9163
|
errors,
|
|
@@ -9410,7 +9177,7 @@ var FormComponent = ({
|
|
|
9410
9177
|
as: StyledForm,
|
|
9411
9178
|
gap: "space-05",
|
|
9412
9179
|
id,
|
|
9413
|
-
onBlur:
|
|
9180
|
+
onBlur: handleBlur,
|
|
9414
9181
|
onReset: handleReset,
|
|
9415
9182
|
onSubmit: handleSubmit,
|
|
9416
9183
|
children
|
|
@@ -9419,15 +9186,15 @@ var FormComponent = ({
|
|
|
9419
9186
|
);
|
|
9420
9187
|
};
|
|
9421
9188
|
FormComponent.displayName = "Form";
|
|
9422
|
-
var Form = (0,
|
|
9189
|
+
var Form = (0, import_react28.forwardRef)(FormComponent);
|
|
9423
9190
|
|
|
9424
9191
|
// src/components/Form/useFormState.tsx
|
|
9425
|
-
var
|
|
9192
|
+
var import_react29 = require("react");
|
|
9426
9193
|
var useFormState = (action, initialData = {}) => {
|
|
9427
|
-
const [data, setData] = (0,
|
|
9428
|
-
const [isPending, setIsPending] = (0,
|
|
9429
|
-
const [error, setError] = (0,
|
|
9430
|
-
const formAction = (0,
|
|
9194
|
+
const [data, setData] = (0, import_react29.useState)(initialData);
|
|
9195
|
+
const [isPending, setIsPending] = (0, import_react29.useState)(false);
|
|
9196
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
9197
|
+
const formAction = (0, import_react29.useCallback)(
|
|
9431
9198
|
async (nextFormData) => {
|
|
9432
9199
|
if (nextFormData === null) {
|
|
9433
9200
|
setData(initialData);
|
|
@@ -9458,23 +9225,23 @@ var useFormState = (action, initialData = {}) => {
|
|
|
9458
9225
|
};
|
|
9459
9226
|
|
|
9460
9227
|
// src/components/Form/FormErrorSummary.tsx
|
|
9461
|
-
var
|
|
9462
|
-
var
|
|
9228
|
+
var import_react30 = require("react");
|
|
9229
|
+
var import_type_guards28 = require("@wistia/type-guards");
|
|
9463
9230
|
var import_jsx_runtime222 = require("react/jsx-runtime");
|
|
9464
9231
|
var ErrorItem = ({ name, error, formId }) => {
|
|
9465
9232
|
return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(Link, { href: `#${formId}-${name}`, children: error }) }, name);
|
|
9466
9233
|
};
|
|
9467
9234
|
var FormErrorSummary = ({ description }) => {
|
|
9468
|
-
const ref = (0,
|
|
9469
|
-
const { formId, errors, hasSubmitted } = (0,
|
|
9235
|
+
const ref = (0, import_react30.useRef)(null);
|
|
9236
|
+
const { formId, errors, hasSubmitted } = (0, import_react30.useContext)(FormContext);
|
|
9470
9237
|
const isValid = Object.keys(errors).length === 0;
|
|
9471
9238
|
if (isValid || !hasSubmitted) {
|
|
9472
9239
|
return null;
|
|
9473
9240
|
}
|
|
9474
9241
|
return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { ref, children: [
|
|
9475
9242
|
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { children: description }),
|
|
9476
|
-
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0,
|
|
9477
|
-
([name, error]) => (0,
|
|
9243
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0, import_type_guards28.isNotUndefined)(error)).map(
|
|
9244
|
+
([name, error]) => (0, import_type_guards28.isArray)(error) ? error.map((err) => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
9478
9245
|
ErrorItem,
|
|
9479
9246
|
{
|
|
9480
9247
|
error: err,
|
|
@@ -9496,9 +9263,9 @@ var FormErrorSummary = ({ description }) => {
|
|
|
9496
9263
|
};
|
|
9497
9264
|
|
|
9498
9265
|
// src/components/FormField/FormField.tsx
|
|
9499
|
-
var
|
|
9266
|
+
var import_react33 = require("react");
|
|
9500
9267
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
9501
|
-
var
|
|
9268
|
+
var import_type_guards29 = require("@wistia/type-guards");
|
|
9502
9269
|
|
|
9503
9270
|
// src/components/Label/Label.tsx
|
|
9504
9271
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
@@ -9561,11 +9328,11 @@ var Label = ({
|
|
|
9561
9328
|
Label.displayName = "Label";
|
|
9562
9329
|
|
|
9563
9330
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9564
|
-
var
|
|
9331
|
+
var import_react32 = require("react");
|
|
9565
9332
|
|
|
9566
9333
|
// src/components/FormGroup/FormGroup.tsx
|
|
9567
9334
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
9568
|
-
var
|
|
9335
|
+
var import_react31 = require("react");
|
|
9569
9336
|
var import_jsx_runtime224 = require("react/jsx-runtime");
|
|
9570
9337
|
var StyledFieldset = import_styled_components49.default.fieldset`
|
|
9571
9338
|
border: 0;
|
|
@@ -9574,7 +9341,7 @@ var StyledLegend = import_styled_components49.default.legend`
|
|
|
9574
9341
|
margin-bottom: var(--space-01);
|
|
9575
9342
|
`;
|
|
9576
9343
|
var FormGroup = ({ children, label, ...props }) => {
|
|
9577
|
-
const ref = (0,
|
|
9344
|
+
const ref = (0, import_react31.useRef)();
|
|
9578
9345
|
return /* @__PURE__ */ (0, import_jsx_runtime224.jsxs)(
|
|
9579
9346
|
Stack,
|
|
9580
9347
|
{
|
|
@@ -9599,7 +9366,7 @@ FormGroup.displayName = "FormGroup";
|
|
|
9599
9366
|
|
|
9600
9367
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9601
9368
|
var import_jsx_runtime225 = require("react/jsx-runtime");
|
|
9602
|
-
var CheckboxGroupContext = (0,
|
|
9369
|
+
var CheckboxGroupContext = (0, import_react32.createContext)(null);
|
|
9603
9370
|
var CheckboxGroup = ({
|
|
9604
9371
|
children,
|
|
9605
9372
|
name,
|
|
@@ -9607,7 +9374,7 @@ var CheckboxGroup = ({
|
|
|
9607
9374
|
value,
|
|
9608
9375
|
...props
|
|
9609
9376
|
}) => {
|
|
9610
|
-
const context = (0,
|
|
9377
|
+
const context = (0, import_react32.useMemo)(() => {
|
|
9611
9378
|
return {
|
|
9612
9379
|
name,
|
|
9613
9380
|
onChange
|
|
@@ -9658,7 +9425,7 @@ var StyledErrorList = import_styled_components50.default.ul`
|
|
|
9658
9425
|
gap: var(--wui-space-01);
|
|
9659
9426
|
`;
|
|
9660
9427
|
var ErrorMessages = ({ errors, id }) => {
|
|
9661
|
-
const isMultipleErrors = (0,
|
|
9428
|
+
const isMultipleErrors = (0, import_type_guards29.isArray)(errors);
|
|
9662
9429
|
return isMultipleErrors ? /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(StyledErrorList, { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
|
|
9663
9430
|
Text,
|
|
9664
9431
|
{
|
|
@@ -9692,8 +9459,8 @@ var FormField = ({
|
|
|
9692
9459
|
value,
|
|
9693
9460
|
...props
|
|
9694
9461
|
}) => {
|
|
9695
|
-
const formState = (0,
|
|
9696
|
-
const checkboxGroup = (0,
|
|
9462
|
+
const formState = (0, import_react33.useContext)(FormContext);
|
|
9463
|
+
const checkboxGroup = (0, import_react33.useContext)(CheckboxGroupContext);
|
|
9697
9464
|
const defaultValue = formState.values[name];
|
|
9698
9465
|
const isIntegratedLabel = children.type === Checkbox;
|
|
9699
9466
|
const computedId = id ?? `${formState.formId}-${name}`;
|
|
@@ -9708,19 +9475,19 @@ var FormField = ({
|
|
|
9708
9475
|
"aria-describedby": ariaDescribedby,
|
|
9709
9476
|
...props
|
|
9710
9477
|
};
|
|
9711
|
-
if ((0,
|
|
9478
|
+
if ((0, import_type_guards29.isUndefined)(value) && (0, import_type_guards29.isNotUndefined)(defaultValue)) {
|
|
9712
9479
|
childProps = {
|
|
9713
9480
|
...childProps,
|
|
9714
9481
|
defaultValue
|
|
9715
9482
|
};
|
|
9716
9483
|
}
|
|
9717
|
-
if ((0,
|
|
9718
|
-
const computedName = (0,
|
|
9484
|
+
if ((0, import_type_guards29.isNotNil)(checkboxGroup)) {
|
|
9485
|
+
const computedName = (0, import_type_guards29.isNotNil)(checkboxGroup.name) ? `${checkboxGroup.name}[${name}]` : name;
|
|
9719
9486
|
const handleChange = (event) => {
|
|
9720
|
-
if ((0,
|
|
9487
|
+
if ((0, import_type_guards29.isNotUndefined)(props.onChange)) {
|
|
9721
9488
|
props.onChange(event);
|
|
9722
9489
|
}
|
|
9723
|
-
if ((0,
|
|
9490
|
+
if ((0, import_type_guards29.isNotUndefined)(checkboxGroup.onChange)) {
|
|
9724
9491
|
checkboxGroup.onChange(event);
|
|
9725
9492
|
}
|
|
9726
9493
|
};
|
|
@@ -9728,10 +9495,10 @@ var FormField = ({
|
|
|
9728
9495
|
...childProps,
|
|
9729
9496
|
name: computedName,
|
|
9730
9497
|
onChange: handleChange,
|
|
9731
|
-
"aria-invalid": (0,
|
|
9498
|
+
"aria-invalid": (0, import_type_guards29.isNotNil)(error)
|
|
9732
9499
|
};
|
|
9733
9500
|
}
|
|
9734
|
-
|
|
9501
|
+
import_react33.Children.only(children);
|
|
9735
9502
|
return /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(
|
|
9736
9503
|
StyledFormField,
|
|
9737
9504
|
{
|
|
@@ -9739,9 +9506,9 @@ var FormField = ({
|
|
|
9739
9506
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
9740
9507
|
children: [
|
|
9741
9508
|
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(Label, { htmlFor: computedId, children: label }),
|
|
9742
|
-
(0,
|
|
9743
|
-
(0,
|
|
9744
|
-
(0,
|
|
9509
|
+
(0, import_type_guards29.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
9510
|
+
(0, import_react33.cloneElement)(children, childProps),
|
|
9511
|
+
(0, import_type_guards29.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(import_jsx_runtime226.Fragment, { children: [
|
|
9745
9512
|
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)("div", {}),
|
|
9746
9513
|
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
|
|
9747
9514
|
ErrorMessages,
|
|
@@ -9758,9 +9525,9 @@ var FormField = ({
|
|
|
9758
9525
|
FormField.displayName = "FormField";
|
|
9759
9526
|
|
|
9760
9527
|
// src/components/FormGroup/RadioGroup.tsx
|
|
9761
|
-
var
|
|
9528
|
+
var import_react34 = require("react");
|
|
9762
9529
|
var import_jsx_runtime227 = require("react/jsx-runtime");
|
|
9763
|
-
var RadioGroupContext = (0,
|
|
9530
|
+
var RadioGroupContext = (0, import_react34.createContext)(null);
|
|
9764
9531
|
var RadioGroup = ({
|
|
9765
9532
|
children,
|
|
9766
9533
|
name,
|
|
@@ -9768,7 +9535,7 @@ var RadioGroup = ({
|
|
|
9768
9535
|
value,
|
|
9769
9536
|
...props
|
|
9770
9537
|
}) => {
|
|
9771
|
-
const context = (0,
|
|
9538
|
+
const context = (0, import_react34.useMemo)(() => {
|
|
9772
9539
|
return {
|
|
9773
9540
|
name,
|
|
9774
9541
|
onChange
|
|
@@ -9779,7 +9546,7 @@ var RadioGroup = ({
|
|
|
9779
9546
|
RadioGroup.displayName = "RadioGroup";
|
|
9780
9547
|
|
|
9781
9548
|
// src/components/IconButton/IconButton.tsx
|
|
9782
|
-
var
|
|
9549
|
+
var import_react35 = require("react");
|
|
9783
9550
|
var import_styled_components51 = __toESM(require("styled-components"));
|
|
9784
9551
|
var import_jsx_runtime228 = require("react/jsx-runtime");
|
|
9785
9552
|
var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
@@ -9796,7 +9563,7 @@ var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
|
9796
9563
|
align-items: center;
|
|
9797
9564
|
line-height: 1;
|
|
9798
9565
|
`;
|
|
9799
|
-
var IconButton = (0,
|
|
9566
|
+
var IconButton = (0, import_react35.forwardRef)(
|
|
9800
9567
|
({ children, label, size = "md", ...props }, ref) => {
|
|
9801
9568
|
const responsiveSize = useResponsiveProp(size);
|
|
9802
9569
|
return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
@@ -9807,7 +9574,7 @@ var IconButton = (0, import_react36.forwardRef)(
|
|
|
9807
9574
|
"aria-label": label,
|
|
9808
9575
|
"data-wistia-ui-icon-button": true,
|
|
9809
9576
|
size: responsiveSize,
|
|
9810
|
-
children: (0,
|
|
9577
|
+
children: (0, import_react35.cloneElement)(import_react35.Children.only(children), {
|
|
9811
9578
|
size: responsiveSize
|
|
9812
9579
|
})
|
|
9813
9580
|
}
|
|
@@ -9818,7 +9585,7 @@ IconButton.displayName = "IconButton";
|
|
|
9818
9585
|
|
|
9819
9586
|
// src/components/Image/Image.tsx
|
|
9820
9587
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
9821
|
-
var
|
|
9588
|
+
var import_type_guards30 = require("@wistia/type-guards");
|
|
9822
9589
|
var import_jsx_runtime229 = require("react/jsx-runtime");
|
|
9823
9590
|
var getFillStyle2 = (fillContainer) => {
|
|
9824
9591
|
if (fillContainer === "horizontal") {
|
|
@@ -9836,7 +9603,7 @@ var getFillStyle2 = (fillContainer) => {
|
|
|
9836
9603
|
return void 0;
|
|
9837
9604
|
};
|
|
9838
9605
|
var StyledImage = import_styled_components52.default.img`
|
|
9839
|
-
border-radius: ${({ $borderRadius }) => (0,
|
|
9606
|
+
border-radius: ${({ $borderRadius }) => (0, import_type_guards30.isNotNil)($borderRadius) ? `var(--wui-${$borderRadius})` : void 0};
|
|
9840
9607
|
${({ $fillContainer }) => getFillStyle2($fillContainer)};
|
|
9841
9608
|
object-fit: ${({ $objFit }) => $objFit};
|
|
9842
9609
|
object-position: ${({ $objPosition }) => $objPosition};
|
|
@@ -9868,13 +9635,13 @@ Image.displayName = "Image";
|
|
|
9868
9635
|
// src/components/Menu/Menu.tsx
|
|
9869
9636
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
9870
9637
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
9871
|
-
var
|
|
9872
|
-
var
|
|
9638
|
+
var import_type_guards31 = require("@wistia/type-guards");
|
|
9639
|
+
var import_react37 = require("react");
|
|
9873
9640
|
|
|
9874
9641
|
// src/components/Menu/MenuContext.tsx
|
|
9875
|
-
var
|
|
9876
|
-
var MenuContext = (0,
|
|
9877
|
-
var useMenuContext = () => (0,
|
|
9642
|
+
var import_react36 = require("react");
|
|
9643
|
+
var MenuContext = (0, import_react36.createContext)({ compact: false });
|
|
9644
|
+
var useMenuContext = () => (0, import_react36.useContext)(MenuContext);
|
|
9878
9645
|
|
|
9879
9646
|
// src/components/Menu/Menu.tsx
|
|
9880
9647
|
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
@@ -9978,9 +9745,9 @@ var Menu = ({
|
|
|
9978
9745
|
onInteractOutside,
|
|
9979
9746
|
...props
|
|
9980
9747
|
}) => {
|
|
9981
|
-
const contextValue = (0,
|
|
9748
|
+
const contextValue = (0, import_react37.useMemo)(() => ({ compact }), [compact]);
|
|
9982
9749
|
let controlProps = {
|
|
9983
|
-
...(0,
|
|
9750
|
+
...(0, import_type_guards31.isNotNil)(onOpenChange) && (0, import_type_guards31.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
9984
9751
|
};
|
|
9985
9752
|
if (disabled) {
|
|
9986
9753
|
controlProps = {
|
|
@@ -9994,7 +9761,7 @@ var Menu = ({
|
|
|
9994
9761
|
modal: false,
|
|
9995
9762
|
...controlProps,
|
|
9996
9763
|
children: [
|
|
9997
|
-
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0,
|
|
9764
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0, import_type_guards31.isNotUndefined)(trigger) ? trigger : /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
9998
9765
|
Button,
|
|
9999
9766
|
{
|
|
10000
9767
|
"aria-expanded": isOpen,
|
|
@@ -10052,15 +9819,15 @@ var MenuLabel = ({ children, ...props }) => {
|
|
|
10052
9819
|
MenuLabel.displayName = "MenuLabel";
|
|
10053
9820
|
|
|
10054
9821
|
// src/components/Menu/SubMenu.tsx
|
|
10055
|
-
var
|
|
9822
|
+
var import_react39 = require("react");
|
|
10056
9823
|
var import_styled_components57 = __toESM(require("styled-components"));
|
|
10057
9824
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
10058
|
-
var
|
|
9825
|
+
var import_type_guards33 = require("@wistia/type-guards");
|
|
10059
9826
|
|
|
10060
9827
|
// src/components/Menu/MenuItemButton.tsx
|
|
10061
|
-
var
|
|
9828
|
+
var import_react38 = require("react");
|
|
10062
9829
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
10063
|
-
var
|
|
9830
|
+
var import_type_guards32 = require("@wistia/type-guards");
|
|
10064
9831
|
var import_jsx_runtime232 = require("react/jsx-runtime");
|
|
10065
9832
|
var StyledButton3 = (0, import_styled_components55.default)(Button)`
|
|
10066
9833
|
${({ colorScheme }) => getColorScheme(colorScheme)};
|
|
@@ -10135,10 +9902,10 @@ var StyledBadgeContainer = import_styled_components55.default.div`
|
|
|
10135
9902
|
font-size: var(--wui-typography-label-4-size);
|
|
10136
9903
|
color: var(--wui-color-text-secondary);
|
|
10137
9904
|
`;
|
|
10138
|
-
var MenuItemButton = (0,
|
|
9905
|
+
var MenuItemButton = (0, import_react38.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
10139
9906
|
let { colorScheme, badge } = props;
|
|
10140
9907
|
if (appearance === "dangerous") {
|
|
10141
|
-
if ((0,
|
|
9908
|
+
if ((0, import_type_guards32.isNotUndefined)(colorScheme)) {
|
|
10142
9909
|
console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
10143
9910
|
}
|
|
10144
9911
|
colorScheme = "error";
|
|
@@ -10168,7 +9935,7 @@ var MenuItemButton = (0, import_react39.forwardRef)(({ children, appearance, com
|
|
|
10168
9935
|
children: [
|
|
10169
9936
|
props.leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
10170
9937
|
/* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledLabelAndDescriptionContainer, { children }),
|
|
10171
|
-
(0,
|
|
9938
|
+
(0, import_type_guards32.isNotNil)(badge) || (0, import_type_guards32.isNotNil)(command) ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledBadgeContainer, { children: badge ?? command }) : null,
|
|
10172
9939
|
props.rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
10173
9940
|
]
|
|
10174
9941
|
}
|
|
@@ -10231,12 +9998,12 @@ var SubMenu = ({
|
|
|
10231
9998
|
...props
|
|
10232
9999
|
}) => {
|
|
10233
10000
|
const { isSmAndUp } = useMq();
|
|
10234
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
10001
|
+
const [isExpanded, setIsExpanded] = (0, import_react39.useState)(false);
|
|
10235
10002
|
const { compact } = useMenuContext();
|
|
10236
10003
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
10237
10004
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
10238
10005
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(MenuItemLabel, { children: label }),
|
|
10239
|
-
(0,
|
|
10006
|
+
(0, import_type_guards33.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(MenuItemDescription, { children: description }) : null
|
|
10240
10007
|
] }),
|
|
10241
10008
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(import_react_dropdown_menu3.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(SubMenuContent, { $compact: compact, children }) })
|
|
10242
10009
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(import_react_dropdown_menu3.DropdownMenuGroup, { children: [
|
|
@@ -10260,10 +10027,10 @@ var SubMenu = ({
|
|
|
10260
10027
|
SubMenu.displayName = "SubMenu";
|
|
10261
10028
|
|
|
10262
10029
|
// src/components/Menu/MenuItem.tsx
|
|
10263
|
-
var
|
|
10030
|
+
var import_react40 = require("react");
|
|
10264
10031
|
var import_react_dropdown_menu4 = require("@radix-ui/react-dropdown-menu");
|
|
10265
10032
|
var import_jsx_runtime235 = require("react/jsx-runtime");
|
|
10266
|
-
var MenuItem = (0,
|
|
10033
|
+
var MenuItem = (0, import_react40.forwardRef)(
|
|
10267
10034
|
({ onSelect = () => null, ...props }, ref) => {
|
|
10268
10035
|
return /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
10269
10036
|
import_react_dropdown_menu4.DropdownMenuItem,
|
|
@@ -10413,10 +10180,10 @@ var CheckboxMenuItem = ({
|
|
|
10413
10180
|
CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
10414
10181
|
|
|
10415
10182
|
// src/components/Modal/Modal.tsx
|
|
10416
|
-
var
|
|
10183
|
+
var import_react44 = require("react");
|
|
10417
10184
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
10418
10185
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
10419
|
-
var
|
|
10186
|
+
var import_type_guards35 = require("@wistia/type-guards");
|
|
10420
10187
|
|
|
10421
10188
|
// src/components/Modal/ModalHeader.tsx
|
|
10422
10189
|
var import_styled_components59 = __toESM(require("styled-components"));
|
|
@@ -10473,21 +10240,21 @@ var ModalHeader = ({
|
|
|
10473
10240
|
};
|
|
10474
10241
|
|
|
10475
10242
|
// src/components/Modal/ModalContent.tsx
|
|
10476
|
-
var
|
|
10243
|
+
var import_react42 = require("react");
|
|
10477
10244
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
10478
10245
|
var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
10479
10246
|
|
|
10480
10247
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
10481
|
-
var
|
|
10482
|
-
var
|
|
10248
|
+
var import_react41 = require("react");
|
|
10249
|
+
var import_type_guards34 = require("@wistia/type-guards");
|
|
10483
10250
|
var useFocusRestore = () => {
|
|
10484
|
-
const previouslyFocusedRef = (0,
|
|
10485
|
-
(0,
|
|
10251
|
+
const previouslyFocusedRef = (0, import_react41.useRef)(null);
|
|
10252
|
+
(0, import_react41.useEffect)(() => {
|
|
10486
10253
|
previouslyFocusedRef.current = document.activeElement;
|
|
10487
10254
|
}, []);
|
|
10488
|
-
(0,
|
|
10255
|
+
(0, import_react41.useEffect)(() => {
|
|
10489
10256
|
return () => {
|
|
10490
|
-
if ((0,
|
|
10257
|
+
if ((0, import_type_guards34.isNotNil)(previouslyFocusedRef.current)) {
|
|
10491
10258
|
setTimeout(() => {
|
|
10492
10259
|
previouslyFocusedRef.current?.focus();
|
|
10493
10260
|
}, 0);
|
|
@@ -10539,7 +10306,7 @@ var StyledModalContent = (0, import_styled_components60.default)(import_react_di
|
|
|
10539
10306
|
}
|
|
10540
10307
|
}
|
|
10541
10308
|
`;
|
|
10542
|
-
var ModalContent = (0,
|
|
10309
|
+
var ModalContent = (0, import_react42.forwardRef)(
|
|
10543
10310
|
({ fullHeight, width, children, ...otherProps }, ref) => {
|
|
10544
10311
|
useFocusRestore();
|
|
10545
10312
|
return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
|
|
@@ -10557,7 +10324,7 @@ var ModalContent = (0, import_react43.forwardRef)(
|
|
|
10557
10324
|
);
|
|
10558
10325
|
|
|
10559
10326
|
// src/private/components/Backdrop/Backdrop.tsx
|
|
10560
|
-
var
|
|
10327
|
+
var import_react43 = require("react");
|
|
10561
10328
|
var import_styled_components61 = __toESM(require("styled-components"));
|
|
10562
10329
|
var import_jsx_runtime242 = require("react/jsx-runtime");
|
|
10563
10330
|
var backdropAnimationDuration = 150;
|
|
@@ -10595,7 +10362,7 @@ var BackdropComponent = import_styled_components61.default.div`
|
|
|
10595
10362
|
}
|
|
10596
10363
|
}
|
|
10597
10364
|
`;
|
|
10598
|
-
var Backdrop = (0,
|
|
10365
|
+
var Backdrop = (0, import_react43.forwardRef)(
|
|
10599
10366
|
({ alignHorizontal = "center", alignVertical = "center", children, ...otherProps }, ref) => /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
|
|
10600
10367
|
BackdropComponent,
|
|
10601
10368
|
{
|
|
@@ -10617,7 +10384,7 @@ var ModalBody = import_styled_components62.default.div`
|
|
|
10617
10384
|
display: flex;
|
|
10618
10385
|
order: 2;
|
|
10619
10386
|
`;
|
|
10620
|
-
var Modal = (0,
|
|
10387
|
+
var Modal = (0, import_react44.forwardRef)(
|
|
10621
10388
|
({
|
|
10622
10389
|
children,
|
|
10623
10390
|
fullHeight = false,
|
|
@@ -10634,7 +10401,7 @@ var Modal = (0, import_react45.forwardRef)(
|
|
|
10634
10401
|
import_react_dialog4.Root,
|
|
10635
10402
|
{
|
|
10636
10403
|
onOpenChange: (open2) => {
|
|
10637
|
-
if (!open2 && (0,
|
|
10404
|
+
if (!open2 && (0, import_type_guards35.isNotNil)(onRequestClose)) {
|
|
10638
10405
|
onRequestClose();
|
|
10639
10406
|
}
|
|
10640
10407
|
},
|
|
@@ -10647,7 +10414,7 @@ var Modal = (0, import_react45.forwardRef)(
|
|
|
10647
10414
|
ref,
|
|
10648
10415
|
fullHeight,
|
|
10649
10416
|
onOpenAutoFocus: (event) => {
|
|
10650
|
-
if ((0,
|
|
10417
|
+
if ((0, import_type_guards35.isNotNil)(initialFocusRef) && initialFocusRef.current) {
|
|
10651
10418
|
event.preventDefault();
|
|
10652
10419
|
requestAnimationFrame(() => {
|
|
10653
10420
|
initialFocusRef.current?.focus();
|
|
@@ -10681,9 +10448,9 @@ var import_react_popover = require("@radix-ui/react-popover");
|
|
|
10681
10448
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
10682
10449
|
|
|
10683
10450
|
// src/private/helpers/getControls/getControlProps.tsx
|
|
10684
|
-
var
|
|
10451
|
+
var import_type_guards36 = require("@wistia/type-guards");
|
|
10685
10452
|
var getControlProps = (isOpen, onOpenChange) => {
|
|
10686
|
-
return (0,
|
|
10453
|
+
return (0, import_type_guards36.isNotNil)(onOpenChange) && (0, import_type_guards36.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {};
|
|
10687
10454
|
};
|
|
10688
10455
|
|
|
10689
10456
|
// src/components/Popover/Popover.tsx
|
|
@@ -10742,7 +10509,7 @@ Popover.displayName = "Popover";
|
|
|
10742
10509
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
10743
10510
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
10744
10511
|
var import_react_progress = require("@radix-ui/react-progress");
|
|
10745
|
-
var
|
|
10512
|
+
var import_type_guards37 = require("@wistia/type-guards");
|
|
10746
10513
|
var import_jsx_runtime245 = require("react/jsx-runtime");
|
|
10747
10514
|
var ProgressBarWrapper = import_styled_components64.default.div`
|
|
10748
10515
|
--progress-bar-height: 8px;
|
|
@@ -10797,7 +10564,7 @@ var ProgressBar = ({
|
|
|
10797
10564
|
...props
|
|
10798
10565
|
}) => {
|
|
10799
10566
|
return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(ProgressBarWrapper, { children: [
|
|
10800
|
-
(0,
|
|
10567
|
+
(0, import_type_guards37.isNotNil)(labelLeft) ? /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ProgressBarLabel, { children: labelLeft }) : null,
|
|
10801
10568
|
/* @__PURE__ */ (0, import_jsx_runtime245.jsx)(
|
|
10802
10569
|
StyledProgressBar,
|
|
10803
10570
|
{
|
|
@@ -10813,15 +10580,15 @@ var ProgressBar = ({
|
|
|
10813
10580
|
)
|
|
10814
10581
|
}
|
|
10815
10582
|
),
|
|
10816
|
-
(0,
|
|
10583
|
+
(0, import_type_guards37.isNotNil)(labelRight) ? /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ProgressBarLabel, { children: labelRight }) : null
|
|
10817
10584
|
] });
|
|
10818
10585
|
};
|
|
10819
10586
|
ProgressBar.displayName = "ProgressBar";
|
|
10820
10587
|
|
|
10821
10588
|
// src/components/Radio/Radio.tsx
|
|
10822
|
-
var
|
|
10589
|
+
var import_react45 = require("react");
|
|
10823
10590
|
var import_styled_components65 = __toESM(require("styled-components"));
|
|
10824
|
-
var
|
|
10591
|
+
var import_type_guards38 = require("@wistia/type-guards");
|
|
10825
10592
|
var import_jsx_runtime246 = require("react/jsx-runtime");
|
|
10826
10593
|
var RadioIcon = () => /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
|
|
10827
10594
|
"svg",
|
|
@@ -10922,7 +10689,7 @@ var StyledHiddenRadioInput = import_styled_components65.default.input`
|
|
|
10922
10689
|
display: block;
|
|
10923
10690
|
}
|
|
10924
10691
|
`;
|
|
10925
|
-
var Radio = (0,
|
|
10692
|
+
var Radio = (0, import_react45.forwardRef)(
|
|
10926
10693
|
({
|
|
10927
10694
|
checked,
|
|
10928
10695
|
disabled = false,
|
|
@@ -10937,8 +10704,8 @@ var Radio = (0, import_react46.forwardRef)(
|
|
|
10937
10704
|
hideLabel = false,
|
|
10938
10705
|
...props
|
|
10939
10706
|
}, ref) => {
|
|
10940
|
-
const generatedId = (0,
|
|
10941
|
-
const computedId = (0,
|
|
10707
|
+
const generatedId = (0, import_react45.useId)();
|
|
10708
|
+
const computedId = (0, import_type_guards38.isNonEmptyString)(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
10942
10709
|
return /* @__PURE__ */ (0, import_jsx_runtime246.jsxs)(
|
|
10943
10710
|
StyledRadioWrapper,
|
|
10944
10711
|
{
|
|
@@ -10987,22 +10754,22 @@ var Radio = (0, import_react46.forwardRef)(
|
|
|
10987
10754
|
Radio.displayName = "Radio";
|
|
10988
10755
|
|
|
10989
10756
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
10990
|
-
var
|
|
10757
|
+
var import_react49 = require("react");
|
|
10991
10758
|
var import_styled_components67 = __toESM(require("styled-components"));
|
|
10992
10759
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
10993
|
-
var
|
|
10760
|
+
var import_type_guards39 = require("@wistia/type-guards");
|
|
10994
10761
|
|
|
10995
10762
|
// src/components/SegmentedControl/useSelectedItemMeasurements.tsx
|
|
10996
|
-
var
|
|
10763
|
+
var import_react46 = require("react");
|
|
10997
10764
|
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
10998
|
-
var SelectedItemMeasurementsContext = (0,
|
|
10765
|
+
var SelectedItemMeasurementsContext = (0, import_react46.createContext)(
|
|
10999
10766
|
null
|
|
11000
10767
|
);
|
|
11001
10768
|
var SelectedItemMeasurementsProvider = ({
|
|
11002
10769
|
children
|
|
11003
10770
|
}) => {
|
|
11004
|
-
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0,
|
|
11005
|
-
const contextValue = (0,
|
|
10771
|
+
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0, import_react46.useState)(null);
|
|
10772
|
+
const contextValue = (0, import_react46.useMemo)(
|
|
11006
10773
|
() => ({
|
|
11007
10774
|
setSelectedItemMeasurements,
|
|
11008
10775
|
selectedItemMeasurements
|
|
@@ -11012,7 +10779,7 @@ var SelectedItemMeasurementsProvider = ({
|
|
|
11012
10779
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(SelectedItemMeasurementsContext.Provider, { value: contextValue, children });
|
|
11013
10780
|
};
|
|
11014
10781
|
var useSelectedItemMeasurements = () => {
|
|
11015
|
-
const context = (0,
|
|
10782
|
+
const context = (0, import_react46.useContext)(SelectedItemMeasurementsContext);
|
|
11016
10783
|
if (context === null) {
|
|
11017
10784
|
throw new Error(
|
|
11018
10785
|
"useSelectedItemMeasurements must be used within a SelectedItemMeasurementsProvider"
|
|
@@ -11022,15 +10789,15 @@ var useSelectedItemMeasurements = () => {
|
|
|
11022
10789
|
};
|
|
11023
10790
|
|
|
11024
10791
|
// src/components/SegmentedControl/SelectedItemIndicator.tsx
|
|
11025
|
-
var
|
|
10792
|
+
var import_react48 = require("react");
|
|
11026
10793
|
var import_styled_components66 = __toESM(require("styled-components"));
|
|
11027
10794
|
|
|
11028
10795
|
// src/components/SegmentedControl/useSegmentedControlValue.tsx
|
|
11029
|
-
var
|
|
11030
|
-
var SegmentedControlValueContext = (0,
|
|
10796
|
+
var import_react47 = require("react");
|
|
10797
|
+
var SegmentedControlValueContext = (0, import_react47.createContext)(null);
|
|
11031
10798
|
var SegmentedControlValueProvider = SegmentedControlValueContext.Provider;
|
|
11032
10799
|
var useSegmentedControlValue = () => {
|
|
11033
|
-
const context = (0,
|
|
10800
|
+
const context = (0, import_react47.useContext)(SegmentedControlValueContext);
|
|
11034
10801
|
if (context === null) {
|
|
11035
10802
|
throw new Error("useSegmentedControlValue must be used within a SegmentedControlValueProvider");
|
|
11036
10803
|
}
|
|
@@ -11054,7 +10821,7 @@ var SelectedItemIndicatorDiv = import_styled_components66.default.div`
|
|
|
11054
10821
|
var SelectedItemIndicator = () => {
|
|
11055
10822
|
const selectedValue = useSegmentedControlValue();
|
|
11056
10823
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11057
|
-
const selectedItemIndicatorStyle = (0,
|
|
10824
|
+
const selectedItemIndicatorStyle = (0, import_react48.useMemo)(
|
|
11058
10825
|
() => selectedItemMeasurements != null ? {
|
|
11059
10826
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
11060
10827
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -11092,7 +10859,7 @@ var segmentedControlStyles = import_styled_components67.css`
|
|
|
11092
10859
|
var StyledSegmentedControl = (0, import_styled_components67.default)(import_react_toggle_group.Root)`
|
|
11093
10860
|
${segmentedControlStyles}
|
|
11094
10861
|
`;
|
|
11095
|
-
var SegmentedControl = (0,
|
|
10862
|
+
var SegmentedControl = (0, import_react49.forwardRef)(
|
|
11096
10863
|
({
|
|
11097
10864
|
children,
|
|
11098
10865
|
disabled = false,
|
|
@@ -11101,7 +10868,7 @@ var SegmentedControl = (0, import_react50.forwardRef)(
|
|
|
11101
10868
|
onSelectedValueChange,
|
|
11102
10869
|
...props
|
|
11103
10870
|
}, ref) => {
|
|
11104
|
-
if ((0,
|
|
10871
|
+
if ((0, import_type_guards39.isNil)(children)) {
|
|
11105
10872
|
return null;
|
|
11106
10873
|
}
|
|
11107
10874
|
return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
|
|
@@ -11127,20 +10894,20 @@ var SegmentedControl = (0, import_react50.forwardRef)(
|
|
|
11127
10894
|
SegmentedControl.displayName = "SegmentedControl";
|
|
11128
10895
|
|
|
11129
10896
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
11130
|
-
var
|
|
10897
|
+
var import_react50 = require("react");
|
|
11131
10898
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
11132
10899
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
11133
|
-
var
|
|
10900
|
+
var import_type_guards41 = require("@wistia/type-guards");
|
|
11134
10901
|
|
|
11135
10902
|
// src/private/helpers/mergeRefs/mergeRefs.ts
|
|
11136
|
-
var
|
|
10903
|
+
var import_type_guards40 = require("@wistia/type-guards");
|
|
11137
10904
|
var mergeRefs = (refs) => (value) => {
|
|
11138
10905
|
refs.forEach((ref) => {
|
|
11139
|
-
if ((0,
|
|
10906
|
+
if ((0, import_type_guards40.isFunction)(ref)) {
|
|
11140
10907
|
ref(value);
|
|
11141
10908
|
return;
|
|
11142
10909
|
}
|
|
11143
|
-
if ((0,
|
|
10910
|
+
if ((0, import_type_guards40.isNotNil)(ref)) {
|
|
11144
10911
|
ref.current = value;
|
|
11145
10912
|
}
|
|
11146
10913
|
});
|
|
@@ -11210,11 +10977,11 @@ var segmentedControlItemStyles = import_styled_components68.css`
|
|
|
11210
10977
|
var StyledSegmentedControlItem = (0, import_styled_components68.default)(import_react_toggle_group2.Item)`
|
|
11211
10978
|
${segmentedControlItemStyles}
|
|
11212
10979
|
`;
|
|
11213
|
-
var SegmentedControlItem = (0,
|
|
10980
|
+
var SegmentedControlItem = (0, import_react50.forwardRef)(
|
|
11214
10981
|
({ disabled, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11215
10982
|
const selectedValue = useSegmentedControlValue();
|
|
11216
10983
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11217
|
-
const buttonRef = (0,
|
|
10984
|
+
const buttonRef = (0, import_react50.useRef)(null);
|
|
11218
10985
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11219
10986
|
const handleClick = (event) => {
|
|
11220
10987
|
const target = event.target;
|
|
@@ -11223,7 +10990,7 @@ var SegmentedControlItem = (0, import_react51.forwardRef)(
|
|
|
11223
10990
|
event.preventDefault();
|
|
11224
10991
|
}
|
|
11225
10992
|
};
|
|
11226
|
-
(0,
|
|
10993
|
+
(0, import_react50.useEffect)(() => {
|
|
11227
10994
|
const buttonElem = buttonRef.current;
|
|
11228
10995
|
if (!buttonElem) {
|
|
11229
10996
|
return void 0;
|
|
@@ -11252,8 +11019,8 @@ var SegmentedControlItem = (0, import_react51.forwardRef)(
|
|
|
11252
11019
|
StyledSegmentedControlItem,
|
|
11253
11020
|
{
|
|
11254
11021
|
ref: combinedRef,
|
|
11255
|
-
$hasLabel: (0,
|
|
11256
|
-
"aria-label": (0,
|
|
11022
|
+
$hasLabel: (0, import_type_guards41.isNotNil)(label),
|
|
11023
|
+
"aria-label": (0, import_type_guards41.isNotNil)(label) ? void 0 : ariaLabel,
|
|
11257
11024
|
disabled,
|
|
11258
11025
|
onClick: handleClick,
|
|
11259
11026
|
value,
|
|
@@ -11269,7 +11036,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
11269
11036
|
|
|
11270
11037
|
// src/components/Select/Select.tsx
|
|
11271
11038
|
var import_react_select = require("@radix-ui/react-select");
|
|
11272
|
-
var
|
|
11039
|
+
var import_react51 = require("react");
|
|
11273
11040
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
11274
11041
|
var import_jsx_runtime251 = require("react/jsx-runtime");
|
|
11275
11042
|
var StyledTrigger = (0, import_styled_components69.default)(import_react_select.Trigger)`
|
|
@@ -11338,7 +11105,7 @@ var StyledContent3 = (0, import_styled_components69.default)(import_react_select
|
|
|
11338
11105
|
max-height: var(--radix-select-content-available-height);
|
|
11339
11106
|
z-index: var(--wui-zindex-select);
|
|
11340
11107
|
`;
|
|
11341
|
-
var Select = (0,
|
|
11108
|
+
var Select = (0, import_react51.forwardRef)(
|
|
11342
11109
|
({
|
|
11343
11110
|
colorScheme = "inherit",
|
|
11344
11111
|
children,
|
|
@@ -11387,7 +11154,7 @@ Select.displayName = "Select";
|
|
|
11387
11154
|
|
|
11388
11155
|
// src/components/Select/SelectOption.tsx
|
|
11389
11156
|
var import_react_select2 = require("@radix-ui/react-select");
|
|
11390
|
-
var
|
|
11157
|
+
var import_react52 = require("react");
|
|
11391
11158
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
11392
11159
|
var import_jsx_runtime252 = require("react/jsx-runtime");
|
|
11393
11160
|
var StyledItem = (0, import_styled_components70.default)(import_react_select2.Item)`
|
|
@@ -11416,7 +11183,7 @@ var StyledItem = (0, import_styled_components70.default)(import_react_select2.It
|
|
|
11416
11183
|
var StyledIconContainer = import_styled_components70.default.span`
|
|
11417
11184
|
width: 12px;
|
|
11418
11185
|
`;
|
|
11419
|
-
var SelectOption = (0,
|
|
11186
|
+
var SelectOption = (0, import_react52.forwardRef)(
|
|
11420
11187
|
({ children, ...props }, forwardedRef) => {
|
|
11421
11188
|
return /* @__PURE__ */ (0, import_jsx_runtime252.jsxs)(
|
|
11422
11189
|
StyledItem,
|
|
@@ -11461,9 +11228,9 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
11461
11228
|
};
|
|
11462
11229
|
|
|
11463
11230
|
// src/components/Switch/Switch.tsx
|
|
11464
|
-
var
|
|
11231
|
+
var import_react53 = require("react");
|
|
11465
11232
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
11466
|
-
var
|
|
11233
|
+
var import_type_guards42 = require("@wistia/type-guards");
|
|
11467
11234
|
var import_jsx_runtime254 = require("react/jsx-runtime");
|
|
11468
11235
|
var sizeSmall3 = import_styled_components72.css`
|
|
11469
11236
|
--wui-size-small-width: 24px;
|
|
@@ -11566,7 +11333,7 @@ var StyledHiddenSwitchInput = import_styled_components72.default.input`
|
|
|
11566
11333
|
}
|
|
11567
11334
|
}
|
|
11568
11335
|
`;
|
|
11569
|
-
var Switch = (0,
|
|
11336
|
+
var Switch = (0, import_react53.forwardRef)(
|
|
11570
11337
|
({
|
|
11571
11338
|
checked,
|
|
11572
11339
|
disabled = false,
|
|
@@ -11581,8 +11348,8 @@ var Switch = (0, import_react54.forwardRef)(
|
|
|
11581
11348
|
hideLabel = false,
|
|
11582
11349
|
...props
|
|
11583
11350
|
}, ref) => {
|
|
11584
|
-
const generatedId = (0,
|
|
11585
|
-
const computedId = (0,
|
|
11351
|
+
const generatedId = (0, import_react53.useId)();
|
|
11352
|
+
const computedId = (0, import_type_guards42.isNonEmptyString)(id) ? id : `wistia-ui-switch-${generatedId}`;
|
|
11586
11353
|
return /* @__PURE__ */ (0, import_jsx_runtime254.jsxs)(StyledSwitchWrapper, { $disabled: disabled, children: [
|
|
11587
11354
|
/* @__PURE__ */ (0, import_jsx_runtime254.jsx)(
|
|
11588
11355
|
StyledHiddenSwitchInput,
|
|
@@ -11663,8 +11430,8 @@ var Table = ({
|
|
|
11663
11430
|
var import_styled_components74 = __toESM(require("styled-components"));
|
|
11664
11431
|
|
|
11665
11432
|
// src/components/Table/TableSectionContext.ts
|
|
11666
|
-
var
|
|
11667
|
-
var TableSectionContext = (0,
|
|
11433
|
+
var import_react54 = require("react");
|
|
11434
|
+
var TableSectionContext = (0, import_react54.createContext)(null);
|
|
11668
11435
|
|
|
11669
11436
|
// src/components/Table/TableBody.tsx
|
|
11670
11437
|
var import_jsx_runtime256 = require("react/jsx-runtime");
|
|
@@ -11674,7 +11441,7 @@ var TableBody = ({ children, ...props }) => {
|
|
|
11674
11441
|
};
|
|
11675
11442
|
|
|
11676
11443
|
// src/components/Table/TableCell.tsx
|
|
11677
|
-
var
|
|
11444
|
+
var import_react55 = require("react");
|
|
11678
11445
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
11679
11446
|
var import_jsx_runtime257 = require("react/jsx-runtime");
|
|
11680
11447
|
var sharedStyles = import_styled_components75.css`
|
|
@@ -11695,7 +11462,7 @@ var StyledTd = import_styled_components75.default.td`
|
|
|
11695
11462
|
line-height: var(--wui-typography-body-2-line-height);
|
|
11696
11463
|
`;
|
|
11697
11464
|
var TableCell = ({ children, ...props }) => {
|
|
11698
|
-
const section = (0,
|
|
11465
|
+
const section = (0, import_react55.useContext)(TableSectionContext);
|
|
11699
11466
|
if (section === "head") {
|
|
11700
11467
|
return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(StyledTh, { ...props, children });
|
|
11701
11468
|
}
|
|
@@ -11727,9 +11494,9 @@ var TableRow = ({ children, ...props }) => {
|
|
|
11727
11494
|
};
|
|
11728
11495
|
|
|
11729
11496
|
// src/components/Tabs/Tabs.tsx
|
|
11730
|
-
var
|
|
11497
|
+
var import_react60 = require("react");
|
|
11731
11498
|
var import_react_tabs4 = require("@radix-ui/react-tabs");
|
|
11732
|
-
var
|
|
11499
|
+
var import_type_guards44 = require("@wistia/type-guards");
|
|
11733
11500
|
var import_styled_components83 = __toESM(require("styled-components"));
|
|
11734
11501
|
|
|
11735
11502
|
// src/components/Tabs/TabPanel.tsx
|
|
@@ -11782,17 +11549,17 @@ var TabList = ({
|
|
|
11782
11549
|
TabList.displayName = "TabList";
|
|
11783
11550
|
|
|
11784
11551
|
// src/components/Tabs/TabItem.tsx
|
|
11785
|
-
var
|
|
11552
|
+
var import_react57 = require("react");
|
|
11786
11553
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
11787
11554
|
var import_react_tabs3 = require("@radix-ui/react-tabs");
|
|
11788
|
-
var
|
|
11555
|
+
var import_type_guards43 = require("@wistia/type-guards");
|
|
11789
11556
|
|
|
11790
11557
|
// src/components/Tabs/useTabsValue.tsx
|
|
11791
|
-
var
|
|
11792
|
-
var TabsValueContext = (0,
|
|
11558
|
+
var import_react56 = require("react");
|
|
11559
|
+
var TabsValueContext = (0, import_react56.createContext)(null);
|
|
11793
11560
|
var TabsValueProvider = TabsValueContext.Provider;
|
|
11794
11561
|
var useTabsValue = () => {
|
|
11795
|
-
const context = (0,
|
|
11562
|
+
const context = (0, import_react56.useContext)(TabsValueContext);
|
|
11796
11563
|
if (context === null) {
|
|
11797
11564
|
throw new Error("useTabsValue must be used within a TabsValueProvider");
|
|
11798
11565
|
}
|
|
@@ -11808,13 +11575,13 @@ var StyledTabItem = (0, import_styled_components81.default)(import_react_tabs3.T
|
|
|
11808
11575
|
outline: none;
|
|
11809
11576
|
}
|
|
11810
11577
|
`;
|
|
11811
|
-
var TabItem = (0,
|
|
11578
|
+
var TabItem = (0, import_react57.forwardRef)(
|
|
11812
11579
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11813
11580
|
const selectedValue = useTabsValue();
|
|
11814
11581
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11815
|
-
const buttonRef = (0,
|
|
11582
|
+
const buttonRef = (0, import_react57.useRef)(null);
|
|
11816
11583
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11817
|
-
(0,
|
|
11584
|
+
(0, import_react57.useEffect)(() => {
|
|
11818
11585
|
const buttonElem = buttonRef.current;
|
|
11819
11586
|
if (!buttonElem) {
|
|
11820
11587
|
return void 0;
|
|
@@ -11843,8 +11610,8 @@ var TabItem = (0, import_react58.forwardRef)(
|
|
|
11843
11610
|
StyledTabItem,
|
|
11844
11611
|
{
|
|
11845
11612
|
ref: combinedRef,
|
|
11846
|
-
$hasLabel: (0,
|
|
11847
|
-
"aria-label": (0,
|
|
11613
|
+
$hasLabel: (0, import_type_guards43.isNotNil)(label),
|
|
11614
|
+
"aria-label": (0, import_type_guards43.isNotNil)(label) ? void 0 : ariaLabel,
|
|
11848
11615
|
disabled,
|
|
11849
11616
|
value,
|
|
11850
11617
|
children: [
|
|
@@ -11858,16 +11625,16 @@ var TabItem = (0, import_react58.forwardRef)(
|
|
|
11858
11625
|
TabItem.displayName = "TabItem";
|
|
11859
11626
|
|
|
11860
11627
|
// src/components/Tabs/extractTabItems.ts
|
|
11861
|
-
var
|
|
11628
|
+
var import_react58 = require("react");
|
|
11862
11629
|
var extractTabItems = (children) => {
|
|
11863
11630
|
const tabItems = [];
|
|
11864
|
-
|
|
11865
|
-
if (!(0,
|
|
11631
|
+
import_react58.Children.forEach(children, (child) => {
|
|
11632
|
+
if (!(0, import_react58.isValidElement)(child)) {
|
|
11866
11633
|
return;
|
|
11867
11634
|
}
|
|
11868
11635
|
if (typeof child.type !== "string" && child.type.displayName === "Tab") {
|
|
11869
11636
|
tabItems.push(child);
|
|
11870
|
-
} else if (child.type ===
|
|
11637
|
+
} else if (child.type === import_react58.Fragment) {
|
|
11871
11638
|
const fragmentElement = child;
|
|
11872
11639
|
tabItems.push(...extractTabItems(fragmentElement.props.children));
|
|
11873
11640
|
} else if ((child.props.children ?? null) != null) {
|
|
@@ -11880,7 +11647,7 @@ var extractTabItems = (children) => {
|
|
|
11880
11647
|
};
|
|
11881
11648
|
|
|
11882
11649
|
// src/components/Tabs/SelectedItemIndicator.tsx
|
|
11883
|
-
var
|
|
11650
|
+
var import_react59 = require("react");
|
|
11884
11651
|
var import_styled_components82 = __toESM(require("styled-components"));
|
|
11885
11652
|
var import_jsx_runtime264 = require("react/jsx-runtime");
|
|
11886
11653
|
var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(SelectedItemIndicatorDiv)`
|
|
@@ -11891,7 +11658,7 @@ var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(Selec
|
|
|
11891
11658
|
var SelectedItemIndicator2 = () => {
|
|
11892
11659
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11893
11660
|
const selectedValue = useTabsValue();
|
|
11894
|
-
const selectedItemIndicatorStyle = (0,
|
|
11661
|
+
const selectedItemIndicatorStyle = (0, import_react59.useMemo)(
|
|
11895
11662
|
() => selectedItemMeasurements != null ? {
|
|
11896
11663
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
11897
11664
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -11932,7 +11699,7 @@ var StyledTabsRoot = (0, import_styled_components83.default)(import_react_tabs4.
|
|
|
11932
11699
|
flex-direction: column;
|
|
11933
11700
|
height: ${({ $stickyHeaders }) => $stickyHeaders ? "100%" : "auto"};
|
|
11934
11701
|
`;
|
|
11935
|
-
var Tabs = (0,
|
|
11702
|
+
var Tabs = (0, import_react60.forwardRef)(
|
|
11936
11703
|
({
|
|
11937
11704
|
children,
|
|
11938
11705
|
fullWidth = true,
|
|
@@ -11944,7 +11711,7 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
11944
11711
|
...otherProps
|
|
11945
11712
|
}, ref) => {
|
|
11946
11713
|
const tabItems = extractTabItems(children);
|
|
11947
|
-
const [internalSelectedValue, setInternalSelectedValue] = (0,
|
|
11714
|
+
const [internalSelectedValue, setInternalSelectedValue] = (0, import_react60.useState)(defaultSelectedValue);
|
|
11948
11715
|
const modeProps = defaultSelectedValue !== void 0 ? {
|
|
11949
11716
|
defaultValue: defaultSelectedValue,
|
|
11950
11717
|
onValueChange: setInternalSelectedValue
|
|
@@ -11974,7 +11741,7 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
11974
11741
|
label,
|
|
11975
11742
|
"aria-label": ariaLabelForTab
|
|
11976
11743
|
} = tab.props;
|
|
11977
|
-
if ((0,
|
|
11744
|
+
if ((0, import_type_guards44.isNil)(icon)) {
|
|
11978
11745
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11979
11746
|
TabItem,
|
|
11980
11747
|
{
|
|
@@ -11985,7 +11752,7 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
11985
11752
|
value
|
|
11986
11753
|
);
|
|
11987
11754
|
}
|
|
11988
|
-
if ((0,
|
|
11755
|
+
if ((0, import_type_guards44.isNotNil)(label)) {
|
|
11989
11756
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11990
11757
|
TabItem,
|
|
11991
11758
|
{
|
|
@@ -11997,7 +11764,7 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
11997
11764
|
value
|
|
11998
11765
|
);
|
|
11999
11766
|
}
|
|
12000
|
-
if ((0,
|
|
11767
|
+
if ((0, import_type_guards44.isNotNil)(ariaLabelForTab)) {
|
|
12001
11768
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
12002
11769
|
TabItem,
|
|
12003
11770
|
{
|
|
@@ -12030,17 +11797,17 @@ var Tabs = (0, import_react61.forwardRef)(
|
|
|
12030
11797
|
Tabs.displayName = "Tabs";
|
|
12031
11798
|
|
|
12032
11799
|
// src/components/Tabs/Tab.tsx
|
|
12033
|
-
var
|
|
11800
|
+
var import_react61 = require("react");
|
|
12034
11801
|
var import_jsx_runtime266 = require("react/jsx-runtime");
|
|
12035
|
-
var Tab = (0,
|
|
11802
|
+
var Tab = (0, import_react61.forwardRef)(({ children }, ref) => {
|
|
12036
11803
|
return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { ref, children });
|
|
12037
11804
|
});
|
|
12038
11805
|
Tab.displayName = "Tab";
|
|
12039
11806
|
|
|
12040
11807
|
// src/components/Tag/Tag.tsx
|
|
12041
|
-
var
|
|
11808
|
+
var import_react62 = require("react");
|
|
12042
11809
|
var import_styled_components84 = __toESM(require("styled-components"));
|
|
12043
|
-
var
|
|
11810
|
+
var import_type_guards45 = require("@wistia/type-guards");
|
|
12044
11811
|
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
12045
11812
|
var TagLabel = import_styled_components84.default.a`
|
|
12046
11813
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -12125,10 +11892,10 @@ var StyledTag = import_styled_components84.default.div`
|
|
|
12125
11892
|
}
|
|
12126
11893
|
`;
|
|
12127
11894
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
12128
|
-
if ((0,
|
|
11895
|
+
if ((0, import_type_guards45.isNil)(onClickRemove)) {
|
|
12129
11896
|
return null;
|
|
12130
11897
|
}
|
|
12131
|
-
if ((0,
|
|
11898
|
+
if ((0, import_type_guards45.isNil)(onClickRemoveLabel)) {
|
|
12132
11899
|
throw new Error(
|
|
12133
11900
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
12134
11901
|
);
|
|
@@ -12155,7 +11922,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
12155
11922
|
)
|
|
12156
11923
|
] });
|
|
12157
11924
|
};
|
|
12158
|
-
var Tag = (0,
|
|
11925
|
+
var Tag = (0, import_react62.forwardRef)(
|
|
12159
11926
|
({
|
|
12160
11927
|
onClickRemove,
|
|
12161
11928
|
colorScheme = "inherit",
|
|
@@ -12165,8 +11932,8 @@ var Tag = (0, import_react63.forwardRef)(
|
|
|
12165
11932
|
onClickRemoveLabel,
|
|
12166
11933
|
...otherProps
|
|
12167
11934
|
}, ref) => {
|
|
12168
|
-
const hasIcon = (0,
|
|
12169
|
-
const labelProps = (0,
|
|
11935
|
+
const hasIcon = (0, import_type_guards45.isNotNil)(icon);
|
|
11936
|
+
const labelProps = (0, import_type_guards45.isNotNil)(href) && (0, import_type_guards45.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
12170
11937
|
return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
|
|
12171
11938
|
StyledTag,
|
|
12172
11939
|
{
|
|
@@ -12202,7 +11969,7 @@ Tag.displayName = "Tag";
|
|
|
12202
11969
|
|
|
12203
11970
|
// src/components/WistiaLogo/WistiaLogo.tsx
|
|
12204
11971
|
var import_styled_components85 = __toESM(require("styled-components"));
|
|
12205
|
-
var
|
|
11972
|
+
var import_type_guards46 = require("@wistia/type-guards");
|
|
12206
11973
|
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
12207
11974
|
var renderBrandmark = (brandmarkColor, iconOnly) => {
|
|
12208
11975
|
if (iconOnly) {
|
|
@@ -12315,7 +12082,7 @@ var WistiaLogo = ({
|
|
|
12315
12082
|
...otherProps,
|
|
12316
12083
|
children: [
|
|
12317
12084
|
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)("title", { children: title }),
|
|
12318
|
-
(0,
|
|
12085
|
+
(0, import_type_guards46.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("desc", { children: description }) : null,
|
|
12319
12086
|
renderBrandmark(brandmarkColor, iconOnly),
|
|
12320
12087
|
renderLogotype(logotypeColor, iconOnly)
|
|
12321
12088
|
]
|
|
@@ -12411,7 +12178,6 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
12411
12178
|
useAriaLive,
|
|
12412
12179
|
useBoolean,
|
|
12413
12180
|
useFilePicker,
|
|
12414
|
-
useFocusTrap,
|
|
12415
12181
|
useFormState,
|
|
12416
12182
|
useImperativeFilePicker,
|
|
12417
12183
|
useKey,
|