@wistia/ui 0.6.39 → 0.6.40-beta.3c6604ee.3d0234f
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 +513 -279
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.mjs +289 -56
- 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.40-beta.3c6604ee.3d0234f
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -125,6 +125,7 @@ __export(index_exports, {
|
|
|
125
125
|
useAriaLive: () => useAriaLive,
|
|
126
126
|
useBoolean: () => useBoolean,
|
|
127
127
|
useFilePicker: () => import_use_file_picker.useFilePicker,
|
|
128
|
+
useFocusTrap: () => useFocusTrap,
|
|
128
129
|
useFormState: () => useFormState,
|
|
129
130
|
useImperativeFilePicker: () => import_use_file_picker.useImperativeFilePicker,
|
|
130
131
|
useKey: () => useKey,
|
|
@@ -2598,14 +2599,246 @@ var useToast = () => {
|
|
|
2598
2599
|
);
|
|
2599
2600
|
};
|
|
2600
2601
|
|
|
2602
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2603
|
+
var import_react13 = require("react");
|
|
2604
|
+
var import_type_guards11 = require("@wistia/type-guards");
|
|
2605
|
+
|
|
2606
|
+
// src/hooks/useFocusTrap/helpers.ts
|
|
2607
|
+
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]';
|
|
2608
|
+
var coerceToString = (value) => value === null || value === void 0 ? "" : String(value);
|
|
2609
|
+
var isHiddenElement = (element) => {
|
|
2610
|
+
const { display, visibility } = window.getComputedStyle(element);
|
|
2611
|
+
const isHidden = display === "none" || element.style.display === "none" || visibility === "none" || element.style.visibility === "hidden";
|
|
2612
|
+
return element.offsetWidth <= 0 && element.offsetHeight <= 0 || isHidden;
|
|
2613
|
+
};
|
|
2614
|
+
var isVisibleElement = (element) => {
|
|
2615
|
+
let parentElement = element;
|
|
2616
|
+
while (parentElement) {
|
|
2617
|
+
if (parentElement === document.body) {
|
|
2618
|
+
break;
|
|
2619
|
+
}
|
|
2620
|
+
if (isHiddenElement(parentElement)) {
|
|
2621
|
+
return false;
|
|
2622
|
+
}
|
|
2623
|
+
parentElement = parentElement.parentNode;
|
|
2624
|
+
}
|
|
2625
|
+
return true;
|
|
2626
|
+
};
|
|
2627
|
+
var getElementTabIndex = (element) => {
|
|
2628
|
+
const tabIndex = element.getAttribute("tabindex");
|
|
2629
|
+
return Number.parseInt(tabIndex ?? void 0, 10);
|
|
2630
|
+
};
|
|
2631
|
+
var isTabIndexNaN = (element) => {
|
|
2632
|
+
const tabIndex = getElementTabIndex(element);
|
|
2633
|
+
return Number.isNaN(tabIndex);
|
|
2634
|
+
};
|
|
2635
|
+
var isFocusableElement = (element) => {
|
|
2636
|
+
const tabbableNodeRegEx = /input|select|textarea|button|object/;
|
|
2637
|
+
const nodeName = element.nodeName.toLowerCase();
|
|
2638
|
+
const isTabIndexNotNaN = !isTabIndexNaN(element);
|
|
2639
|
+
const isFocusable = (
|
|
2640
|
+
// @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.
|
|
2641
|
+
tabbableNodeRegEx.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN)
|
|
2642
|
+
);
|
|
2643
|
+
return Boolean(isFocusable) && isVisibleElement(element);
|
|
2644
|
+
};
|
|
2645
|
+
var isTabbableElement = (element) => {
|
|
2646
|
+
const tabIndex = getElementTabIndex(element);
|
|
2647
|
+
return (isTabIndexNaN(element) || tabIndex >= 0) && isFocusableElement(element);
|
|
2648
|
+
};
|
|
2649
|
+
var findTabbableDescendants = (element) => Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter(
|
|
2650
|
+
isTabbableElement
|
|
2651
|
+
);
|
|
2652
|
+
var focusLaterElements = [];
|
|
2653
|
+
var focusElement = null;
|
|
2654
|
+
var needToFocus = false;
|
|
2655
|
+
var handleBlur = () => {
|
|
2656
|
+
needToFocus = true;
|
|
2657
|
+
};
|
|
2658
|
+
var handleFocus = () => {
|
|
2659
|
+
if (needToFocus) {
|
|
2660
|
+
needToFocus = false;
|
|
2661
|
+
if (!focusElement) {
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2664
|
+
if (focusElement.contains(document.activeElement)) {
|
|
2665
|
+
return;
|
|
2666
|
+
}
|
|
2667
|
+
const element = findTabbableDescendants(focusElement)[0] ?? focusElement;
|
|
2668
|
+
element.focus();
|
|
2669
|
+
}
|
|
2670
|
+
};
|
|
2671
|
+
var markForFocusLater = () => {
|
|
2672
|
+
const element = document.activeElement;
|
|
2673
|
+
if (element !== null) {
|
|
2674
|
+
focusLaterElements.push(element);
|
|
2675
|
+
}
|
|
2676
|
+
};
|
|
2677
|
+
var returnFocus = () => {
|
|
2678
|
+
let toFocus = null;
|
|
2679
|
+
try {
|
|
2680
|
+
toFocus = focusLaterElements.pop();
|
|
2681
|
+
if (toFocus) {
|
|
2682
|
+
toFocus.focus();
|
|
2683
|
+
}
|
|
2684
|
+
} catch {
|
|
2685
|
+
console.warn(
|
|
2686
|
+
`You tried to return focus to ${coerceToString(toFocus)} but it is not in the DOM anymore`
|
|
2687
|
+
);
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
var setupScopedFocus = (element) => {
|
|
2691
|
+
focusElement = element;
|
|
2692
|
+
document.addEventListener("focusout", handleBlur, false);
|
|
2693
|
+
document.addEventListener("focusin", handleFocus, true);
|
|
2694
|
+
};
|
|
2695
|
+
var teardownScopedFocus = () => {
|
|
2696
|
+
focusElement = null;
|
|
2697
|
+
document.removeEventListener("focusout", handleBlur);
|
|
2698
|
+
document.removeEventListener("focusin", handleFocus);
|
|
2699
|
+
};
|
|
2700
|
+
var scopeTab = (node, event) => {
|
|
2701
|
+
const tabbable = findTabbableDescendants(node);
|
|
2702
|
+
if (!tabbable.length) {
|
|
2703
|
+
event.preventDefault();
|
|
2704
|
+
return;
|
|
2705
|
+
}
|
|
2706
|
+
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
|
|
2707
|
+
const leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
|
|
2708
|
+
if (!leavingFinalTabbable) {
|
|
2709
|
+
return;
|
|
2710
|
+
}
|
|
2711
|
+
event.preventDefault();
|
|
2712
|
+
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
|
|
2713
|
+
if (target) {
|
|
2714
|
+
target.focus();
|
|
2715
|
+
}
|
|
2716
|
+
};
|
|
2717
|
+
var createAriaHider = (containerNode, selector) => {
|
|
2718
|
+
if (selector === void 0) {
|
|
2719
|
+
selector = "body > :not(script)";
|
|
2720
|
+
}
|
|
2721
|
+
const rootNodes = Array.from(document.querySelectorAll(selector)).map((node) => {
|
|
2722
|
+
if (node.contains(containerNode)) {
|
|
2723
|
+
return void 0;
|
|
2724
|
+
}
|
|
2725
|
+
const ariaHidden = node.getAttribute("aria-hidden");
|
|
2726
|
+
if (ariaHidden === null || ariaHidden === "false") {
|
|
2727
|
+
node.setAttribute("aria-hidden", "true");
|
|
2728
|
+
}
|
|
2729
|
+
return {
|
|
2730
|
+
node,
|
|
2731
|
+
ariaHidden
|
|
2732
|
+
};
|
|
2733
|
+
});
|
|
2734
|
+
return () => {
|
|
2735
|
+
rootNodes.forEach((item) => {
|
|
2736
|
+
if (!item) {
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2739
|
+
if (item.ariaHidden === null) {
|
|
2740
|
+
item.node.removeAttribute("aria-hidden");
|
|
2741
|
+
} else {
|
|
2742
|
+
item.node.setAttribute("aria-hidden", item.ariaHidden);
|
|
2743
|
+
}
|
|
2744
|
+
});
|
|
2745
|
+
};
|
|
2746
|
+
};
|
|
2747
|
+
|
|
2748
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2749
|
+
var isRef = (val) => {
|
|
2750
|
+
return val !== null && typeof val === "object" && "current" in val;
|
|
2751
|
+
};
|
|
2752
|
+
var useFocusTrap = (active = true, options = {}) => {
|
|
2753
|
+
const ref = (0, import_react13.useRef)(null);
|
|
2754
|
+
const restoreAriaRef = (0, import_react13.useRef)(null);
|
|
2755
|
+
const setRef = (0, import_react13.useCallback)(
|
|
2756
|
+
(node) => {
|
|
2757
|
+
if (restoreAriaRef.current !== null) {
|
|
2758
|
+
restoreAriaRef.current();
|
|
2759
|
+
}
|
|
2760
|
+
if (ref.current) {
|
|
2761
|
+
returnFocus();
|
|
2762
|
+
teardownScopedFocus();
|
|
2763
|
+
}
|
|
2764
|
+
if (active && node !== null && node !== void 0) {
|
|
2765
|
+
setupScopedFocus(node);
|
|
2766
|
+
markForFocusLater();
|
|
2767
|
+
const processNode = (node2) => {
|
|
2768
|
+
restoreAriaRef.current = !(options.disableAriaHider ?? false) ? createAriaHider(node2) : null;
|
|
2769
|
+
let focusElement2 = null;
|
|
2770
|
+
if ((0, import_type_guards11.isNotUndefined)(options.focusSelector)) {
|
|
2771
|
+
if (isRef(options.focusSelector)) {
|
|
2772
|
+
focusElement2 = options.focusSelector.current;
|
|
2773
|
+
} else {
|
|
2774
|
+
focusElement2 = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
if (!focusElement2) {
|
|
2778
|
+
const children = Array.from(
|
|
2779
|
+
node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)
|
|
2780
|
+
);
|
|
2781
|
+
focusElement2 = // Prefer tabbable elements, But fallback to any focusable element
|
|
2782
|
+
children.find(isTabbableElement) ?? // But fallback to any focusable element
|
|
2783
|
+
children.find(isFocusableElement) ?? // Nothing found
|
|
2784
|
+
null;
|
|
2785
|
+
if (!focusElement2 && isFocusableElement(node2)) {
|
|
2786
|
+
focusElement2 = node2;
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
if (focusElement2) {
|
|
2790
|
+
focusElement2.focus();
|
|
2791
|
+
}
|
|
2792
|
+
if (!focusElement2 && process.env["NODE_ENV"] === "development") {
|
|
2793
|
+
console.warn(
|
|
2794
|
+
'[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.',
|
|
2795
|
+
node2
|
|
2796
|
+
);
|
|
2797
|
+
}
|
|
2798
|
+
};
|
|
2799
|
+
setTimeout(() => {
|
|
2800
|
+
if (node.ownerDocument) {
|
|
2801
|
+
processNode(node);
|
|
2802
|
+
}
|
|
2803
|
+
if (!node.ownerDocument && process.env["NODE_ENV"] === "development") {
|
|
2804
|
+
console.warn(
|
|
2805
|
+
"[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.",
|
|
2806
|
+
node
|
|
2807
|
+
);
|
|
2808
|
+
}
|
|
2809
|
+
});
|
|
2810
|
+
ref.current = node;
|
|
2811
|
+
} else {
|
|
2812
|
+
ref.current = null;
|
|
2813
|
+
}
|
|
2814
|
+
},
|
|
2815
|
+
[active, options.focusSelector, options.disableAriaHider]
|
|
2816
|
+
);
|
|
2817
|
+
(0, import_react13.useEffect)(() => {
|
|
2818
|
+
if (!active) {
|
|
2819
|
+
return void 0;
|
|
2820
|
+
}
|
|
2821
|
+
const handleKeyDown = (event) => {
|
|
2822
|
+
if (event.key === "Tab" && ref.current) {
|
|
2823
|
+
scopeTab(ref.current, event);
|
|
2824
|
+
}
|
|
2825
|
+
};
|
|
2826
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2827
|
+
return () => {
|
|
2828
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2829
|
+
};
|
|
2830
|
+
}, [active]);
|
|
2831
|
+
return setRef;
|
|
2832
|
+
};
|
|
2833
|
+
|
|
2601
2834
|
// src/components/ActionButton/ActionButton.tsx
|
|
2602
|
-
var
|
|
2835
|
+
var import_react17 = require("react");
|
|
2603
2836
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2604
2837
|
|
|
2605
2838
|
// src/components/Button/Button.tsx
|
|
2606
|
-
var
|
|
2839
|
+
var import_react16 = require("react");
|
|
2607
2840
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
2608
|
-
var
|
|
2841
|
+
var import_type_guards15 = require("@wistia/type-guards");
|
|
2609
2842
|
|
|
2610
2843
|
// src/css/buttonResetCss.tsx
|
|
2611
2844
|
var import_styled_components16 = require("styled-components");
|
|
@@ -2809,7 +3042,7 @@ var buttonSizeStyles = {
|
|
|
2809
3042
|
};
|
|
2810
3043
|
|
|
2811
3044
|
// src/components/Icon/Icon.tsx
|
|
2812
|
-
var
|
|
3045
|
+
var import_type_guards13 = require("@wistia/type-guards");
|
|
2813
3046
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
2814
3047
|
|
|
2815
3048
|
// src/components/Icon/icons/AbTestIcon.tsx
|
|
@@ -6664,17 +6897,17 @@ var iconMap = {
|
|
|
6664
6897
|
};
|
|
6665
6898
|
|
|
6666
6899
|
// src/private/hooks/useResponsiveProp/useResponsiveProp.ts
|
|
6667
|
-
var
|
|
6668
|
-
var
|
|
6900
|
+
var import_type_guards12 = require("@wistia/type-guards");
|
|
6901
|
+
var import_react14 = require("react");
|
|
6669
6902
|
var isResponsiveObject = (values) => {
|
|
6670
6903
|
return typeof values === "object" && values !== null && !Array.isArray(values) && "base" in values;
|
|
6671
6904
|
};
|
|
6672
6905
|
var useResponsiveProp = (values) => {
|
|
6673
6906
|
const activeMediaQueries = useActiveMq();
|
|
6674
|
-
return (0,
|
|
6675
|
-
if ((0,
|
|
6907
|
+
return (0, import_react14.useMemo)(() => {
|
|
6908
|
+
if ((0, import_type_guards12.isRecord)(values) && isResponsiveObject(values)) {
|
|
6676
6909
|
const mq2 = activeMediaQueries.find((key) => key in values);
|
|
6677
|
-
return (0,
|
|
6910
|
+
return (0, import_type_guards12.isNotUndefined)(mq2) && (0, import_type_guards12.isNotUndefined)(values[mq2]) ? values[mq2] : values.base;
|
|
6678
6911
|
}
|
|
6679
6912
|
return values;
|
|
6680
6913
|
}, [activeMediaQueries, values]);
|
|
@@ -6701,13 +6934,13 @@ var Icon = ({
|
|
|
6701
6934
|
...otherProps
|
|
6702
6935
|
}) => {
|
|
6703
6936
|
const responsiveSize = useResponsiveProp(size);
|
|
6704
|
-
if ((0,
|
|
6937
|
+
if ((0, import_type_guards13.isNil)(type)) {
|
|
6705
6938
|
throw new Error("An Icon component requires a `type` prop to be provided");
|
|
6706
6939
|
}
|
|
6707
|
-
if ((0,
|
|
6940
|
+
if ((0, import_type_guards13.isNil)(iconMap[type])) {
|
|
6708
6941
|
throw new Error(`Type "${type}" does not exist, please update type prop in Icon component.`);
|
|
6709
6942
|
}
|
|
6710
|
-
if ((0,
|
|
6943
|
+
if ((0, import_type_guards13.isNil)(iconSizeMap[responsiveSize])) {
|
|
6711
6944
|
throw new Error(
|
|
6712
6945
|
`Size "${responsiveSize}" does not exist, please update size prop in Icon component.`
|
|
6713
6946
|
);
|
|
@@ -6738,13 +6971,13 @@ var Icon = ({
|
|
|
6738
6971
|
Icon.displayName = "Icon";
|
|
6739
6972
|
|
|
6740
6973
|
// src/components/Link/Link.tsx
|
|
6741
|
-
var
|
|
6742
|
-
var
|
|
6974
|
+
var import_react15 = require("react");
|
|
6975
|
+
var import_type_guards14 = require("@wistia/type-guards");
|
|
6743
6976
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
6744
6977
|
var import_react_router_dom = require("react-router-dom");
|
|
6745
6978
|
var import_jsx_runtime192 = require("react/jsx-runtime");
|
|
6746
6979
|
var generateHref = (href, type, disabled) => {
|
|
6747
|
-
if (disabled || (0,
|
|
6980
|
+
if (disabled || (0, import_type_guards14.isNil)(href)) {
|
|
6748
6981
|
return void 0;
|
|
6749
6982
|
}
|
|
6750
6983
|
let to = href;
|
|
@@ -6756,12 +6989,12 @@ var generateHref = (href, type, disabled) => {
|
|
|
6756
6989
|
}
|
|
6757
6990
|
return to;
|
|
6758
6991
|
};
|
|
6759
|
-
var isButton = (props) => (0,
|
|
6760
|
-
var isLink = (props) => (0,
|
|
6992
|
+
var isButton = (props) => (0, import_type_guards14.isUndefined)(props.href);
|
|
6993
|
+
var isLink = (props) => (0, import_type_guards14.isNotUndefined)(props.href);
|
|
6761
6994
|
var StyledLink = import_styled_components19.default.a`
|
|
6762
6995
|
--link-icon-size: 14px;
|
|
6763
6996
|
|
|
6764
|
-
${({ href }) => (0,
|
|
6997
|
+
${({ href }) => (0, import_type_guards14.isNil)(href) && buttonResetCss};
|
|
6765
6998
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
6766
6999
|
cursor: pointer;
|
|
6767
7000
|
font-family: var(--wui-typography-family-default);
|
|
@@ -6778,7 +7011,7 @@ var StyledLink = import_styled_components19.default.a`
|
|
|
6778
7011
|
}
|
|
6779
7012
|
}
|
|
6780
7013
|
`;
|
|
6781
|
-
var Link = (0,
|
|
7014
|
+
var Link = (0, import_react15.forwardRef)(
|
|
6782
7015
|
({
|
|
6783
7016
|
beforeAction,
|
|
6784
7017
|
children,
|
|
@@ -6802,16 +7035,16 @@ var Link = (0, import_react14.forwardRef)(
|
|
|
6802
7035
|
} catch (error) {
|
|
6803
7036
|
console.error(error);
|
|
6804
7037
|
} finally {
|
|
6805
|
-
if ((0,
|
|
7038
|
+
if ((0, import_type_guards14.isFunction)(props.onClick)) {
|
|
6806
7039
|
props.onClick(event);
|
|
6807
7040
|
} else if (routingCallback !== null) {
|
|
6808
7041
|
routingCallback();
|
|
6809
|
-
} else if ((0,
|
|
7042
|
+
} else if ((0, import_type_guards14.isNotNil)(to)) {
|
|
6810
7043
|
window.location.assign(to);
|
|
6811
7044
|
} else {
|
|
6812
7045
|
}
|
|
6813
7046
|
}
|
|
6814
|
-
} else if ((0,
|
|
7047
|
+
} else if ((0, import_type_guards14.isFunction)(props.onClick)) {
|
|
6815
7048
|
props.onClick(event);
|
|
6816
7049
|
} else {
|
|
6817
7050
|
}
|
|
@@ -6872,7 +7105,7 @@ Link.displayName = "Link";
|
|
|
6872
7105
|
|
|
6873
7106
|
// src/components/Button/Button.tsx
|
|
6874
7107
|
var import_jsx_runtime193 = require("react/jsx-runtime");
|
|
6875
|
-
var isLink2 = (props) => (0,
|
|
7108
|
+
var isLink2 = (props) => (0, import_type_guards15.isNotUndefined)(props.href);
|
|
6876
7109
|
var StyledButton = import_styled_components20.default.button`
|
|
6877
7110
|
${buttonResetCss}
|
|
6878
7111
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -6912,8 +7145,8 @@ var ButtonContent = ({
|
|
|
6912
7145
|
/* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
6913
7146
|
StyledButtonContent,
|
|
6914
7147
|
{
|
|
6915
|
-
$hasLeftIcon: (0,
|
|
6916
|
-
$hasRightIcon: (0,
|
|
7148
|
+
$hasLeftIcon: (0, import_type_guards15.isNotNil)(leftIcon),
|
|
7149
|
+
$hasRightIcon: (0, import_type_guards15.isNotNil)(rightIcon),
|
|
6917
7150
|
$isLoading: isLoading,
|
|
6918
7151
|
children: [
|
|
6919
7152
|
leftIcon ?? null,
|
|
@@ -6924,7 +7157,7 @@ var ButtonContent = ({
|
|
|
6924
7157
|
)
|
|
6925
7158
|
] });
|
|
6926
7159
|
};
|
|
6927
|
-
var Button = (0,
|
|
7160
|
+
var Button = (0, import_react16.forwardRef)(
|
|
6928
7161
|
({
|
|
6929
7162
|
children,
|
|
6930
7163
|
forceState,
|
|
@@ -6981,7 +7214,7 @@ var Button = (0, import_react15.forwardRef)(
|
|
|
6981
7214
|
event.preventDefault();
|
|
6982
7215
|
return;
|
|
6983
7216
|
}
|
|
6984
|
-
if ((0,
|
|
7217
|
+
if ((0, import_type_guards15.isNotNil)(onClick)) {
|
|
6985
7218
|
onClick(event);
|
|
6986
7219
|
}
|
|
6987
7220
|
};
|
|
@@ -7103,7 +7336,7 @@ var StyledLabel = import_styled_components21.default.span`
|
|
|
7103
7336
|
grid-row: 2;
|
|
7104
7337
|
text-align: left;
|
|
7105
7338
|
`;
|
|
7106
|
-
var ActionButton = (0,
|
|
7339
|
+
var ActionButton = (0, import_react17.forwardRef)(
|
|
7107
7340
|
({
|
|
7108
7341
|
icon,
|
|
7109
7342
|
colorScheme = "default",
|
|
@@ -7147,8 +7380,8 @@ var ActionButton = (0, import_react16.forwardRef)(
|
|
|
7147
7380
|
ActionButton.displayName = "ActionButton";
|
|
7148
7381
|
|
|
7149
7382
|
// src/components/Avatar/Avatar.tsx
|
|
7150
|
-
var
|
|
7151
|
-
var
|
|
7383
|
+
var import_react18 = require("react");
|
|
7384
|
+
var import_type_guards17 = require("@wistia/type-guards");
|
|
7152
7385
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
7153
7386
|
|
|
7154
7387
|
// src/components/ColorSchemeWrapper/ColorSchemeWrapper.tsx
|
|
@@ -7191,13 +7424,13 @@ var ColorSchemeWrapper = ({
|
|
|
7191
7424
|
ColorSchemeWrapper.displayName = "ColorSchemeWrapper";
|
|
7192
7425
|
|
|
7193
7426
|
// src/components/Avatar/formatNameForDisplay.tsx
|
|
7194
|
-
var
|
|
7427
|
+
var import_type_guards16 = require("@wistia/type-guards");
|
|
7195
7428
|
var containsEmojiCharacter = (char) => {
|
|
7196
7429
|
const emojiRegex = /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu;
|
|
7197
7430
|
return emojiRegex.test(char);
|
|
7198
7431
|
};
|
|
7199
7432
|
var formatNameForDisplay = (name) => {
|
|
7200
|
-
if ((0,
|
|
7433
|
+
if ((0, import_type_guards16.isNil)(name) || !(0, import_type_guards16.isString)(name) || (0, import_type_guards16.isEmptyString)(name) || containsEmojiCharacter(name)) {
|
|
7201
7434
|
return "U";
|
|
7202
7435
|
}
|
|
7203
7436
|
const firstChar = name.trim().substring(0, 1);
|
|
@@ -7260,7 +7493,7 @@ var AvatarWrapper = import_styled_components23.default.div`
|
|
|
7260
7493
|
max-height: ${({ $maxHeight }) => $maxHeight}px;
|
|
7261
7494
|
`;
|
|
7262
7495
|
var chooseColorScheme = (name) => {
|
|
7263
|
-
if ((0,
|
|
7496
|
+
if ((0, import_type_guards17.isNil)(name) || name === "Anonymous") {
|
|
7264
7497
|
return "default";
|
|
7265
7498
|
}
|
|
7266
7499
|
const filteredColors = colorSchemeOptions.filter(
|
|
@@ -7279,8 +7512,8 @@ var Avatar = ({
|
|
|
7279
7512
|
onImageLoad,
|
|
7280
7513
|
...otherProps
|
|
7281
7514
|
}) => {
|
|
7282
|
-
const [imageLoadState, setImageLoadState] = (0,
|
|
7283
|
-
(0,
|
|
7515
|
+
const [imageLoadState, setImageLoadState] = (0, import_react18.useState)("loading");
|
|
7516
|
+
(0, import_react18.useEffect)(() => {
|
|
7284
7517
|
setImageLoadState("loading");
|
|
7285
7518
|
}, [imageUrl]);
|
|
7286
7519
|
const handleImageLoad = () => {
|
|
@@ -7292,8 +7525,8 @@ var Avatar = ({
|
|
|
7292
7525
|
onImageLoad?.({ state: "error", type: "initials" });
|
|
7293
7526
|
};
|
|
7294
7527
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
7295
|
-
const avatarColor = (0,
|
|
7296
|
-
const showInitials = (0,
|
|
7528
|
+
const avatarColor = (0, import_react18.useMemo)(() => chooseColorScheme(name), [name]);
|
|
7529
|
+
const showInitials = (0, import_type_guards17.isNil)(imageUrl) || imageLoadState === "error";
|
|
7297
7530
|
return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
7298
7531
|
AvatarWrapper,
|
|
7299
7532
|
{
|
|
@@ -7322,9 +7555,9 @@ var Avatar = ({
|
|
|
7322
7555
|
Avatar.displayName = "Avatar";
|
|
7323
7556
|
|
|
7324
7557
|
// src/components/Badge/Badge.tsx
|
|
7325
|
-
var
|
|
7558
|
+
var import_react19 = require("react");
|
|
7326
7559
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
7327
|
-
var
|
|
7560
|
+
var import_type_guards18 = require("@wistia/type-guards");
|
|
7328
7561
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
7329
7562
|
var StyledBadge = import_styled_components24.default.div`
|
|
7330
7563
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -7346,9 +7579,9 @@ var StyledBadge = import_styled_components24.default.div`
|
|
|
7346
7579
|
width: 12px;
|
|
7347
7580
|
}
|
|
7348
7581
|
`;
|
|
7349
|
-
var Badge = (0,
|
|
7582
|
+
var Badge = (0, import_react19.forwardRef)(
|
|
7350
7583
|
({ colorScheme = "inherit", label, icon, ...otherProps }, ref) => {
|
|
7351
|
-
const hasIcon = (0,
|
|
7584
|
+
const hasIcon = (0, import_type_guards18.isNotNil)(icon);
|
|
7352
7585
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
|
|
7353
7586
|
StyledBadge,
|
|
7354
7587
|
{
|
|
@@ -7367,9 +7600,9 @@ var Badge = (0, import_react18.forwardRef)(
|
|
|
7367
7600
|
Badge.displayName = "Badge";
|
|
7368
7601
|
|
|
7369
7602
|
// src/components/Box/Box.tsx
|
|
7370
|
-
var
|
|
7603
|
+
var import_react20 = require("react");
|
|
7371
7604
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
7372
|
-
var
|
|
7605
|
+
var import_type_guards19 = require("@wistia/type-guards");
|
|
7373
7606
|
|
|
7374
7607
|
// src/private/helpers/makePolymorphic/makePolymorphic.tsx
|
|
7375
7608
|
var makePolymorphic = (component) => {
|
|
@@ -7380,8 +7613,8 @@ var makePolymorphic = (component) => {
|
|
|
7380
7613
|
var import_jsx_runtime198 = require("react/jsx-runtime");
|
|
7381
7614
|
var isDev = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
|
|
7382
7615
|
var getGapStyle = (gap) => {
|
|
7383
|
-
if ((0,
|
|
7384
|
-
if ((0,
|
|
7616
|
+
if ((0, import_type_guards19.isNotNil)(gap)) {
|
|
7617
|
+
if ((0, import_type_guards19.isRecord)(gap)) {
|
|
7385
7618
|
return Object.entries(gap).map(([key, value]) => {
|
|
7386
7619
|
return `${key}-gap: var(--wui-${value})};`;
|
|
7387
7620
|
}).join("");
|
|
@@ -7456,8 +7689,8 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
7456
7689
|
align-content: ${({ $alignContent }) => $alignContent};
|
|
7457
7690
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
7458
7691
|
align-self: ${({ $alignSelf }) => $alignSelf ?? null};
|
|
7459
|
-
display: ${({ $inline }) => (0,
|
|
7460
|
-
flex-basis: ${({ $basis }) => (0,
|
|
7692
|
+
display: ${({ $inline }) => (0, import_type_guards19.isNotNil)($inline) && $inline ? "inline-flex" : "flex"};
|
|
7693
|
+
flex-basis: ${({ $basis }) => (0, import_type_guards19.isNotNil)($basis) ? $basis : null};
|
|
7461
7694
|
flex-direction: ${({ $flexDirection }) => $flexDirection};
|
|
7462
7695
|
${({ $fillBox: fill }) => getFillStyle(fill)};
|
|
7463
7696
|
${({ $fillViewport }) => getFillViewportStyle($fillViewport)};
|
|
@@ -7467,22 +7700,22 @@ var StyledBoxComponent = import_styled_components25.default.div`
|
|
|
7467
7700
|
width: ${({ $width }) => $width ?? null};
|
|
7468
7701
|
|
|
7469
7702
|
/* Box children styles */
|
|
7470
|
-
flex-grow: ${({ $grow }) => (0,
|
|
7471
|
-
flex-shrink: ${({ $shrink }) => (0,
|
|
7703
|
+
flex-grow: ${({ $grow }) => (0, import_type_guards19.isNotNil)($grow) ? $grow : null};
|
|
7704
|
+
flex-shrink: ${({ $shrink }) => (0, import_type_guards19.isNotNil)($shrink) ? $shrink : null};
|
|
7472
7705
|
flex-wrap: ${({ $wrapItems }) => $wrapItems ? "wrap" : "nowrap"};
|
|
7473
7706
|
justify-content: ${({ $justifyContent }) => $justifyContent};
|
|
7474
|
-
order: ${({ $order }) => (0,
|
|
7707
|
+
order: ${({ $order }) => (0, import_type_guards19.isNotNil)($order) ? $order : null};
|
|
7475
7708
|
`;
|
|
7476
7709
|
var wrapChildren = (children) => {
|
|
7477
|
-
if ((0,
|
|
7710
|
+
if ((0, import_type_guards19.isNotNil)(children)) {
|
|
7478
7711
|
if (typeof children === "object" && isDev) {
|
|
7479
|
-
return
|
|
7480
|
-
if ((0,
|
|
7712
|
+
return import_react20.Children.map(children, (child) => {
|
|
7713
|
+
if ((0, import_type_guards19.isNil)(child)) return null;
|
|
7481
7714
|
const elementParams = {};
|
|
7482
7715
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
7483
7716
|
elementParams.hasBoxParent = true;
|
|
7484
7717
|
}
|
|
7485
|
-
return (0,
|
|
7718
|
+
return (0, import_react20.cloneElement)(child, elementParams);
|
|
7486
7719
|
});
|
|
7487
7720
|
}
|
|
7488
7721
|
return children;
|
|
@@ -7490,7 +7723,7 @@ var wrapChildren = (children) => {
|
|
|
7490
7723
|
return null;
|
|
7491
7724
|
};
|
|
7492
7725
|
var DEFAULT_ELEMENT = "div";
|
|
7493
|
-
var BoxComponent = (0,
|
|
7726
|
+
var BoxComponent = (0, import_react20.forwardRef)(
|
|
7494
7727
|
({
|
|
7495
7728
|
alignContent = "stretch",
|
|
7496
7729
|
alignItems = "flex-start",
|
|
@@ -7515,7 +7748,7 @@ var BoxComponent = (0, import_react19.forwardRef)(
|
|
|
7515
7748
|
flexMode,
|
|
7516
7749
|
...otherProps
|
|
7517
7750
|
}, ref) => {
|
|
7518
|
-
if ((0,
|
|
7751
|
+
if ((0, import_type_guards19.isNotUndefined)(height)) {
|
|
7519
7752
|
if (fill === true || fill === "vertical") {
|
|
7520
7753
|
throw new Error('Cannot use height prop with fill="vertical" or fill={true}');
|
|
7521
7754
|
}
|
|
@@ -7525,7 +7758,7 @@ var BoxComponent = (0, import_react19.forwardRef)(
|
|
|
7525
7758
|
);
|
|
7526
7759
|
}
|
|
7527
7760
|
}
|
|
7528
|
-
if ((0,
|
|
7761
|
+
if ((0, import_type_guards19.isNotUndefined)(width)) {
|
|
7529
7762
|
if (fill === true || fill === "horizontal") {
|
|
7530
7763
|
throw new Error('Cannot use width prop with fill="horizontal" or fill={true}');
|
|
7531
7764
|
}
|
|
@@ -7567,7 +7800,7 @@ BoxComponent.displayName = "Box";
|
|
|
7567
7800
|
var Box = makePolymorphic(BoxComponent);
|
|
7568
7801
|
|
|
7569
7802
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
7570
|
-
var
|
|
7803
|
+
var import_react21 = require("react");
|
|
7571
7804
|
var import_styled_components26 = __toESM(require("styled-components"));
|
|
7572
7805
|
var import_jsx_runtime199 = require("react/jsx-runtime");
|
|
7573
7806
|
var StyledBreadcrumbs = import_styled_components26.default.nav`
|
|
@@ -7583,7 +7816,7 @@ var StyledBreadcrumbs = import_styled_components26.default.nav`
|
|
|
7583
7816
|
var BUFFER_WIDTH = 10;
|
|
7584
7817
|
var Breadcrumbs = ({ children, ...props }) => {
|
|
7585
7818
|
const { isXsAndDown } = useMq();
|
|
7586
|
-
let crumbs =
|
|
7819
|
+
let crumbs = import_react21.Children.toArray(children);
|
|
7587
7820
|
if (isXsAndDown) {
|
|
7588
7821
|
crumbs = crumbs.slice(-1);
|
|
7589
7822
|
}
|
|
@@ -7650,7 +7883,7 @@ var Breadcrumb = ({ icon, href, children, ...props }) => {
|
|
|
7650
7883
|
|
|
7651
7884
|
// src/components/ButtonGroup/ButtonGroup.tsx
|
|
7652
7885
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
7653
|
-
var
|
|
7886
|
+
var import_type_guards20 = require("@wistia/type-guards");
|
|
7654
7887
|
var import_jsx_runtime201 = require("react/jsx-runtime");
|
|
7655
7888
|
var getAlignment = (align) => {
|
|
7656
7889
|
if (align === "center") {
|
|
@@ -7696,7 +7929,7 @@ var ButtonGroup = ({
|
|
|
7696
7929
|
collapseOnSmallScreens = true,
|
|
7697
7930
|
...otherProps
|
|
7698
7931
|
}) => {
|
|
7699
|
-
if ((0,
|
|
7932
|
+
if ((0, import_type_guards20.isNil)(children)) {
|
|
7700
7933
|
return null;
|
|
7701
7934
|
}
|
|
7702
7935
|
return /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(
|
|
@@ -7770,7 +8003,7 @@ var Card = ({
|
|
|
7770
8003
|
Card.displayName = "Card";
|
|
7771
8004
|
|
|
7772
8005
|
// src/components/Center/Center.tsx
|
|
7773
|
-
var
|
|
8006
|
+
var import_react22 = require("react");
|
|
7774
8007
|
var import_styled_components30 = __toESM(require("styled-components"));
|
|
7775
8008
|
var import_jsx_runtime203 = require("react/jsx-runtime");
|
|
7776
8009
|
var StyledCenter = import_styled_components30.default.div`
|
|
@@ -7785,7 +8018,7 @@ var StyledCenter = import_styled_components30.default.div`
|
|
|
7785
8018
|
align-items: center;
|
|
7786
8019
|
`}
|
|
7787
8020
|
`;
|
|
7788
|
-
var Center = (0,
|
|
8021
|
+
var Center = (0, import_react22.forwardRef)(
|
|
7789
8022
|
({ maxWidth = "100%", gutterWidth = "space-00", intrinsic = false, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(
|
|
7790
8023
|
StyledCenter,
|
|
7791
8024
|
{
|
|
@@ -7801,17 +8034,17 @@ var Center = (0, import_react21.forwardRef)(
|
|
|
7801
8034
|
Center.displayName = "Center";
|
|
7802
8035
|
|
|
7803
8036
|
// src/components/Checkbox/Checkbox.tsx
|
|
7804
|
-
var
|
|
8037
|
+
var import_react23 = require("react");
|
|
7805
8038
|
var import_styled_components34 = __toESM(require("styled-components"));
|
|
7806
|
-
var
|
|
8039
|
+
var import_type_guards24 = require("@wistia/type-guards");
|
|
7807
8040
|
|
|
7808
8041
|
// src/private/components/FormControlLabel/FormControlLabel.tsx
|
|
7809
8042
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
7810
|
-
var
|
|
8043
|
+
var import_type_guards23 = require("@wistia/type-guards");
|
|
7811
8044
|
|
|
7812
8045
|
// src/private/components/FormControlLabel/FormControlLabelDescription.tsx
|
|
7813
8046
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
7814
|
-
var
|
|
8047
|
+
var import_type_guards21 = require("@wistia/type-guards");
|
|
7815
8048
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
7816
8049
|
var disabledStyle = import_styled_components31.css`
|
|
7817
8050
|
color: var(--wui-color-text-disabled);
|
|
@@ -7831,7 +8064,7 @@ var FormControlLabelDescription = ({
|
|
|
7831
8064
|
disabled = false,
|
|
7832
8065
|
...props
|
|
7833
8066
|
}) => {
|
|
7834
|
-
if ((0,
|
|
8067
|
+
if ((0, import_type_guards21.isNil)(children)) {
|
|
7835
8068
|
return null;
|
|
7836
8069
|
}
|
|
7837
8070
|
return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
|
|
@@ -7847,7 +8080,7 @@ FormControlLabelDescription.displayName = "FormControlLabelDescription";
|
|
|
7847
8080
|
|
|
7848
8081
|
// src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
|
|
7849
8082
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
7850
|
-
var
|
|
8083
|
+
var import_type_guards22 = require("@wistia/type-guards");
|
|
7851
8084
|
var import_jsx_runtime205 = require("react/jsx-runtime");
|
|
7852
8085
|
var VisuallyHidden = import_styled_components32.default.div({ ...visuallyHiddenStyle });
|
|
7853
8086
|
var VisuallyHiddenButFocusable = import_styled_components32.default.div({
|
|
@@ -7859,7 +8092,7 @@ var ScreenReaderOnly = ({
|
|
|
7859
8092
|
focusable = false,
|
|
7860
8093
|
...otherProps
|
|
7861
8094
|
}) => {
|
|
7862
|
-
const accessibleText = (0,
|
|
8095
|
+
const accessibleText = (0, import_type_guards22.isNotNil)(text) ? text : children;
|
|
7863
8096
|
if (focusable) {
|
|
7864
8097
|
return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(VisuallyHiddenButFocusable, { ...otherProps, children: accessibleText });
|
|
7865
8098
|
}
|
|
@@ -7899,7 +8132,7 @@ var FormControlLabel = ({
|
|
|
7899
8132
|
hideLabel = false,
|
|
7900
8133
|
...props
|
|
7901
8134
|
}) => {
|
|
7902
|
-
if ((0,
|
|
8135
|
+
if ((0, import_type_guards23.isNil)(label)) {
|
|
7903
8136
|
return null;
|
|
7904
8137
|
}
|
|
7905
8138
|
const labelContent = hideLabel ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(ScreenReaderOnly, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(StyledLabelWrapper, { children: [
|
|
@@ -7913,7 +8146,7 @@ var FormControlLabel = ({
|
|
|
7913
8146
|
htmlFor,
|
|
7914
8147
|
...props,
|
|
7915
8148
|
children: [
|
|
7916
|
-
(0,
|
|
8149
|
+
(0, import_type_guards23.isNotNil)(controlSlot) ? controlSlot : null,
|
|
7917
8150
|
labelContent
|
|
7918
8151
|
]
|
|
7919
8152
|
}
|
|
@@ -8021,7 +8254,7 @@ var StyledHiddenCheckboxInput = import_styled_components34.default.input`
|
|
|
8021
8254
|
display: block;
|
|
8022
8255
|
}
|
|
8023
8256
|
`;
|
|
8024
|
-
var Checkbox = (0,
|
|
8257
|
+
var Checkbox = (0, import_react23.forwardRef)(
|
|
8025
8258
|
({
|
|
8026
8259
|
checked,
|
|
8027
8260
|
disabled = false,
|
|
@@ -8036,8 +8269,8 @@ var Checkbox = (0, import_react22.forwardRef)(
|
|
|
8036
8269
|
hideLabel = false,
|
|
8037
8270
|
...props
|
|
8038
8271
|
}, ref) => {
|
|
8039
|
-
const generatedId = (0,
|
|
8040
|
-
const computedId = (0,
|
|
8272
|
+
const generatedId = (0, import_react23.useId)();
|
|
8273
|
+
const computedId = (0, import_type_guards24.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-${generatedId}`;
|
|
8041
8274
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(StyledCheckboxWrapper, { disabled, children: [
|
|
8042
8275
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
8043
8276
|
StyledHiddenCheckboxInput,
|
|
@@ -8079,9 +8312,9 @@ var Checkbox = (0, import_react22.forwardRef)(
|
|
|
8079
8312
|
Checkbox.displayName = "Checkbox";
|
|
8080
8313
|
|
|
8081
8314
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
8082
|
-
var
|
|
8315
|
+
var import_react24 = require("react");
|
|
8083
8316
|
var ClickRegion = ({ children, targetRef }) => {
|
|
8084
|
-
(0,
|
|
8317
|
+
(0, import_react24.useEffect)(() => {
|
|
8085
8318
|
if (targetRef.current && targetRef.current.tagName === "A") {
|
|
8086
8319
|
targetRef.current.setAttribute("data-click-region-target-link", "");
|
|
8087
8320
|
} else if (targetRef.current && targetRef.current.tagName === "BUTTON") {
|
|
@@ -8089,7 +8322,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8089
8322
|
} else {
|
|
8090
8323
|
}
|
|
8091
8324
|
}, [targetRef]);
|
|
8092
|
-
const handleClick = (0,
|
|
8325
|
+
const handleClick = (0, import_react24.useCallback)(
|
|
8093
8326
|
(event) => {
|
|
8094
8327
|
const node = targetRef.current;
|
|
8095
8328
|
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")) {
|
|
@@ -8106,7 +8339,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8106
8339
|
},
|
|
8107
8340
|
[targetRef]
|
|
8108
8341
|
);
|
|
8109
|
-
return (0,
|
|
8342
|
+
return (0, import_react24.cloneElement)(import_react24.Children.only(children), {
|
|
8110
8343
|
"data-click-region": true,
|
|
8111
8344
|
onClick: handleClick
|
|
8112
8345
|
});
|
|
@@ -8115,7 +8348,7 @@ ClickRegion.displayName = "ClickRegion";
|
|
|
8115
8348
|
|
|
8116
8349
|
// src/components/Collapsible/Collapsible.tsx
|
|
8117
8350
|
var import_react_collapsible = require("@radix-ui/react-collapsible");
|
|
8118
|
-
var
|
|
8351
|
+
var import_type_guards25 = require("@wistia/type-guards");
|
|
8119
8352
|
var import_styled_components35 = __toESM(require("styled-components"));
|
|
8120
8353
|
var import_jsx_runtime208 = require("react/jsx-runtime");
|
|
8121
8354
|
var StyledRoot = (0, import_styled_components35.default)(import_react_collapsible.Root)`
|
|
@@ -8132,31 +8365,31 @@ var Collapsible = ({
|
|
|
8132
8365
|
onOpenChange
|
|
8133
8366
|
}) => {
|
|
8134
8367
|
const controlProps = {
|
|
8135
|
-
...(0,
|
|
8368
|
+
...(0, import_type_guards25.isNotNil)(onOpenChange) && (0, import_type_guards25.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
8136
8369
|
};
|
|
8137
8370
|
return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(StyledRoot, { ...controlProps, children });
|
|
8138
8371
|
};
|
|
8139
8372
|
Collapsible.displayName = "Collapsible";
|
|
8140
8373
|
|
|
8141
8374
|
// src/components/Collapsible/CollapsibleTrigger.tsx
|
|
8142
|
-
var
|
|
8375
|
+
var import_react25 = require("react");
|
|
8143
8376
|
var import_react_collapsible2 = require("@radix-ui/react-collapsible");
|
|
8144
8377
|
var import_jsx_runtime209 = require("react/jsx-runtime");
|
|
8145
8378
|
var CollapsibleTrigger = ({ children }) => {
|
|
8146
|
-
|
|
8379
|
+
import_react25.Children.only(children);
|
|
8147
8380
|
return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_react_collapsible2.Trigger, { asChild: true, children });
|
|
8148
8381
|
};
|
|
8149
8382
|
|
|
8150
8383
|
// src/components/Collapsible/CollapsibleContent.tsx
|
|
8151
8384
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
8152
8385
|
var import_react_collapsible3 = require("@radix-ui/react-collapsible");
|
|
8153
|
-
var
|
|
8386
|
+
var import_type_guards26 = require("@wistia/type-guards");
|
|
8154
8387
|
var import_jsx_runtime210 = require("react/jsx-runtime");
|
|
8155
8388
|
var ClampedContent = import_styled_components36.default.div.attrs({ "data-wui-collapsible-content": true })`
|
|
8156
8389
|
--wui-collapsible-content-clamp-lines: ${({ $clamp }) => $clamp};
|
|
8157
8390
|
`;
|
|
8158
8391
|
var CollapsibleContent = ({ clamp, children }) => {
|
|
8159
|
-
if ((0,
|
|
8392
|
+
if ((0, import_type_guards26.isNotUndefined)(clamp)) {
|
|
8160
8393
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(ClampedContent, { $clamp: clamp, children });
|
|
8161
8394
|
}
|
|
8162
8395
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(import_react_collapsible3.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(import_jsx_runtime210.Fragment, { children: [
|
|
@@ -8167,10 +8400,10 @@ var CollapsibleContent = ({ clamp, children }) => {
|
|
|
8167
8400
|
|
|
8168
8401
|
// src/components/DataCards/DataCard.tsx
|
|
8169
8402
|
var import_styled_components38 = __toESM(require("styled-components"));
|
|
8170
|
-
var
|
|
8403
|
+
var import_type_guards27 = require("@wistia/type-guards");
|
|
8171
8404
|
|
|
8172
8405
|
// src/components/Heading/Heading.tsx
|
|
8173
|
-
var
|
|
8406
|
+
var import_react26 = require("react");
|
|
8174
8407
|
var import_styled_components37 = __toESM(require("styled-components"));
|
|
8175
8408
|
var import_jsx_runtime211 = require("react/jsx-runtime");
|
|
8176
8409
|
var heroStyle = import_styled_components37.css`
|
|
@@ -8257,7 +8490,7 @@ var variantElementMap = {
|
|
|
8257
8490
|
heading5: "h5",
|
|
8258
8491
|
heading6: "h6"
|
|
8259
8492
|
};
|
|
8260
|
-
var HeadingComponent = (0,
|
|
8493
|
+
var HeadingComponent = (0, import_react26.forwardRef)(
|
|
8261
8494
|
({
|
|
8262
8495
|
align = "left",
|
|
8263
8496
|
colorScheme = "inherit",
|
|
@@ -8376,8 +8609,8 @@ var DataCard = ({
|
|
|
8376
8609
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledLoadingValue, {}) : value
|
|
8377
8610
|
}
|
|
8378
8611
|
),
|
|
8379
|
-
(0,
|
|
8380
|
-
(0,
|
|
8612
|
+
(0, import_type_guards27.isNotNull)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledSlot, { children: upperRightSlot }),
|
|
8613
|
+
(0, import_type_guards27.isNotNull)(trend) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(StyledDataCardTrendContainer, { children: trend })
|
|
8381
8614
|
]
|
|
8382
8615
|
}
|
|
8383
8616
|
);
|
|
@@ -8421,7 +8654,7 @@ DataCards.displayName = "DataCards";
|
|
|
8421
8654
|
var import_styled_components41 = __toESM(require("styled-components"));
|
|
8422
8655
|
|
|
8423
8656
|
// src/components/Text/Text.tsx
|
|
8424
|
-
var
|
|
8657
|
+
var import_react27 = require("react");
|
|
8425
8658
|
var import_styled_components40 = __toESM(require("styled-components"));
|
|
8426
8659
|
var import_jsx_runtime214 = require("react/jsx-runtime");
|
|
8427
8660
|
var bodyBoldStyles = import_styled_components40.css`
|
|
@@ -8587,7 +8820,7 @@ var StyledText = import_styled_components40.default.div`
|
|
|
8587
8820
|
}
|
|
8588
8821
|
`}
|
|
8589
8822
|
`;
|
|
8590
|
-
var TextComponent = (0,
|
|
8823
|
+
var TextComponent = (0, import_react27.forwardRef)(
|
|
8591
8824
|
({
|
|
8592
8825
|
align = "left",
|
|
8593
8826
|
colorScheme = "inherit",
|
|
@@ -8703,7 +8936,7 @@ Divider.displayName = "Divider";
|
|
|
8703
8936
|
|
|
8704
8937
|
// src/components/EditableHeading/EditableHeading.tsx
|
|
8705
8938
|
var import_styled_components45 = __toESM(require("styled-components"));
|
|
8706
|
-
var
|
|
8939
|
+
var import_react29 = require("react");
|
|
8707
8940
|
|
|
8708
8941
|
// src/components/Tooltip/Tooltip.tsx
|
|
8709
8942
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
@@ -8812,9 +9045,9 @@ var Tooltip = ({
|
|
|
8812
9045
|
Tooltip.displayName = "Tooltip";
|
|
8813
9046
|
|
|
8814
9047
|
// src/components/Input/Input.tsx
|
|
8815
|
-
var
|
|
9048
|
+
var import_react28 = require("react");
|
|
8816
9049
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
8817
|
-
var
|
|
9050
|
+
var import_type_guards28 = require("@wistia/type-guards");
|
|
8818
9051
|
var import_jsx_runtime218 = require("react/jsx-runtime");
|
|
8819
9052
|
var inputStyles = import_styled_components44.css`
|
|
8820
9053
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -8901,7 +9134,7 @@ var StyledInputContainer = import_styled_components44.default.div`
|
|
|
8901
9134
|
padding-right: 32px;
|
|
8902
9135
|
}
|
|
8903
9136
|
`;
|
|
8904
|
-
var Input = (0,
|
|
9137
|
+
var Input = (0, import_react28.forwardRef)(
|
|
8905
9138
|
({
|
|
8906
9139
|
fullWidth = true,
|
|
8907
9140
|
monospace = false,
|
|
@@ -8911,30 +9144,30 @@ var Input = (0, import_react27.forwardRef)(
|
|
|
8911
9144
|
rightIcon,
|
|
8912
9145
|
...props
|
|
8913
9146
|
}, externalRef) => {
|
|
8914
|
-
const internalRef = (0,
|
|
9147
|
+
const internalRef = (0, import_react28.useRef)();
|
|
8915
9148
|
const ref = (
|
|
8916
9149
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
8917
|
-
(0,
|
|
9150
|
+
(0, import_type_guards28.isNotNil)(externalRef) && (0, import_type_guards28.isRecord)(externalRef) && "current" in externalRef ? externalRef : internalRef
|
|
8918
9151
|
);
|
|
8919
9152
|
let leftIconToDisplay = leftIcon;
|
|
8920
|
-
if ((0,
|
|
9153
|
+
if ((0, import_type_guards28.isNil)(leftIcon) && type === "search") {
|
|
8921
9154
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(Icon, { type: "search" });
|
|
8922
9155
|
}
|
|
8923
|
-
if ((0,
|
|
8924
|
-
leftIconToDisplay = (0,
|
|
9156
|
+
if ((0, import_type_guards28.isNotNil)(leftIconToDisplay)) {
|
|
9157
|
+
leftIconToDisplay = (0, import_react28.cloneElement)(leftIconToDisplay, {
|
|
8925
9158
|
size: "md",
|
|
8926
9159
|
className: "wui-input-left-icon"
|
|
8927
9160
|
});
|
|
8928
9161
|
}
|
|
8929
9162
|
let rightIconToDisplay = rightIcon;
|
|
8930
|
-
if ((0,
|
|
8931
|
-
rightIconToDisplay = (0,
|
|
9163
|
+
if ((0, import_type_guards28.isNotNil)(rightIconToDisplay)) {
|
|
9164
|
+
rightIconToDisplay = (0, import_react28.cloneElement)(rightIconToDisplay, {
|
|
8932
9165
|
size: "md",
|
|
8933
9166
|
className: "wui-input-right-icon"
|
|
8934
9167
|
});
|
|
8935
9168
|
}
|
|
8936
|
-
const
|
|
8937
|
-
if ((0,
|
|
9169
|
+
const handleFocus2 = (event) => {
|
|
9170
|
+
if ((0, import_type_guards28.isNotNil)(props.onFocus)) {
|
|
8938
9171
|
props.onFocus(event);
|
|
8939
9172
|
}
|
|
8940
9173
|
if (autoSelect && isValidRef(ref) && "current" in ref) {
|
|
@@ -8955,14 +9188,14 @@ var Input = (0, import_react27.forwardRef)(
|
|
|
8955
9188
|
{
|
|
8956
9189
|
...props,
|
|
8957
9190
|
ref,
|
|
8958
|
-
onFocus:
|
|
9191
|
+
onFocus: handleFocus2
|
|
8959
9192
|
}
|
|
8960
9193
|
) : /* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
|
|
8961
9194
|
"input",
|
|
8962
9195
|
{
|
|
8963
9196
|
...props,
|
|
8964
9197
|
ref,
|
|
8965
|
-
onFocus:
|
|
9198
|
+
onFocus: handleFocus2,
|
|
8966
9199
|
type
|
|
8967
9200
|
}
|
|
8968
9201
|
),
|
|
@@ -9023,11 +9256,11 @@ var EditableHeading = ({
|
|
|
9023
9256
|
forceEditing = false,
|
|
9024
9257
|
editingDisabled = false
|
|
9025
9258
|
}) => {
|
|
9026
|
-
const [isEditing, setIsEditing] = (0,
|
|
9027
|
-
const [value, setValue] = (0,
|
|
9028
|
-
const [previousValue, setPreviousValue] = (0,
|
|
9029
|
-
const [headingHeight, setHeadingHeight] = (0,
|
|
9030
|
-
const headingRef = (0,
|
|
9259
|
+
const [isEditing, setIsEditing] = (0, import_react29.useState)(false);
|
|
9260
|
+
const [value, setValue] = (0, import_react29.useState)(children);
|
|
9261
|
+
const [previousValue, setPreviousValue] = (0, import_react29.useState)(children);
|
|
9262
|
+
const [headingHeight, setHeadingHeight] = (0, import_react29.useState)("60");
|
|
9263
|
+
const headingRef = (0, import_react29.useRef)(null);
|
|
9031
9264
|
const handleSetEditing = (editing) => {
|
|
9032
9265
|
if (editingDisabled) return;
|
|
9033
9266
|
if (editing && headingRef.current) {
|
|
@@ -9113,12 +9346,12 @@ var EditableHeading = ({
|
|
|
9113
9346
|
};
|
|
9114
9347
|
|
|
9115
9348
|
// src/components/Form/Form.tsx
|
|
9116
|
-
var
|
|
9349
|
+
var import_react31 = require("react");
|
|
9117
9350
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
9118
|
-
var
|
|
9351
|
+
var import_type_guards29 = require("@wistia/type-guards");
|
|
9119
9352
|
|
|
9120
9353
|
// src/components/Stack/Stack.tsx
|
|
9121
|
-
var
|
|
9354
|
+
var import_react30 = require("react");
|
|
9122
9355
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
9123
9356
|
var import_jsx_runtime220 = require("react/jsx-runtime");
|
|
9124
9357
|
var DEFAULT_ELEMENT4 = "div";
|
|
@@ -9128,7 +9361,7 @@ var StyledStack = import_styled_components46.default.div`
|
|
|
9128
9361
|
gap: ${({ $gap }) => `var(--wui-${$gap})`};
|
|
9129
9362
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
9130
9363
|
`;
|
|
9131
|
-
var StackComponent = (0,
|
|
9364
|
+
var StackComponent = (0, import_react30.forwardRef)(
|
|
9132
9365
|
({ renderAs, direction = "vertical", gap = "space-02", alignItems = "stretch", ...props }, ref) => {
|
|
9133
9366
|
const responsiveGap = useResponsiveProp(gap);
|
|
9134
9367
|
const responsiveDirection = useResponsiveProp(direction);
|
|
@@ -9157,7 +9390,7 @@ var StyledForm = import_styled_components47.default.form`
|
|
|
9157
9390
|
max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
|
|
9158
9391
|
align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
|
|
9159
9392
|
`;
|
|
9160
|
-
var FormContext = (0,
|
|
9393
|
+
var FormContext = (0, import_react31.createContext)({
|
|
9161
9394
|
values: {},
|
|
9162
9395
|
errors: {},
|
|
9163
9396
|
hasSubmitted: false,
|
|
@@ -9173,25 +9406,25 @@ var FormComponent = ({
|
|
|
9173
9406
|
fullWidth = false,
|
|
9174
9407
|
...props
|
|
9175
9408
|
}, forwardedRef) => {
|
|
9176
|
-
const [errors, setErrors] = (0,
|
|
9177
|
-
const [hasSubmitted, setHasSubmitted] = (0,
|
|
9178
|
-
const innerRef = (0,
|
|
9409
|
+
const [errors, setErrors] = (0, import_react31.useState)({});
|
|
9410
|
+
const [hasSubmitted, setHasSubmitted] = (0, import_react31.useState)(false);
|
|
9411
|
+
const innerRef = (0, import_react31.useRef)();
|
|
9179
9412
|
const ref = forwardedRef ?? innerRef;
|
|
9180
|
-
const autoId = (0,
|
|
9413
|
+
const autoId = (0, import_react31.useId)();
|
|
9181
9414
|
const id = props.id ?? autoId;
|
|
9182
9415
|
const handleValidate = (nextFormData) => {
|
|
9183
9416
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
9184
|
-
if ((0,
|
|
9417
|
+
if ((0, import_type_guards29.isUndefined)(validate)) {
|
|
9185
9418
|
return {};
|
|
9186
9419
|
}
|
|
9187
9420
|
return validate(nextData);
|
|
9188
9421
|
};
|
|
9189
|
-
const
|
|
9422
|
+
const handleBlur2 = (event) => {
|
|
9190
9423
|
if (props.onBlur) {
|
|
9191
9424
|
props.onBlur(event);
|
|
9192
9425
|
}
|
|
9193
9426
|
const formData = new FormData(event.currentTarget);
|
|
9194
|
-
if ((0,
|
|
9427
|
+
if ((0, import_type_guards29.isNotUndefined)(validate)) {
|
|
9195
9428
|
handleValidate(formData);
|
|
9196
9429
|
}
|
|
9197
9430
|
};
|
|
@@ -9219,7 +9452,7 @@ var FormComponent = ({
|
|
|
9219
9452
|
void action(null);
|
|
9220
9453
|
}
|
|
9221
9454
|
};
|
|
9222
|
-
const context = (0,
|
|
9455
|
+
const context = (0, import_react31.useMemo)(() => {
|
|
9223
9456
|
return {
|
|
9224
9457
|
values,
|
|
9225
9458
|
errors,
|
|
@@ -9239,7 +9472,7 @@ var FormComponent = ({
|
|
|
9239
9472
|
as: StyledForm,
|
|
9240
9473
|
gap: "space-05",
|
|
9241
9474
|
id,
|
|
9242
|
-
onBlur:
|
|
9475
|
+
onBlur: handleBlur2,
|
|
9243
9476
|
onReset: handleReset,
|
|
9244
9477
|
onSubmit: handleSubmit,
|
|
9245
9478
|
children
|
|
@@ -9248,15 +9481,15 @@ var FormComponent = ({
|
|
|
9248
9481
|
);
|
|
9249
9482
|
};
|
|
9250
9483
|
FormComponent.displayName = "Form";
|
|
9251
|
-
var Form = (0,
|
|
9484
|
+
var Form = (0, import_react31.forwardRef)(FormComponent);
|
|
9252
9485
|
|
|
9253
9486
|
// src/components/Form/useFormState.tsx
|
|
9254
|
-
var
|
|
9487
|
+
var import_react32 = require("react");
|
|
9255
9488
|
var useFormState = (action, initialData = {}) => {
|
|
9256
|
-
const [data, setData] = (0,
|
|
9257
|
-
const [isPending, setIsPending] = (0,
|
|
9258
|
-
const [error, setError] = (0,
|
|
9259
|
-
const formAction = (0,
|
|
9489
|
+
const [data, setData] = (0, import_react32.useState)(initialData);
|
|
9490
|
+
const [isPending, setIsPending] = (0, import_react32.useState)(false);
|
|
9491
|
+
const [error, setError] = (0, import_react32.useState)(null);
|
|
9492
|
+
const formAction = (0, import_react32.useCallback)(
|
|
9260
9493
|
async (nextFormData) => {
|
|
9261
9494
|
if (nextFormData === null) {
|
|
9262
9495
|
setData(initialData);
|
|
@@ -9287,23 +9520,23 @@ var useFormState = (action, initialData = {}) => {
|
|
|
9287
9520
|
};
|
|
9288
9521
|
|
|
9289
9522
|
// src/components/Form/FormErrorSummary.tsx
|
|
9290
|
-
var
|
|
9291
|
-
var
|
|
9523
|
+
var import_react33 = require("react");
|
|
9524
|
+
var import_type_guards30 = require("@wistia/type-guards");
|
|
9292
9525
|
var import_jsx_runtime222 = require("react/jsx-runtime");
|
|
9293
9526
|
var ErrorItem = ({ name, error, formId }) => {
|
|
9294
9527
|
return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(Link, { href: `#${formId}-${name}`, children: error }) }, name);
|
|
9295
9528
|
};
|
|
9296
9529
|
var FormErrorSummary = ({ description }) => {
|
|
9297
|
-
const ref = (0,
|
|
9298
|
-
const { formId, errors, hasSubmitted } = (0,
|
|
9530
|
+
const ref = (0, import_react33.useRef)(null);
|
|
9531
|
+
const { formId, errors, hasSubmitted } = (0, import_react33.useContext)(FormContext);
|
|
9299
9532
|
const isValid = Object.keys(errors).length === 0;
|
|
9300
9533
|
if (isValid || !hasSubmitted) {
|
|
9301
9534
|
return null;
|
|
9302
9535
|
}
|
|
9303
9536
|
return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { ref, children: [
|
|
9304
9537
|
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { children: description }),
|
|
9305
|
-
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0,
|
|
9306
|
-
([name, error]) => (0,
|
|
9538
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0, import_type_guards30.isNotUndefined)(error)).map(
|
|
9539
|
+
([name, error]) => (0, import_type_guards30.isArray)(error) ? error.map((err) => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
9307
9540
|
ErrorItem,
|
|
9308
9541
|
{
|
|
9309
9542
|
error: err,
|
|
@@ -9325,9 +9558,9 @@ var FormErrorSummary = ({ description }) => {
|
|
|
9325
9558
|
};
|
|
9326
9559
|
|
|
9327
9560
|
// src/components/FormField/FormField.tsx
|
|
9328
|
-
var
|
|
9561
|
+
var import_react36 = require("react");
|
|
9329
9562
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
9330
|
-
var
|
|
9563
|
+
var import_type_guards31 = require("@wistia/type-guards");
|
|
9331
9564
|
|
|
9332
9565
|
// src/components/Label/Label.tsx
|
|
9333
9566
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
@@ -9390,11 +9623,11 @@ var Label = ({
|
|
|
9390
9623
|
Label.displayName = "Label";
|
|
9391
9624
|
|
|
9392
9625
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9393
|
-
var
|
|
9626
|
+
var import_react35 = require("react");
|
|
9394
9627
|
|
|
9395
9628
|
// src/components/FormGroup/FormGroup.tsx
|
|
9396
9629
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
9397
|
-
var
|
|
9630
|
+
var import_react34 = require("react");
|
|
9398
9631
|
var import_jsx_runtime224 = require("react/jsx-runtime");
|
|
9399
9632
|
var StyledFieldset = import_styled_components49.default.fieldset`
|
|
9400
9633
|
border: 0;
|
|
@@ -9403,7 +9636,7 @@ var StyledLegend = import_styled_components49.default.legend`
|
|
|
9403
9636
|
margin-bottom: var(--space-01);
|
|
9404
9637
|
`;
|
|
9405
9638
|
var FormGroup = ({ children, label, ...props }) => {
|
|
9406
|
-
const ref = (0,
|
|
9639
|
+
const ref = (0, import_react34.useRef)();
|
|
9407
9640
|
return /* @__PURE__ */ (0, import_jsx_runtime224.jsxs)(
|
|
9408
9641
|
Stack,
|
|
9409
9642
|
{
|
|
@@ -9428,7 +9661,7 @@ FormGroup.displayName = "FormGroup";
|
|
|
9428
9661
|
|
|
9429
9662
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9430
9663
|
var import_jsx_runtime225 = require("react/jsx-runtime");
|
|
9431
|
-
var CheckboxGroupContext = (0,
|
|
9664
|
+
var CheckboxGroupContext = (0, import_react35.createContext)(null);
|
|
9432
9665
|
var CheckboxGroup = ({
|
|
9433
9666
|
children,
|
|
9434
9667
|
name,
|
|
@@ -9436,7 +9669,7 @@ var CheckboxGroup = ({
|
|
|
9436
9669
|
value,
|
|
9437
9670
|
...props
|
|
9438
9671
|
}) => {
|
|
9439
|
-
const context = (0,
|
|
9672
|
+
const context = (0, import_react35.useMemo)(() => {
|
|
9440
9673
|
return {
|
|
9441
9674
|
name,
|
|
9442
9675
|
onChange
|
|
@@ -9487,7 +9720,7 @@ var StyledErrorList = import_styled_components50.default.ul`
|
|
|
9487
9720
|
gap: var(--wui-space-01);
|
|
9488
9721
|
`;
|
|
9489
9722
|
var ErrorMessages = ({ errors, id }) => {
|
|
9490
|
-
const isMultipleErrors = (0,
|
|
9723
|
+
const isMultipleErrors = (0, import_type_guards31.isArray)(errors);
|
|
9491
9724
|
return isMultipleErrors ? /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(StyledErrorList, { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
|
|
9492
9725
|
Text,
|
|
9493
9726
|
{
|
|
@@ -9521,8 +9754,8 @@ var FormField = ({
|
|
|
9521
9754
|
value,
|
|
9522
9755
|
...props
|
|
9523
9756
|
}) => {
|
|
9524
|
-
const formState = (0,
|
|
9525
|
-
const checkboxGroup = (0,
|
|
9757
|
+
const formState = (0, import_react36.useContext)(FormContext);
|
|
9758
|
+
const checkboxGroup = (0, import_react36.useContext)(CheckboxGroupContext);
|
|
9526
9759
|
const defaultValue = formState.values[name];
|
|
9527
9760
|
const isIntegratedLabel = children.type === Checkbox;
|
|
9528
9761
|
const computedId = id ?? `${formState.formId}-${name}`;
|
|
@@ -9537,19 +9770,19 @@ var FormField = ({
|
|
|
9537
9770
|
"aria-describedby": ariaDescribedby,
|
|
9538
9771
|
...props
|
|
9539
9772
|
};
|
|
9540
|
-
if ((0,
|
|
9773
|
+
if ((0, import_type_guards31.isUndefined)(value) && (0, import_type_guards31.isNotUndefined)(defaultValue)) {
|
|
9541
9774
|
childProps = {
|
|
9542
9775
|
...childProps,
|
|
9543
9776
|
defaultValue
|
|
9544
9777
|
};
|
|
9545
9778
|
}
|
|
9546
|
-
if ((0,
|
|
9547
|
-
const computedName = (0,
|
|
9779
|
+
if ((0, import_type_guards31.isNotNil)(checkboxGroup)) {
|
|
9780
|
+
const computedName = (0, import_type_guards31.isNotNil)(checkboxGroup.name) ? `${checkboxGroup.name}[${name}]` : name;
|
|
9548
9781
|
const handleChange = (event) => {
|
|
9549
|
-
if ((0,
|
|
9782
|
+
if ((0, import_type_guards31.isNotUndefined)(props.onChange)) {
|
|
9550
9783
|
props.onChange(event);
|
|
9551
9784
|
}
|
|
9552
|
-
if ((0,
|
|
9785
|
+
if ((0, import_type_guards31.isNotUndefined)(checkboxGroup.onChange)) {
|
|
9553
9786
|
checkboxGroup.onChange(event);
|
|
9554
9787
|
}
|
|
9555
9788
|
};
|
|
@@ -9557,10 +9790,10 @@ var FormField = ({
|
|
|
9557
9790
|
...childProps,
|
|
9558
9791
|
name: computedName,
|
|
9559
9792
|
onChange: handleChange,
|
|
9560
|
-
"aria-invalid": (0,
|
|
9793
|
+
"aria-invalid": (0, import_type_guards31.isNotNil)(error)
|
|
9561
9794
|
};
|
|
9562
9795
|
}
|
|
9563
|
-
|
|
9796
|
+
import_react36.Children.only(children);
|
|
9564
9797
|
return /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(
|
|
9565
9798
|
StyledFormField,
|
|
9566
9799
|
{
|
|
@@ -9568,9 +9801,9 @@ var FormField = ({
|
|
|
9568
9801
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
9569
9802
|
children: [
|
|
9570
9803
|
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(Label, { htmlFor: computedId, children: label }),
|
|
9571
|
-
(0,
|
|
9572
|
-
(0,
|
|
9573
|
-
(0,
|
|
9804
|
+
(0, import_type_guards31.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
9805
|
+
(0, import_react36.cloneElement)(children, childProps),
|
|
9806
|
+
(0, import_type_guards31.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(import_jsx_runtime226.Fragment, { children: [
|
|
9574
9807
|
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)("div", {}),
|
|
9575
9808
|
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)(
|
|
9576
9809
|
ErrorMessages,
|
|
@@ -9587,9 +9820,9 @@ var FormField = ({
|
|
|
9587
9820
|
FormField.displayName = "FormField";
|
|
9588
9821
|
|
|
9589
9822
|
// src/components/FormGroup/RadioGroup.tsx
|
|
9590
|
-
var
|
|
9823
|
+
var import_react37 = require("react");
|
|
9591
9824
|
var import_jsx_runtime227 = require("react/jsx-runtime");
|
|
9592
|
-
var RadioGroupContext = (0,
|
|
9825
|
+
var RadioGroupContext = (0, import_react37.createContext)(null);
|
|
9593
9826
|
var RadioGroup = ({
|
|
9594
9827
|
children,
|
|
9595
9828
|
name,
|
|
@@ -9597,7 +9830,7 @@ var RadioGroup = ({
|
|
|
9597
9830
|
value,
|
|
9598
9831
|
...props
|
|
9599
9832
|
}) => {
|
|
9600
|
-
const context = (0,
|
|
9833
|
+
const context = (0, import_react37.useMemo)(() => {
|
|
9601
9834
|
return {
|
|
9602
9835
|
name,
|
|
9603
9836
|
onChange
|
|
@@ -9608,7 +9841,7 @@ var RadioGroup = ({
|
|
|
9608
9841
|
RadioGroup.displayName = "RadioGroup";
|
|
9609
9842
|
|
|
9610
9843
|
// src/components/IconButton/IconButton.tsx
|
|
9611
|
-
var
|
|
9844
|
+
var import_react38 = require("react");
|
|
9612
9845
|
var import_styled_components51 = __toESM(require("styled-components"));
|
|
9613
9846
|
var import_jsx_runtime228 = require("react/jsx-runtime");
|
|
9614
9847
|
var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
@@ -9625,7 +9858,7 @@ var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
|
9625
9858
|
align-items: center;
|
|
9626
9859
|
line-height: 1;
|
|
9627
9860
|
`;
|
|
9628
|
-
var IconButton = (0,
|
|
9861
|
+
var IconButton = (0, import_react38.forwardRef)(
|
|
9629
9862
|
({ children, label, size = "md", ...props }, ref) => {
|
|
9630
9863
|
const responsiveSize = useResponsiveProp(size);
|
|
9631
9864
|
return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
@@ -9636,7 +9869,7 @@ var IconButton = (0, import_react37.forwardRef)(
|
|
|
9636
9869
|
"aria-label": label,
|
|
9637
9870
|
"data-wistia-ui-icon-button": true,
|
|
9638
9871
|
size: responsiveSize,
|
|
9639
|
-
children: (0,
|
|
9872
|
+
children: (0, import_react38.cloneElement)(import_react38.Children.only(children), {
|
|
9640
9873
|
size: responsiveSize
|
|
9641
9874
|
})
|
|
9642
9875
|
}
|
|
@@ -9647,7 +9880,7 @@ IconButton.displayName = "IconButton";
|
|
|
9647
9880
|
|
|
9648
9881
|
// src/components/Image/Image.tsx
|
|
9649
9882
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
9650
|
-
var
|
|
9883
|
+
var import_type_guards32 = require("@wistia/type-guards");
|
|
9651
9884
|
var import_jsx_runtime229 = require("react/jsx-runtime");
|
|
9652
9885
|
var getFillStyle2 = (fillContainer) => {
|
|
9653
9886
|
if (fillContainer === "horizontal") {
|
|
@@ -9665,7 +9898,7 @@ var getFillStyle2 = (fillContainer) => {
|
|
|
9665
9898
|
return void 0;
|
|
9666
9899
|
};
|
|
9667
9900
|
var StyledImage = import_styled_components52.default.img`
|
|
9668
|
-
border-radius: ${({ $borderRadius }) => (0,
|
|
9901
|
+
border-radius: ${({ $borderRadius }) => (0, import_type_guards32.isNotNil)($borderRadius) ? `var(--wui-${$borderRadius})` : void 0};
|
|
9669
9902
|
${({ $fillContainer }) => getFillStyle2($fillContainer)};
|
|
9670
9903
|
object-fit: ${({ $objFit }) => $objFit};
|
|
9671
9904
|
object-position: ${({ $objPosition }) => $objPosition};
|
|
@@ -9697,13 +9930,13 @@ Image.displayName = "Image";
|
|
|
9697
9930
|
// src/components/Menu/Menu.tsx
|
|
9698
9931
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
9699
9932
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
9700
|
-
var
|
|
9701
|
-
var
|
|
9933
|
+
var import_type_guards33 = require("@wistia/type-guards");
|
|
9934
|
+
var import_react40 = require("react");
|
|
9702
9935
|
|
|
9703
9936
|
// src/components/Menu/MenuContext.tsx
|
|
9704
|
-
var
|
|
9705
|
-
var MenuContext = (0,
|
|
9706
|
-
var useMenuContext = () => (0,
|
|
9937
|
+
var import_react39 = require("react");
|
|
9938
|
+
var MenuContext = (0, import_react39.createContext)({ compact: false });
|
|
9939
|
+
var useMenuContext = () => (0, import_react39.useContext)(MenuContext);
|
|
9707
9940
|
|
|
9708
9941
|
// src/components/Menu/Menu.tsx
|
|
9709
9942
|
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
@@ -9807,9 +10040,9 @@ var Menu = ({
|
|
|
9807
10040
|
onInteractOutside,
|
|
9808
10041
|
...props
|
|
9809
10042
|
}) => {
|
|
9810
|
-
const contextValue = (0,
|
|
10043
|
+
const contextValue = (0, import_react40.useMemo)(() => ({ compact }), [compact]);
|
|
9811
10044
|
let controlProps = {
|
|
9812
|
-
...(0,
|
|
10045
|
+
...(0, import_type_guards33.isNotNil)(onOpenChange) && (0, import_type_guards33.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
9813
10046
|
};
|
|
9814
10047
|
if (disabled) {
|
|
9815
10048
|
controlProps = {
|
|
@@ -9823,7 +10056,7 @@ var Menu = ({
|
|
|
9823
10056
|
modal: false,
|
|
9824
10057
|
...controlProps,
|
|
9825
10058
|
children: [
|
|
9826
|
-
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0,
|
|
10059
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0, import_type_guards33.isNotUndefined)(trigger) ? trigger : /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
9827
10060
|
Button,
|
|
9828
10061
|
{
|
|
9829
10062
|
"aria-expanded": isOpen,
|
|
@@ -9881,15 +10114,15 @@ var MenuLabel = ({ children, ...props }) => {
|
|
|
9881
10114
|
MenuLabel.displayName = "MenuLabel";
|
|
9882
10115
|
|
|
9883
10116
|
// src/components/Menu/SubMenu.tsx
|
|
9884
|
-
var
|
|
10117
|
+
var import_react42 = require("react");
|
|
9885
10118
|
var import_styled_components57 = __toESM(require("styled-components"));
|
|
9886
10119
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
9887
|
-
var
|
|
10120
|
+
var import_type_guards35 = require("@wistia/type-guards");
|
|
9888
10121
|
|
|
9889
10122
|
// src/components/Menu/MenuItemButton.tsx
|
|
9890
|
-
var
|
|
10123
|
+
var import_react41 = require("react");
|
|
9891
10124
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
9892
|
-
var
|
|
10125
|
+
var import_type_guards34 = require("@wistia/type-guards");
|
|
9893
10126
|
var import_jsx_runtime232 = require("react/jsx-runtime");
|
|
9894
10127
|
var StyledButton3 = (0, import_styled_components55.default)(Button)`
|
|
9895
10128
|
${({ colorScheme }) => getColorScheme(colorScheme)};
|
|
@@ -9964,10 +10197,10 @@ var StyledBadgeContainer = import_styled_components55.default.div`
|
|
|
9964
10197
|
font-size: var(--wui-typography-label-4-size);
|
|
9965
10198
|
color: var(--wui-color-text-secondary);
|
|
9966
10199
|
`;
|
|
9967
|
-
var MenuItemButton = (0,
|
|
10200
|
+
var MenuItemButton = (0, import_react41.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
9968
10201
|
let { colorScheme, badge } = props;
|
|
9969
10202
|
if (appearance === "dangerous") {
|
|
9970
|
-
if ((0,
|
|
10203
|
+
if ((0, import_type_guards34.isNotUndefined)(colorScheme)) {
|
|
9971
10204
|
console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
9972
10205
|
}
|
|
9973
10206
|
colorScheme = "error";
|
|
@@ -9997,7 +10230,7 @@ var MenuItemButton = (0, import_react40.forwardRef)(({ children, appearance, com
|
|
|
9997
10230
|
children: [
|
|
9998
10231
|
props.leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
9999
10232
|
/* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledLabelAndDescriptionContainer, { children }),
|
|
10000
|
-
(0,
|
|
10233
|
+
(0, import_type_guards34.isNotNil)(badge) || (0, import_type_guards34.isNotNil)(command) ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledBadgeContainer, { children: badge ?? command }) : null,
|
|
10001
10234
|
props.rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
10002
10235
|
]
|
|
10003
10236
|
}
|
|
@@ -10060,12 +10293,12 @@ var SubMenu = ({
|
|
|
10060
10293
|
...props
|
|
10061
10294
|
}) => {
|
|
10062
10295
|
const { isSmAndUp } = useMq();
|
|
10063
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
10296
|
+
const [isExpanded, setIsExpanded] = (0, import_react42.useState)(false);
|
|
10064
10297
|
const { compact } = useMenuContext();
|
|
10065
10298
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
10066
10299
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
10067
10300
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(MenuItemLabel, { children: label }),
|
|
10068
|
-
(0,
|
|
10301
|
+
(0, import_type_guards35.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(MenuItemDescription, { children: description }) : null
|
|
10069
10302
|
] }),
|
|
10070
10303
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(import_react_dropdown_menu3.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(SubMenuContent, { $compact: compact, children }) })
|
|
10071
10304
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(import_react_dropdown_menu3.DropdownMenuGroup, { children: [
|
|
@@ -10089,10 +10322,10 @@ var SubMenu = ({
|
|
|
10089
10322
|
SubMenu.displayName = "SubMenu";
|
|
10090
10323
|
|
|
10091
10324
|
// src/components/Menu/MenuItem.tsx
|
|
10092
|
-
var
|
|
10325
|
+
var import_react43 = require("react");
|
|
10093
10326
|
var import_react_dropdown_menu4 = require("@radix-ui/react-dropdown-menu");
|
|
10094
10327
|
var import_jsx_runtime235 = require("react/jsx-runtime");
|
|
10095
|
-
var MenuItem = (0,
|
|
10328
|
+
var MenuItem = (0, import_react43.forwardRef)(
|
|
10096
10329
|
({ onSelect = () => null, ...props }, ref) => {
|
|
10097
10330
|
return /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
10098
10331
|
import_react_dropdown_menu4.DropdownMenuItem,
|
|
@@ -10242,10 +10475,10 @@ var CheckboxMenuItem = ({
|
|
|
10242
10475
|
CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
10243
10476
|
|
|
10244
10477
|
// src/components/Modal/Modal.tsx
|
|
10245
|
-
var
|
|
10478
|
+
var import_react47 = require("react");
|
|
10246
10479
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
10247
10480
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
10248
|
-
var
|
|
10481
|
+
var import_type_guards37 = require("@wistia/type-guards");
|
|
10249
10482
|
|
|
10250
10483
|
// src/components/Modal/ModalHeader.tsx
|
|
10251
10484
|
var import_styled_components59 = __toESM(require("styled-components"));
|
|
@@ -10302,21 +10535,21 @@ var ModalHeader = ({
|
|
|
10302
10535
|
};
|
|
10303
10536
|
|
|
10304
10537
|
// src/components/Modal/ModalContent.tsx
|
|
10305
|
-
var
|
|
10538
|
+
var import_react45 = require("react");
|
|
10306
10539
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
10307
10540
|
var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
10308
10541
|
|
|
10309
10542
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
10310
|
-
var
|
|
10311
|
-
var
|
|
10543
|
+
var import_react44 = require("react");
|
|
10544
|
+
var import_type_guards36 = require("@wistia/type-guards");
|
|
10312
10545
|
var useFocusRestore = () => {
|
|
10313
|
-
const previouslyFocusedRef = (0,
|
|
10314
|
-
(0,
|
|
10546
|
+
const previouslyFocusedRef = (0, import_react44.useRef)(null);
|
|
10547
|
+
(0, import_react44.useEffect)(() => {
|
|
10315
10548
|
previouslyFocusedRef.current = document.activeElement;
|
|
10316
10549
|
}, []);
|
|
10317
|
-
(0,
|
|
10550
|
+
(0, import_react44.useEffect)(() => {
|
|
10318
10551
|
return () => {
|
|
10319
|
-
if ((0,
|
|
10552
|
+
if ((0, import_type_guards36.isNotNil)(previouslyFocusedRef.current)) {
|
|
10320
10553
|
setTimeout(() => {
|
|
10321
10554
|
previouslyFocusedRef.current?.focus();
|
|
10322
10555
|
}, 0);
|
|
@@ -10368,7 +10601,7 @@ var StyledModalContent = (0, import_styled_components60.default)(import_react_di
|
|
|
10368
10601
|
}
|
|
10369
10602
|
}
|
|
10370
10603
|
`;
|
|
10371
|
-
var ModalContent = (0,
|
|
10604
|
+
var ModalContent = (0, import_react45.forwardRef)(
|
|
10372
10605
|
({ fullHeight, width, children, ...otherProps }, ref) => {
|
|
10373
10606
|
useFocusRestore();
|
|
10374
10607
|
return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
|
|
@@ -10386,7 +10619,7 @@ var ModalContent = (0, import_react44.forwardRef)(
|
|
|
10386
10619
|
);
|
|
10387
10620
|
|
|
10388
10621
|
// src/private/components/Backdrop/Backdrop.tsx
|
|
10389
|
-
var
|
|
10622
|
+
var import_react46 = require("react");
|
|
10390
10623
|
var import_styled_components61 = __toESM(require("styled-components"));
|
|
10391
10624
|
var import_jsx_runtime242 = require("react/jsx-runtime");
|
|
10392
10625
|
var backdropAnimationDuration = 150;
|
|
@@ -10424,7 +10657,7 @@ var BackdropComponent = import_styled_components61.default.div`
|
|
|
10424
10657
|
}
|
|
10425
10658
|
}
|
|
10426
10659
|
`;
|
|
10427
|
-
var Backdrop = (0,
|
|
10660
|
+
var Backdrop = (0, import_react46.forwardRef)(
|
|
10428
10661
|
({ alignHorizontal = "center", alignVertical = "center", children, ...otherProps }, ref) => /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
|
|
10429
10662
|
BackdropComponent,
|
|
10430
10663
|
{
|
|
@@ -10446,7 +10679,7 @@ var ModalBody = import_styled_components62.default.div`
|
|
|
10446
10679
|
display: flex;
|
|
10447
10680
|
order: 2;
|
|
10448
10681
|
`;
|
|
10449
|
-
var Modal = (0,
|
|
10682
|
+
var Modal = (0, import_react47.forwardRef)(
|
|
10450
10683
|
({
|
|
10451
10684
|
children,
|
|
10452
10685
|
fullHeight = false,
|
|
@@ -10463,7 +10696,7 @@ var Modal = (0, import_react46.forwardRef)(
|
|
|
10463
10696
|
import_react_dialog4.Root,
|
|
10464
10697
|
{
|
|
10465
10698
|
onOpenChange: (open2) => {
|
|
10466
|
-
if (!open2 && (0,
|
|
10699
|
+
if (!open2 && (0, import_type_guards37.isNotNil)(onRequestClose)) {
|
|
10467
10700
|
onRequestClose();
|
|
10468
10701
|
}
|
|
10469
10702
|
},
|
|
@@ -10476,7 +10709,7 @@ var Modal = (0, import_react46.forwardRef)(
|
|
|
10476
10709
|
ref,
|
|
10477
10710
|
fullHeight,
|
|
10478
10711
|
onOpenAutoFocus: (event) => {
|
|
10479
|
-
if ((0,
|
|
10712
|
+
if ((0, import_type_guards37.isNotNil)(initialFocusRef) && initialFocusRef.current) {
|
|
10480
10713
|
event.preventDefault();
|
|
10481
10714
|
requestAnimationFrame(() => {
|
|
10482
10715
|
initialFocusRef.current?.focus();
|
|
@@ -10510,9 +10743,9 @@ var import_react_popover = require("@radix-ui/react-popover");
|
|
|
10510
10743
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
10511
10744
|
|
|
10512
10745
|
// src/private/helpers/getControls/getControlProps.tsx
|
|
10513
|
-
var
|
|
10746
|
+
var import_type_guards38 = require("@wistia/type-guards");
|
|
10514
10747
|
var getControlProps = (isOpen, onOpenChange) => {
|
|
10515
|
-
return (0,
|
|
10748
|
+
return (0, import_type_guards38.isNotNil)(onOpenChange) && (0, import_type_guards38.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {};
|
|
10516
10749
|
};
|
|
10517
10750
|
|
|
10518
10751
|
// src/components/Popover/Popover.tsx
|
|
@@ -10571,7 +10804,7 @@ Popover.displayName = "Popover";
|
|
|
10571
10804
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
10572
10805
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
10573
10806
|
var import_react_progress = require("@radix-ui/react-progress");
|
|
10574
|
-
var
|
|
10807
|
+
var import_type_guards39 = require("@wistia/type-guards");
|
|
10575
10808
|
var import_jsx_runtime245 = require("react/jsx-runtime");
|
|
10576
10809
|
var ProgressBarWrapper = import_styled_components64.default.div`
|
|
10577
10810
|
--progress-bar-height: 8px;
|
|
@@ -10626,7 +10859,7 @@ var ProgressBar = ({
|
|
|
10626
10859
|
...props
|
|
10627
10860
|
}) => {
|
|
10628
10861
|
return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(ProgressBarWrapper, { children: [
|
|
10629
|
-
(0,
|
|
10862
|
+
(0, import_type_guards39.isNotNil)(labelLeft) ? /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ProgressBarLabel, { children: labelLeft }) : null,
|
|
10630
10863
|
/* @__PURE__ */ (0, import_jsx_runtime245.jsx)(
|
|
10631
10864
|
StyledProgressBar,
|
|
10632
10865
|
{
|
|
@@ -10642,15 +10875,15 @@ var ProgressBar = ({
|
|
|
10642
10875
|
)
|
|
10643
10876
|
}
|
|
10644
10877
|
),
|
|
10645
|
-
(0,
|
|
10878
|
+
(0, import_type_guards39.isNotNil)(labelRight) ? /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(ProgressBarLabel, { children: labelRight }) : null
|
|
10646
10879
|
] });
|
|
10647
10880
|
};
|
|
10648
10881
|
ProgressBar.displayName = "ProgressBar";
|
|
10649
10882
|
|
|
10650
10883
|
// src/components/Radio/Radio.tsx
|
|
10651
|
-
var
|
|
10884
|
+
var import_react48 = require("react");
|
|
10652
10885
|
var import_styled_components65 = __toESM(require("styled-components"));
|
|
10653
|
-
var
|
|
10886
|
+
var import_type_guards40 = require("@wistia/type-guards");
|
|
10654
10887
|
var import_jsx_runtime246 = require("react/jsx-runtime");
|
|
10655
10888
|
var RadioIcon = () => /* @__PURE__ */ (0, import_jsx_runtime246.jsx)(
|
|
10656
10889
|
"svg",
|
|
@@ -10751,7 +10984,7 @@ var StyledHiddenRadioInput = import_styled_components65.default.input`
|
|
|
10751
10984
|
display: block;
|
|
10752
10985
|
}
|
|
10753
10986
|
`;
|
|
10754
|
-
var Radio = (0,
|
|
10987
|
+
var Radio = (0, import_react48.forwardRef)(
|
|
10755
10988
|
({
|
|
10756
10989
|
checked,
|
|
10757
10990
|
disabled = false,
|
|
@@ -10766,8 +10999,8 @@ var Radio = (0, import_react47.forwardRef)(
|
|
|
10766
10999
|
hideLabel = false,
|
|
10767
11000
|
...props
|
|
10768
11001
|
}, ref) => {
|
|
10769
|
-
const generatedId = (0,
|
|
10770
|
-
const computedId = (0,
|
|
11002
|
+
const generatedId = (0, import_react48.useId)();
|
|
11003
|
+
const computedId = (0, import_type_guards40.isNonEmptyString)(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
10771
11004
|
return /* @__PURE__ */ (0, import_jsx_runtime246.jsxs)(
|
|
10772
11005
|
StyledRadioWrapper,
|
|
10773
11006
|
{
|
|
@@ -10816,22 +11049,22 @@ var Radio = (0, import_react47.forwardRef)(
|
|
|
10816
11049
|
Radio.displayName = "Radio";
|
|
10817
11050
|
|
|
10818
11051
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
10819
|
-
var
|
|
11052
|
+
var import_react52 = require("react");
|
|
10820
11053
|
var import_styled_components67 = __toESM(require("styled-components"));
|
|
10821
11054
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
10822
|
-
var
|
|
11055
|
+
var import_type_guards41 = require("@wistia/type-guards");
|
|
10823
11056
|
|
|
10824
11057
|
// src/components/SegmentedControl/useSelectedItemMeasurements.tsx
|
|
10825
|
-
var
|
|
11058
|
+
var import_react49 = require("react");
|
|
10826
11059
|
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
10827
|
-
var SelectedItemMeasurementsContext = (0,
|
|
11060
|
+
var SelectedItemMeasurementsContext = (0, import_react49.createContext)(
|
|
10828
11061
|
null
|
|
10829
11062
|
);
|
|
10830
11063
|
var SelectedItemMeasurementsProvider = ({
|
|
10831
11064
|
children
|
|
10832
11065
|
}) => {
|
|
10833
|
-
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0,
|
|
10834
|
-
const contextValue = (0,
|
|
11066
|
+
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0, import_react49.useState)(null);
|
|
11067
|
+
const contextValue = (0, import_react49.useMemo)(
|
|
10835
11068
|
() => ({
|
|
10836
11069
|
setSelectedItemMeasurements,
|
|
10837
11070
|
selectedItemMeasurements
|
|
@@ -10841,7 +11074,7 @@ var SelectedItemMeasurementsProvider = ({
|
|
|
10841
11074
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsx)(SelectedItemMeasurementsContext.Provider, { value: contextValue, children });
|
|
10842
11075
|
};
|
|
10843
11076
|
var useSelectedItemMeasurements = () => {
|
|
10844
|
-
const context = (0,
|
|
11077
|
+
const context = (0, import_react49.useContext)(SelectedItemMeasurementsContext);
|
|
10845
11078
|
if (context === null) {
|
|
10846
11079
|
throw new Error(
|
|
10847
11080
|
"useSelectedItemMeasurements must be used within a SelectedItemMeasurementsProvider"
|
|
@@ -10851,15 +11084,15 @@ var useSelectedItemMeasurements = () => {
|
|
|
10851
11084
|
};
|
|
10852
11085
|
|
|
10853
11086
|
// src/components/SegmentedControl/SelectedItemIndicator.tsx
|
|
10854
|
-
var
|
|
11087
|
+
var import_react51 = require("react");
|
|
10855
11088
|
var import_styled_components66 = __toESM(require("styled-components"));
|
|
10856
11089
|
|
|
10857
11090
|
// src/components/SegmentedControl/useSegmentedControlValue.tsx
|
|
10858
|
-
var
|
|
10859
|
-
var SegmentedControlValueContext = (0,
|
|
11091
|
+
var import_react50 = require("react");
|
|
11092
|
+
var SegmentedControlValueContext = (0, import_react50.createContext)(null);
|
|
10860
11093
|
var SegmentedControlValueProvider = SegmentedControlValueContext.Provider;
|
|
10861
11094
|
var useSegmentedControlValue = () => {
|
|
10862
|
-
const context = (0,
|
|
11095
|
+
const context = (0, import_react50.useContext)(SegmentedControlValueContext);
|
|
10863
11096
|
if (context === null) {
|
|
10864
11097
|
throw new Error("useSegmentedControlValue must be used within a SegmentedControlValueProvider");
|
|
10865
11098
|
}
|
|
@@ -10883,7 +11116,7 @@ var SelectedItemIndicatorDiv = import_styled_components66.default.div`
|
|
|
10883
11116
|
var SelectedItemIndicator = () => {
|
|
10884
11117
|
const selectedValue = useSegmentedControlValue();
|
|
10885
11118
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
10886
|
-
const selectedItemIndicatorStyle = (0,
|
|
11119
|
+
const selectedItemIndicatorStyle = (0, import_react51.useMemo)(
|
|
10887
11120
|
() => selectedItemMeasurements != null ? {
|
|
10888
11121
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
10889
11122
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -10921,7 +11154,7 @@ var segmentedControlStyles = import_styled_components67.css`
|
|
|
10921
11154
|
var StyledSegmentedControl = (0, import_styled_components67.default)(import_react_toggle_group.Root)`
|
|
10922
11155
|
${segmentedControlStyles}
|
|
10923
11156
|
`;
|
|
10924
|
-
var SegmentedControl = (0,
|
|
11157
|
+
var SegmentedControl = (0, import_react52.forwardRef)(
|
|
10925
11158
|
({
|
|
10926
11159
|
children,
|
|
10927
11160
|
disabled = false,
|
|
@@ -10930,7 +11163,7 @@ var SegmentedControl = (0, import_react51.forwardRef)(
|
|
|
10930
11163
|
onSelectedValueChange,
|
|
10931
11164
|
...props
|
|
10932
11165
|
}, ref) => {
|
|
10933
|
-
if ((0,
|
|
11166
|
+
if ((0, import_type_guards41.isNil)(children)) {
|
|
10934
11167
|
return null;
|
|
10935
11168
|
}
|
|
10936
11169
|
return /* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
|
|
@@ -10956,10 +11189,10 @@ var SegmentedControl = (0, import_react51.forwardRef)(
|
|
|
10956
11189
|
SegmentedControl.displayName = "SegmentedControl";
|
|
10957
11190
|
|
|
10958
11191
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
10959
|
-
var
|
|
11192
|
+
var import_react53 = require("react");
|
|
10960
11193
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
10961
11194
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
10962
|
-
var
|
|
11195
|
+
var import_type_guards42 = require("@wistia/type-guards");
|
|
10963
11196
|
var import_jsx_runtime250 = require("react/jsx-runtime");
|
|
10964
11197
|
var segmentedControlItemStyles = import_styled_components68.css`
|
|
10965
11198
|
all: unset; /* ToggleGroupItem is a button element */
|
|
@@ -11024,11 +11257,11 @@ var segmentedControlItemStyles = import_styled_components68.css`
|
|
|
11024
11257
|
var StyledSegmentedControlItem = (0, import_styled_components68.default)(import_react_toggle_group2.Item)`
|
|
11025
11258
|
${segmentedControlItemStyles}
|
|
11026
11259
|
`;
|
|
11027
|
-
var SegmentedControlItem = (0,
|
|
11260
|
+
var SegmentedControlItem = (0, import_react53.forwardRef)(
|
|
11028
11261
|
({ disabled, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11029
11262
|
const selectedValue = useSegmentedControlValue();
|
|
11030
11263
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11031
|
-
const buttonRef = (0,
|
|
11264
|
+
const buttonRef = (0, import_react53.useRef)(null);
|
|
11032
11265
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11033
11266
|
const handleClick = (event) => {
|
|
11034
11267
|
const target = event.target;
|
|
@@ -11037,7 +11270,7 @@ var SegmentedControlItem = (0, import_react52.forwardRef)(
|
|
|
11037
11270
|
event.preventDefault();
|
|
11038
11271
|
}
|
|
11039
11272
|
};
|
|
11040
|
-
(0,
|
|
11273
|
+
(0, import_react53.useEffect)(() => {
|
|
11041
11274
|
const buttonElem = buttonRef.current;
|
|
11042
11275
|
if (!buttonElem) {
|
|
11043
11276
|
return void 0;
|
|
@@ -11066,8 +11299,8 @@ var SegmentedControlItem = (0, import_react52.forwardRef)(
|
|
|
11066
11299
|
StyledSegmentedControlItem,
|
|
11067
11300
|
{
|
|
11068
11301
|
ref: combinedRef,
|
|
11069
|
-
$hasLabel: (0,
|
|
11070
|
-
"aria-label": (0,
|
|
11302
|
+
$hasLabel: (0, import_type_guards42.isNotNil)(label),
|
|
11303
|
+
"aria-label": (0, import_type_guards42.isNotNil)(label) ? void 0 : ariaLabel,
|
|
11071
11304
|
disabled,
|
|
11072
11305
|
onClick: handleClick,
|
|
11073
11306
|
value,
|
|
@@ -11083,7 +11316,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
11083
11316
|
|
|
11084
11317
|
// src/components/Select/Select.tsx
|
|
11085
11318
|
var import_react_select = require("@radix-ui/react-select");
|
|
11086
|
-
var
|
|
11319
|
+
var import_react54 = require("react");
|
|
11087
11320
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
11088
11321
|
var import_jsx_runtime251 = require("react/jsx-runtime");
|
|
11089
11322
|
var StyledTrigger = (0, import_styled_components69.default)(import_react_select.Trigger)`
|
|
@@ -11152,7 +11385,7 @@ var StyledContent3 = (0, import_styled_components69.default)(import_react_select
|
|
|
11152
11385
|
max-height: var(--radix-select-content-available-height);
|
|
11153
11386
|
z-index: var(--wui-zindex-select);
|
|
11154
11387
|
`;
|
|
11155
|
-
var Select = (0,
|
|
11388
|
+
var Select = (0, import_react54.forwardRef)(
|
|
11156
11389
|
({
|
|
11157
11390
|
colorScheme = "inherit",
|
|
11158
11391
|
children,
|
|
@@ -11201,7 +11434,7 @@ Select.displayName = "Select";
|
|
|
11201
11434
|
|
|
11202
11435
|
// src/components/Select/SelectOption.tsx
|
|
11203
11436
|
var import_react_select2 = require("@radix-ui/react-select");
|
|
11204
|
-
var
|
|
11437
|
+
var import_react55 = require("react");
|
|
11205
11438
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
11206
11439
|
var import_jsx_runtime252 = require("react/jsx-runtime");
|
|
11207
11440
|
var StyledItem = (0, import_styled_components70.default)(import_react_select2.Item)`
|
|
@@ -11230,7 +11463,7 @@ var StyledItem = (0, import_styled_components70.default)(import_react_select2.It
|
|
|
11230
11463
|
var StyledIconContainer = import_styled_components70.default.span`
|
|
11231
11464
|
width: 12px;
|
|
11232
11465
|
`;
|
|
11233
|
-
var SelectOption = (0,
|
|
11466
|
+
var SelectOption = (0, import_react55.forwardRef)(
|
|
11234
11467
|
({ children, ...props }, forwardedRef) => {
|
|
11235
11468
|
return /* @__PURE__ */ (0, import_jsx_runtime252.jsxs)(
|
|
11236
11469
|
StyledItem,
|
|
@@ -11275,9 +11508,9 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
11275
11508
|
};
|
|
11276
11509
|
|
|
11277
11510
|
// src/components/Switch/Switch.tsx
|
|
11278
|
-
var
|
|
11511
|
+
var import_react56 = require("react");
|
|
11279
11512
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
11280
|
-
var
|
|
11513
|
+
var import_type_guards43 = require("@wistia/type-guards");
|
|
11281
11514
|
var import_jsx_runtime254 = require("react/jsx-runtime");
|
|
11282
11515
|
var sizeSmall3 = import_styled_components72.css`
|
|
11283
11516
|
--wui-size-small-width: 24px;
|
|
@@ -11380,7 +11613,7 @@ var StyledHiddenSwitchInput = import_styled_components72.default.input`
|
|
|
11380
11613
|
}
|
|
11381
11614
|
}
|
|
11382
11615
|
`;
|
|
11383
|
-
var Switch = (0,
|
|
11616
|
+
var Switch = (0, import_react56.forwardRef)(
|
|
11384
11617
|
({
|
|
11385
11618
|
checked,
|
|
11386
11619
|
disabled = false,
|
|
@@ -11395,8 +11628,8 @@ var Switch = (0, import_react55.forwardRef)(
|
|
|
11395
11628
|
hideLabel = false,
|
|
11396
11629
|
...props
|
|
11397
11630
|
}, ref) => {
|
|
11398
|
-
const generatedId = (0,
|
|
11399
|
-
const computedId = (0,
|
|
11631
|
+
const generatedId = (0, import_react56.useId)();
|
|
11632
|
+
const computedId = (0, import_type_guards43.isNonEmptyString)(id) ? id : `wistia-ui-switch-${generatedId}`;
|
|
11400
11633
|
return /* @__PURE__ */ (0, import_jsx_runtime254.jsxs)(StyledSwitchWrapper, { $disabled: disabled, children: [
|
|
11401
11634
|
/* @__PURE__ */ (0, import_jsx_runtime254.jsx)(
|
|
11402
11635
|
StyledHiddenSwitchInput,
|
|
@@ -11477,8 +11710,8 @@ var Table = ({
|
|
|
11477
11710
|
var import_styled_components74 = __toESM(require("styled-components"));
|
|
11478
11711
|
|
|
11479
11712
|
// src/components/Table/TableSectionContext.ts
|
|
11480
|
-
var
|
|
11481
|
-
var TableSectionContext = (0,
|
|
11713
|
+
var import_react57 = require("react");
|
|
11714
|
+
var TableSectionContext = (0, import_react57.createContext)(null);
|
|
11482
11715
|
|
|
11483
11716
|
// src/components/Table/TableBody.tsx
|
|
11484
11717
|
var import_jsx_runtime256 = require("react/jsx-runtime");
|
|
@@ -11488,7 +11721,7 @@ var TableBody = ({ children, ...props }) => {
|
|
|
11488
11721
|
};
|
|
11489
11722
|
|
|
11490
11723
|
// src/components/Table/TableCell.tsx
|
|
11491
|
-
var
|
|
11724
|
+
var import_react58 = require("react");
|
|
11492
11725
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
11493
11726
|
var import_jsx_runtime257 = require("react/jsx-runtime");
|
|
11494
11727
|
var sharedStyles = import_styled_components75.css`
|
|
@@ -11509,7 +11742,7 @@ var StyledTd = import_styled_components75.default.td`
|
|
|
11509
11742
|
line-height: var(--wui-typography-body-2-line-height);
|
|
11510
11743
|
`;
|
|
11511
11744
|
var TableCell = ({ children, ...props }) => {
|
|
11512
|
-
const section = (0,
|
|
11745
|
+
const section = (0, import_react58.useContext)(TableSectionContext);
|
|
11513
11746
|
if (section === "head") {
|
|
11514
11747
|
return /* @__PURE__ */ (0, import_jsx_runtime257.jsx)(StyledTh, { ...props, children });
|
|
11515
11748
|
}
|
|
@@ -11541,9 +11774,9 @@ var TableRow = ({ children, ...props }) => {
|
|
|
11541
11774
|
};
|
|
11542
11775
|
|
|
11543
11776
|
// src/components/Tabs/Tabs.tsx
|
|
11544
|
-
var
|
|
11777
|
+
var import_react63 = require("react");
|
|
11545
11778
|
var import_react_tabs4 = require("@radix-ui/react-tabs");
|
|
11546
|
-
var
|
|
11779
|
+
var import_type_guards45 = require("@wistia/type-guards");
|
|
11547
11780
|
var import_styled_components83 = __toESM(require("styled-components"));
|
|
11548
11781
|
|
|
11549
11782
|
// src/components/Tabs/TabPanel.tsx
|
|
@@ -11596,17 +11829,17 @@ var TabList = ({
|
|
|
11596
11829
|
TabList.displayName = "TabList";
|
|
11597
11830
|
|
|
11598
11831
|
// src/components/Tabs/TabItem.tsx
|
|
11599
|
-
var
|
|
11832
|
+
var import_react60 = require("react");
|
|
11600
11833
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
11601
11834
|
var import_react_tabs3 = require("@radix-ui/react-tabs");
|
|
11602
|
-
var
|
|
11835
|
+
var import_type_guards44 = require("@wistia/type-guards");
|
|
11603
11836
|
|
|
11604
11837
|
// src/components/Tabs/useTabsValue.tsx
|
|
11605
|
-
var
|
|
11606
|
-
var TabsValueContext = (0,
|
|
11838
|
+
var import_react59 = require("react");
|
|
11839
|
+
var TabsValueContext = (0, import_react59.createContext)(null);
|
|
11607
11840
|
var TabsValueProvider = TabsValueContext.Provider;
|
|
11608
11841
|
var useTabsValue = () => {
|
|
11609
|
-
const context = (0,
|
|
11842
|
+
const context = (0, import_react59.useContext)(TabsValueContext);
|
|
11610
11843
|
if (context === null) {
|
|
11611
11844
|
throw new Error("useTabsValue must be used within a TabsValueProvider");
|
|
11612
11845
|
}
|
|
@@ -11622,13 +11855,13 @@ var StyledTabItem = (0, import_styled_components81.default)(import_react_tabs3.T
|
|
|
11622
11855
|
outline: none;
|
|
11623
11856
|
}
|
|
11624
11857
|
`;
|
|
11625
|
-
var TabItem = (0,
|
|
11858
|
+
var TabItem = (0, import_react60.forwardRef)(
|
|
11626
11859
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11627
11860
|
const selectedValue = useTabsValue();
|
|
11628
11861
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11629
|
-
const buttonRef = (0,
|
|
11862
|
+
const buttonRef = (0, import_react60.useRef)(null);
|
|
11630
11863
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11631
|
-
(0,
|
|
11864
|
+
(0, import_react60.useEffect)(() => {
|
|
11632
11865
|
const buttonElem = buttonRef.current;
|
|
11633
11866
|
if (!buttonElem) {
|
|
11634
11867
|
return void 0;
|
|
@@ -11657,8 +11890,8 @@ var TabItem = (0, import_react59.forwardRef)(
|
|
|
11657
11890
|
StyledTabItem,
|
|
11658
11891
|
{
|
|
11659
11892
|
ref: combinedRef,
|
|
11660
|
-
$hasLabel: (0,
|
|
11661
|
-
"aria-label": (0,
|
|
11893
|
+
$hasLabel: (0, import_type_guards44.isNotNil)(label),
|
|
11894
|
+
"aria-label": (0, import_type_guards44.isNotNil)(label) ? void 0 : ariaLabel,
|
|
11662
11895
|
disabled,
|
|
11663
11896
|
value,
|
|
11664
11897
|
children: [
|
|
@@ -11672,16 +11905,16 @@ var TabItem = (0, import_react59.forwardRef)(
|
|
|
11672
11905
|
TabItem.displayName = "TabItem";
|
|
11673
11906
|
|
|
11674
11907
|
// src/components/Tabs/extractTabItems.ts
|
|
11675
|
-
var
|
|
11908
|
+
var import_react61 = require("react");
|
|
11676
11909
|
var extractTabItems = (children) => {
|
|
11677
11910
|
const tabItems = [];
|
|
11678
|
-
|
|
11679
|
-
if (!(0,
|
|
11911
|
+
import_react61.Children.forEach(children, (child) => {
|
|
11912
|
+
if (!(0, import_react61.isValidElement)(child)) {
|
|
11680
11913
|
return;
|
|
11681
11914
|
}
|
|
11682
11915
|
if (typeof child.type !== "string" && child.type.displayName === "Tab") {
|
|
11683
11916
|
tabItems.push(child);
|
|
11684
|
-
} else if (child.type ===
|
|
11917
|
+
} else if (child.type === import_react61.Fragment) {
|
|
11685
11918
|
const fragmentElement = child;
|
|
11686
11919
|
tabItems.push(...extractTabItems(fragmentElement.props.children));
|
|
11687
11920
|
} else if ((child.props.children ?? null) != null) {
|
|
@@ -11694,7 +11927,7 @@ var extractTabItems = (children) => {
|
|
|
11694
11927
|
};
|
|
11695
11928
|
|
|
11696
11929
|
// src/components/Tabs/SelectedItemIndicator.tsx
|
|
11697
|
-
var
|
|
11930
|
+
var import_react62 = require("react");
|
|
11698
11931
|
var import_styled_components82 = __toESM(require("styled-components"));
|
|
11699
11932
|
var import_jsx_runtime264 = require("react/jsx-runtime");
|
|
11700
11933
|
var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(SelectedItemIndicatorDiv)`
|
|
@@ -11705,7 +11938,7 @@ var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(Selec
|
|
|
11705
11938
|
var SelectedItemIndicator2 = () => {
|
|
11706
11939
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11707
11940
|
const selectedValue = useTabsValue();
|
|
11708
|
-
const selectedItemIndicatorStyle = (0,
|
|
11941
|
+
const selectedItemIndicatorStyle = (0, import_react62.useMemo)(
|
|
11709
11942
|
() => selectedItemMeasurements != null ? {
|
|
11710
11943
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
11711
11944
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -11746,7 +11979,7 @@ var StyledTabsRoot = (0, import_styled_components83.default)(import_react_tabs4.
|
|
|
11746
11979
|
flex-direction: column;
|
|
11747
11980
|
height: ${({ $stickyHeaders }) => $stickyHeaders ? "100%" : "auto"};
|
|
11748
11981
|
`;
|
|
11749
|
-
var Tabs = (0,
|
|
11982
|
+
var Tabs = (0, import_react63.forwardRef)(
|
|
11750
11983
|
({
|
|
11751
11984
|
children,
|
|
11752
11985
|
fullWidth = true,
|
|
@@ -11758,7 +11991,7 @@ var Tabs = (0, import_react62.forwardRef)(
|
|
|
11758
11991
|
...otherProps
|
|
11759
11992
|
}, ref) => {
|
|
11760
11993
|
const tabItems = extractTabItems(children);
|
|
11761
|
-
const [internalSelectedValue, setInternalSelectedValue] = (0,
|
|
11994
|
+
const [internalSelectedValue, setInternalSelectedValue] = (0, import_react63.useState)(defaultSelectedValue);
|
|
11762
11995
|
const modeProps = defaultSelectedValue !== void 0 ? {
|
|
11763
11996
|
defaultValue: defaultSelectedValue,
|
|
11764
11997
|
onValueChange: setInternalSelectedValue
|
|
@@ -11788,7 +12021,7 @@ var Tabs = (0, import_react62.forwardRef)(
|
|
|
11788
12021
|
label,
|
|
11789
12022
|
"aria-label": ariaLabelForTab
|
|
11790
12023
|
} = tab.props;
|
|
11791
|
-
if ((0,
|
|
12024
|
+
if ((0, import_type_guards45.isNil)(icon)) {
|
|
11792
12025
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11793
12026
|
TabItem,
|
|
11794
12027
|
{
|
|
@@ -11799,7 +12032,7 @@ var Tabs = (0, import_react62.forwardRef)(
|
|
|
11799
12032
|
value
|
|
11800
12033
|
);
|
|
11801
12034
|
}
|
|
11802
|
-
if ((0,
|
|
12035
|
+
if ((0, import_type_guards45.isNotNil)(label)) {
|
|
11803
12036
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11804
12037
|
TabItem,
|
|
11805
12038
|
{
|
|
@@ -11811,7 +12044,7 @@ var Tabs = (0, import_react62.forwardRef)(
|
|
|
11811
12044
|
value
|
|
11812
12045
|
);
|
|
11813
12046
|
}
|
|
11814
|
-
if ((0,
|
|
12047
|
+
if ((0, import_type_guards45.isNotNil)(ariaLabelForTab)) {
|
|
11815
12048
|
return /* @__PURE__ */ (0, import_jsx_runtime265.jsx)(
|
|
11816
12049
|
TabItem,
|
|
11817
12050
|
{
|
|
@@ -11844,17 +12077,17 @@ var Tabs = (0, import_react62.forwardRef)(
|
|
|
11844
12077
|
Tabs.displayName = "Tabs";
|
|
11845
12078
|
|
|
11846
12079
|
// src/components/Tabs/Tab.tsx
|
|
11847
|
-
var
|
|
12080
|
+
var import_react64 = require("react");
|
|
11848
12081
|
var import_jsx_runtime266 = require("react/jsx-runtime");
|
|
11849
|
-
var Tab = (0,
|
|
12082
|
+
var Tab = (0, import_react64.forwardRef)(({ children }, ref) => {
|
|
11850
12083
|
return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { ref, children });
|
|
11851
12084
|
});
|
|
11852
12085
|
Tab.displayName = "Tab";
|
|
11853
12086
|
|
|
11854
12087
|
// src/components/Tag/Tag.tsx
|
|
11855
|
-
var
|
|
12088
|
+
var import_react65 = require("react");
|
|
11856
12089
|
var import_styled_components84 = __toESM(require("styled-components"));
|
|
11857
|
-
var
|
|
12090
|
+
var import_type_guards46 = require("@wistia/type-guards");
|
|
11858
12091
|
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
11859
12092
|
var TagLabel = import_styled_components84.default.a`
|
|
11860
12093
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -11939,10 +12172,10 @@ var StyledTag = import_styled_components84.default.div`
|
|
|
11939
12172
|
}
|
|
11940
12173
|
`;
|
|
11941
12174
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
11942
|
-
if ((0,
|
|
12175
|
+
if ((0, import_type_guards46.isNil)(onClickRemove)) {
|
|
11943
12176
|
return null;
|
|
11944
12177
|
}
|
|
11945
|
-
if ((0,
|
|
12178
|
+
if ((0, import_type_guards46.isNil)(onClickRemoveLabel)) {
|
|
11946
12179
|
throw new Error(
|
|
11947
12180
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
11948
12181
|
);
|
|
@@ -11969,7 +12202,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
11969
12202
|
)
|
|
11970
12203
|
] });
|
|
11971
12204
|
};
|
|
11972
|
-
var Tag = (0,
|
|
12205
|
+
var Tag = (0, import_react65.forwardRef)(
|
|
11973
12206
|
({
|
|
11974
12207
|
onClickRemove,
|
|
11975
12208
|
colorScheme = "inherit",
|
|
@@ -11979,8 +12212,8 @@ var Tag = (0, import_react64.forwardRef)(
|
|
|
11979
12212
|
onClickRemoveLabel,
|
|
11980
12213
|
...otherProps
|
|
11981
12214
|
}, ref) => {
|
|
11982
|
-
const hasIcon = (0,
|
|
11983
|
-
const labelProps = (0,
|
|
12215
|
+
const hasIcon = (0, import_type_guards46.isNotNil)(icon);
|
|
12216
|
+
const labelProps = (0, import_type_guards46.isNotNil)(href) && (0, import_type_guards46.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
11984
12217
|
return /* @__PURE__ */ (0, import_jsx_runtime267.jsxs)(
|
|
11985
12218
|
StyledTag,
|
|
11986
12219
|
{
|
|
@@ -12016,7 +12249,7 @@ Tag.displayName = "Tag";
|
|
|
12016
12249
|
|
|
12017
12250
|
// src/components/WistiaLogo/WistiaLogo.tsx
|
|
12018
12251
|
var import_styled_components85 = __toESM(require("styled-components"));
|
|
12019
|
-
var
|
|
12252
|
+
var import_type_guards47 = require("@wistia/type-guards");
|
|
12020
12253
|
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
12021
12254
|
var renderBrandmark = (brandmarkColor, iconOnly) => {
|
|
12022
12255
|
if (iconOnly) {
|
|
@@ -12129,7 +12362,7 @@ var WistiaLogo = ({
|
|
|
12129
12362
|
...otherProps,
|
|
12130
12363
|
children: [
|
|
12131
12364
|
/* @__PURE__ */ (0, import_jsx_runtime268.jsx)("title", { children: title }),
|
|
12132
|
-
(0,
|
|
12365
|
+
(0, import_type_guards47.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime268.jsx)("desc", { children: description }) : null,
|
|
12133
12366
|
renderBrandmark(brandmarkColor, iconOnly),
|
|
12134
12367
|
renderLogotype(logotypeColor, iconOnly)
|
|
12135
12368
|
]
|
|
@@ -12226,6 +12459,7 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
12226
12459
|
useAriaLive,
|
|
12227
12460
|
useBoolean,
|
|
12228
12461
|
useFilePicker,
|
|
12462
|
+
useFocusTrap,
|
|
12229
12463
|
useFormState,
|
|
12230
12464
|
useImperativeFilePicker,
|
|
12231
12465
|
useKey,
|