@wistia/ui 0.6.26 → 0.6.27-beta.6b2285cf.551f326
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 +524 -284
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +35 -5
- package/dist/index.d.ts +35 -5
- package/dist/index.mjs +295 -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.27-beta.6b2285cf.551f326
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -123,6 +123,7 @@ __export(index_exports, {
|
|
|
123
123
|
useAriaLive: () => useAriaLive,
|
|
124
124
|
useBoolean: () => useBoolean,
|
|
125
125
|
useFilePicker: () => import_use_file_picker.useFilePicker,
|
|
126
|
+
useFocusTrap: () => useFocusTrap,
|
|
126
127
|
useFormState: () => useFormState,
|
|
127
128
|
useImperativeFilePicker: () => import_use_file_picker.useImperativeFilePicker,
|
|
128
129
|
useKey: () => useKey,
|
|
@@ -2540,14 +2541,246 @@ var useToast = () => {
|
|
|
2540
2541
|
);
|
|
2541
2542
|
};
|
|
2542
2543
|
|
|
2544
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2545
|
+
var import_react11 = require("react");
|
|
2546
|
+
var import_type_guards10 = require("@wistia/type-guards");
|
|
2547
|
+
|
|
2548
|
+
// src/hooks/useFocusTrap/helpers.ts
|
|
2549
|
+
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]';
|
|
2550
|
+
var coerceToString = (value) => value === null || value === void 0 ? "" : String(value);
|
|
2551
|
+
var isHiddenElement = (element) => {
|
|
2552
|
+
const { display, visibility } = window.getComputedStyle(element);
|
|
2553
|
+
const isHidden = display === "none" || element.style.display === "none" || visibility === "none" || element.style.visibility === "hidden";
|
|
2554
|
+
return element.offsetWidth <= 0 && element.offsetHeight <= 0 || isHidden;
|
|
2555
|
+
};
|
|
2556
|
+
var isVisibleElement = (element) => {
|
|
2557
|
+
let parentElement = element;
|
|
2558
|
+
while (parentElement) {
|
|
2559
|
+
if (parentElement === document.body) {
|
|
2560
|
+
break;
|
|
2561
|
+
}
|
|
2562
|
+
if (isHiddenElement(parentElement)) {
|
|
2563
|
+
return false;
|
|
2564
|
+
}
|
|
2565
|
+
parentElement = parentElement.parentNode;
|
|
2566
|
+
}
|
|
2567
|
+
return true;
|
|
2568
|
+
};
|
|
2569
|
+
var getElementTabIndex = (element) => {
|
|
2570
|
+
const tabIndex = element.getAttribute("tabindex");
|
|
2571
|
+
return Number.parseInt(tabIndex ?? void 0, 10);
|
|
2572
|
+
};
|
|
2573
|
+
var isTabIndexNaN = (element) => {
|
|
2574
|
+
const tabIndex = getElementTabIndex(element);
|
|
2575
|
+
return Number.isNaN(tabIndex);
|
|
2576
|
+
};
|
|
2577
|
+
var isFocusableElement = (element) => {
|
|
2578
|
+
const tabbableNodeRegEx = /input|select|textarea|button|object/;
|
|
2579
|
+
const nodeName = element.nodeName.toLowerCase();
|
|
2580
|
+
const isTabIndexNotNaN = !isTabIndexNaN(element);
|
|
2581
|
+
const isFocusable = (
|
|
2582
|
+
// @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.
|
|
2583
|
+
tabbableNodeRegEx.test(nodeName) && !element.disabled || (element instanceof HTMLAnchorElement ? element.href || isTabIndexNotNaN : isTabIndexNotNaN)
|
|
2584
|
+
);
|
|
2585
|
+
return Boolean(isFocusable) && isVisibleElement(element);
|
|
2586
|
+
};
|
|
2587
|
+
var isTabbableElement = (element) => {
|
|
2588
|
+
const tabIndex = getElementTabIndex(element);
|
|
2589
|
+
return (isTabIndexNaN(element) || tabIndex >= 0) && isFocusableElement(element);
|
|
2590
|
+
};
|
|
2591
|
+
var findTabbableDescendants = (element) => Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter(
|
|
2592
|
+
isTabbableElement
|
|
2593
|
+
);
|
|
2594
|
+
var focusLaterElements = [];
|
|
2595
|
+
var focusElement = null;
|
|
2596
|
+
var needToFocus = false;
|
|
2597
|
+
var handleBlur = () => {
|
|
2598
|
+
needToFocus = true;
|
|
2599
|
+
};
|
|
2600
|
+
var handleFocus = () => {
|
|
2601
|
+
if (needToFocus) {
|
|
2602
|
+
needToFocus = false;
|
|
2603
|
+
if (!focusElement) {
|
|
2604
|
+
return;
|
|
2605
|
+
}
|
|
2606
|
+
if (focusElement.contains(document.activeElement)) {
|
|
2607
|
+
return;
|
|
2608
|
+
}
|
|
2609
|
+
const element = findTabbableDescendants(focusElement)[0] ?? focusElement;
|
|
2610
|
+
element.focus();
|
|
2611
|
+
}
|
|
2612
|
+
};
|
|
2613
|
+
var markForFocusLater = () => {
|
|
2614
|
+
const element = document.activeElement;
|
|
2615
|
+
if (element !== null) {
|
|
2616
|
+
focusLaterElements.push(element);
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2619
|
+
var returnFocus = () => {
|
|
2620
|
+
let toFocus = null;
|
|
2621
|
+
try {
|
|
2622
|
+
toFocus = focusLaterElements.pop();
|
|
2623
|
+
if (toFocus) {
|
|
2624
|
+
toFocus.focus();
|
|
2625
|
+
}
|
|
2626
|
+
} catch {
|
|
2627
|
+
console.warn(
|
|
2628
|
+
`You tried to return focus to ${coerceToString(toFocus)} but it is not in the DOM anymore`
|
|
2629
|
+
);
|
|
2630
|
+
}
|
|
2631
|
+
};
|
|
2632
|
+
var setupScopedFocus = (element) => {
|
|
2633
|
+
focusElement = element;
|
|
2634
|
+
document.addEventListener("focusout", handleBlur, false);
|
|
2635
|
+
document.addEventListener("focusin", handleFocus, true);
|
|
2636
|
+
};
|
|
2637
|
+
var teardownScopedFocus = () => {
|
|
2638
|
+
focusElement = null;
|
|
2639
|
+
document.removeEventListener("focusout", handleBlur);
|
|
2640
|
+
document.removeEventListener("focusin", handleFocus);
|
|
2641
|
+
};
|
|
2642
|
+
var scopeTab = (node, event) => {
|
|
2643
|
+
const tabbable = findTabbableDescendants(node);
|
|
2644
|
+
if (!tabbable.length) {
|
|
2645
|
+
event.preventDefault();
|
|
2646
|
+
return;
|
|
2647
|
+
}
|
|
2648
|
+
const finalTabbable = tabbable[event.shiftKey ? 0 : tabbable.length - 1];
|
|
2649
|
+
const leavingFinalTabbable = finalTabbable === document.activeElement || node === document.activeElement;
|
|
2650
|
+
if (!leavingFinalTabbable) {
|
|
2651
|
+
return;
|
|
2652
|
+
}
|
|
2653
|
+
event.preventDefault();
|
|
2654
|
+
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
|
|
2655
|
+
if (target) {
|
|
2656
|
+
target.focus();
|
|
2657
|
+
}
|
|
2658
|
+
};
|
|
2659
|
+
var createAriaHider = (containerNode, selector) => {
|
|
2660
|
+
if (selector === void 0) {
|
|
2661
|
+
selector = "body > :not(script)";
|
|
2662
|
+
}
|
|
2663
|
+
const rootNodes = Array.from(document.querySelectorAll(selector)).map((node) => {
|
|
2664
|
+
if (node.contains(containerNode)) {
|
|
2665
|
+
return void 0;
|
|
2666
|
+
}
|
|
2667
|
+
const ariaHidden = node.getAttribute("aria-hidden");
|
|
2668
|
+
if (ariaHidden === null || ariaHidden === "false") {
|
|
2669
|
+
node.setAttribute("aria-hidden", "true");
|
|
2670
|
+
}
|
|
2671
|
+
return {
|
|
2672
|
+
node,
|
|
2673
|
+
ariaHidden
|
|
2674
|
+
};
|
|
2675
|
+
});
|
|
2676
|
+
return () => {
|
|
2677
|
+
rootNodes.forEach((item) => {
|
|
2678
|
+
if (!item) {
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
if (item.ariaHidden === null) {
|
|
2682
|
+
item.node.removeAttribute("aria-hidden");
|
|
2683
|
+
} else {
|
|
2684
|
+
item.node.setAttribute("aria-hidden", item.ariaHidden);
|
|
2685
|
+
}
|
|
2686
|
+
});
|
|
2687
|
+
};
|
|
2688
|
+
};
|
|
2689
|
+
|
|
2690
|
+
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2691
|
+
var isRef = (val) => {
|
|
2692
|
+
return val !== null && typeof val === "object" && "current" in val;
|
|
2693
|
+
};
|
|
2694
|
+
var useFocusTrap = (active = true, options = {}) => {
|
|
2695
|
+
const ref = (0, import_react11.useRef)(null);
|
|
2696
|
+
const restoreAriaRef = (0, import_react11.useRef)(null);
|
|
2697
|
+
const setRef = (0, import_react11.useCallback)(
|
|
2698
|
+
(node) => {
|
|
2699
|
+
if (restoreAriaRef.current !== null) {
|
|
2700
|
+
restoreAriaRef.current();
|
|
2701
|
+
}
|
|
2702
|
+
if (ref.current) {
|
|
2703
|
+
returnFocus();
|
|
2704
|
+
teardownScopedFocus();
|
|
2705
|
+
}
|
|
2706
|
+
if (active && node !== null && node !== void 0) {
|
|
2707
|
+
setupScopedFocus(node);
|
|
2708
|
+
markForFocusLater();
|
|
2709
|
+
const processNode = (node2) => {
|
|
2710
|
+
restoreAriaRef.current = !(options.disableAriaHider ?? false) ? createAriaHider(node2) : null;
|
|
2711
|
+
let focusElement2 = null;
|
|
2712
|
+
if ((0, import_type_guards10.isNotUndefined)(options.focusSelector)) {
|
|
2713
|
+
if (isRef(options.focusSelector)) {
|
|
2714
|
+
focusElement2 = options.focusSelector.current;
|
|
2715
|
+
} else {
|
|
2716
|
+
focusElement2 = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
if (!focusElement2) {
|
|
2720
|
+
const children = Array.from(
|
|
2721
|
+
node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)
|
|
2722
|
+
);
|
|
2723
|
+
focusElement2 = // Prefer tabbable elements, But fallback to any focusable element
|
|
2724
|
+
children.find(isTabbableElement) ?? // But fallback to any focusable element
|
|
2725
|
+
children.find(isFocusableElement) ?? // Nothing found
|
|
2726
|
+
null;
|
|
2727
|
+
if (!focusElement2 && isFocusableElement(node2)) {
|
|
2728
|
+
focusElement2 = node2;
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
if (focusElement2) {
|
|
2732
|
+
focusElement2.focus();
|
|
2733
|
+
}
|
|
2734
|
+
if (!focusElement2 && process.env["NODE_ENV"] === "development") {
|
|
2735
|
+
console.warn(
|
|
2736
|
+
'[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.',
|
|
2737
|
+
node2
|
|
2738
|
+
);
|
|
2739
|
+
}
|
|
2740
|
+
};
|
|
2741
|
+
setTimeout(() => {
|
|
2742
|
+
if (node.ownerDocument) {
|
|
2743
|
+
processNode(node);
|
|
2744
|
+
}
|
|
2745
|
+
if (!node.ownerDocument && process.env["NODE_ENV"] === "development") {
|
|
2746
|
+
console.warn(
|
|
2747
|
+
"[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.",
|
|
2748
|
+
node
|
|
2749
|
+
);
|
|
2750
|
+
}
|
|
2751
|
+
});
|
|
2752
|
+
ref.current = node;
|
|
2753
|
+
} else {
|
|
2754
|
+
ref.current = null;
|
|
2755
|
+
}
|
|
2756
|
+
},
|
|
2757
|
+
[active, options.focusSelector, options.disableAriaHider]
|
|
2758
|
+
);
|
|
2759
|
+
(0, import_react11.useEffect)(() => {
|
|
2760
|
+
if (!active) {
|
|
2761
|
+
return void 0;
|
|
2762
|
+
}
|
|
2763
|
+
const handleKeyDown = (event) => {
|
|
2764
|
+
if (event.key === "Tab" && ref.current) {
|
|
2765
|
+
scopeTab(ref.current, event);
|
|
2766
|
+
}
|
|
2767
|
+
};
|
|
2768
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2769
|
+
return () => {
|
|
2770
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
2771
|
+
};
|
|
2772
|
+
}, [active]);
|
|
2773
|
+
return setRef;
|
|
2774
|
+
};
|
|
2775
|
+
|
|
2543
2776
|
// src/components/ActionButton/ActionButton.tsx
|
|
2544
|
-
var
|
|
2777
|
+
var import_react15 = require("react");
|
|
2545
2778
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
2546
2779
|
|
|
2547
2780
|
// src/components/Button/Button.tsx
|
|
2548
|
-
var
|
|
2781
|
+
var import_react14 = require("react");
|
|
2549
2782
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2550
|
-
var
|
|
2783
|
+
var import_type_guards14 = require("@wistia/type-guards");
|
|
2551
2784
|
|
|
2552
2785
|
// src/css/buttonResetCss.tsx
|
|
2553
2786
|
var import_styled_components17 = require("styled-components");
|
|
@@ -2751,7 +2984,7 @@ var buttonSizeStyles = {
|
|
|
2751
2984
|
};
|
|
2752
2985
|
|
|
2753
2986
|
// src/components/Icon/Icon.tsx
|
|
2754
|
-
var
|
|
2987
|
+
var import_type_guards12 = require("@wistia/type-guards");
|
|
2755
2988
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
2756
2989
|
|
|
2757
2990
|
// src/components/Icon/icons/AbTestIcon.tsx
|
|
@@ -6492,17 +6725,17 @@ var iconMap = {
|
|
|
6492
6725
|
};
|
|
6493
6726
|
|
|
6494
6727
|
// src/private/hooks/useResponsiveProp/useResponsiveProp.ts
|
|
6495
|
-
var
|
|
6496
|
-
var
|
|
6728
|
+
var import_type_guards11 = require("@wistia/type-guards");
|
|
6729
|
+
var import_react12 = require("react");
|
|
6497
6730
|
var isResponsiveObject = (values) => {
|
|
6498
6731
|
return typeof values === "object" && values !== null && !Array.isArray(values) && "base" in values;
|
|
6499
6732
|
};
|
|
6500
6733
|
var useResponsiveProp = (values) => {
|
|
6501
6734
|
const activeMediaQueries = useActiveMq();
|
|
6502
|
-
return (0,
|
|
6503
|
-
if ((0,
|
|
6735
|
+
return (0, import_react12.useMemo)(() => {
|
|
6736
|
+
if ((0, import_type_guards11.isRecord)(values) && isResponsiveObject(values)) {
|
|
6504
6737
|
const mq2 = activeMediaQueries.find((key) => key in values);
|
|
6505
|
-
return (0,
|
|
6738
|
+
return (0, import_type_guards11.isNotUndefined)(mq2) && (0, import_type_guards11.isNotUndefined)(values[mq2]) ? values[mq2] : values.base;
|
|
6506
6739
|
}
|
|
6507
6740
|
return values;
|
|
6508
6741
|
}, [activeMediaQueries, values]);
|
|
@@ -6529,13 +6762,13 @@ var Icon = ({
|
|
|
6529
6762
|
...otherProps
|
|
6530
6763
|
}) => {
|
|
6531
6764
|
const responsiveSize = useResponsiveProp(size);
|
|
6532
|
-
if ((0,
|
|
6765
|
+
if ((0, import_type_guards12.isNil)(type)) {
|
|
6533
6766
|
throw new Error("An Icon component requires a `type` prop to be provided");
|
|
6534
6767
|
}
|
|
6535
|
-
if ((0,
|
|
6768
|
+
if ((0, import_type_guards12.isNil)(iconMap[type])) {
|
|
6536
6769
|
throw new Error(`Type "${type}" does not exist, please update type prop in Icon component.`);
|
|
6537
6770
|
}
|
|
6538
|
-
if ((0,
|
|
6771
|
+
if ((0, import_type_guards12.isNil)(iconSizeMap[responsiveSize])) {
|
|
6539
6772
|
throw new Error(
|
|
6540
6773
|
`Size "${responsiveSize}" does not exist, please update size prop in Icon component.`
|
|
6541
6774
|
);
|
|
@@ -6566,13 +6799,13 @@ var Icon = ({
|
|
|
6566
6799
|
Icon.displayName = "Icon";
|
|
6567
6800
|
|
|
6568
6801
|
// src/components/Link/Link.tsx
|
|
6569
|
-
var
|
|
6570
|
-
var
|
|
6802
|
+
var import_react13 = require("react");
|
|
6803
|
+
var import_type_guards13 = require("@wistia/type-guards");
|
|
6571
6804
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
6572
6805
|
var import_react_router_dom = require("react-router-dom");
|
|
6573
6806
|
var import_jsx_runtime188 = require("react/jsx-runtime");
|
|
6574
6807
|
var generateHref = (href, type, disabled) => {
|
|
6575
|
-
if (disabled || (0,
|
|
6808
|
+
if (disabled || (0, import_type_guards13.isNil)(href)) {
|
|
6576
6809
|
return void 0;
|
|
6577
6810
|
}
|
|
6578
6811
|
let to = href;
|
|
@@ -6584,12 +6817,12 @@ var generateHref = (href, type, disabled) => {
|
|
|
6584
6817
|
}
|
|
6585
6818
|
return to;
|
|
6586
6819
|
};
|
|
6587
|
-
var isButton = (props) => (0,
|
|
6588
|
-
var isLink = (props) => (0,
|
|
6820
|
+
var isButton = (props) => (0, import_type_guards13.isUndefined)(props.href);
|
|
6821
|
+
var isLink = (props) => (0, import_type_guards13.isNotUndefined)(props.href);
|
|
6589
6822
|
var StyledLink = import_styled_components20.default.a`
|
|
6590
6823
|
--link-icon-size: 14px;
|
|
6591
6824
|
|
|
6592
|
-
${({ href }) => (0,
|
|
6825
|
+
${({ href }) => (0, import_type_guards13.isNil)(href) && buttonResetCss};
|
|
6593
6826
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
6594
6827
|
cursor: pointer;
|
|
6595
6828
|
font-family: var(--wui-typography-family-default);
|
|
@@ -6606,7 +6839,7 @@ var StyledLink = import_styled_components20.default.a`
|
|
|
6606
6839
|
}
|
|
6607
6840
|
}
|
|
6608
6841
|
`;
|
|
6609
|
-
var Link = (0,
|
|
6842
|
+
var Link = (0, import_react13.forwardRef)(
|
|
6610
6843
|
({
|
|
6611
6844
|
beforeAction,
|
|
6612
6845
|
children,
|
|
@@ -6630,16 +6863,16 @@ var Link = (0, import_react12.forwardRef)(
|
|
|
6630
6863
|
} catch (error) {
|
|
6631
6864
|
console.error(error);
|
|
6632
6865
|
} finally {
|
|
6633
|
-
if ((0,
|
|
6866
|
+
if ((0, import_type_guards13.isFunction)(props.onClick)) {
|
|
6634
6867
|
props.onClick(event);
|
|
6635
6868
|
} else if (routingCallback !== null) {
|
|
6636
6869
|
routingCallback();
|
|
6637
|
-
} else if ((0,
|
|
6870
|
+
} else if ((0, import_type_guards13.isNotNil)(to)) {
|
|
6638
6871
|
window.location.assign(to);
|
|
6639
6872
|
} else {
|
|
6640
6873
|
}
|
|
6641
6874
|
}
|
|
6642
|
-
} else if ((0,
|
|
6875
|
+
} else if ((0, import_type_guards13.isFunction)(props.onClick)) {
|
|
6643
6876
|
props.onClick(event);
|
|
6644
6877
|
} else {
|
|
6645
6878
|
}
|
|
@@ -6699,7 +6932,7 @@ Link.displayName = "Link";
|
|
|
6699
6932
|
|
|
6700
6933
|
// src/components/Button/Button.tsx
|
|
6701
6934
|
var import_jsx_runtime189 = require("react/jsx-runtime");
|
|
6702
|
-
var isLink2 = (props) => (0,
|
|
6935
|
+
var isLink2 = (props) => (0, import_type_guards14.isNotUndefined)(props.href);
|
|
6703
6936
|
var StyledButton = import_styled_components21.default.button`
|
|
6704
6937
|
${buttonResetCss}
|
|
6705
6938
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
@@ -6739,8 +6972,8 @@ var ButtonContent = ({
|
|
|
6739
6972
|
/* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(
|
|
6740
6973
|
StyledButtonContent,
|
|
6741
6974
|
{
|
|
6742
|
-
$hasLeftIcon: (0,
|
|
6743
|
-
$hasRightIcon: (0,
|
|
6975
|
+
$hasLeftIcon: (0, import_type_guards14.isNotNil)(leftIcon),
|
|
6976
|
+
$hasRightIcon: (0, import_type_guards14.isNotNil)(rightIcon),
|
|
6744
6977
|
$isLoading: isLoading,
|
|
6745
6978
|
children: [
|
|
6746
6979
|
leftIcon ?? null,
|
|
@@ -6751,7 +6984,7 @@ var ButtonContent = ({
|
|
|
6751
6984
|
)
|
|
6752
6985
|
] });
|
|
6753
6986
|
};
|
|
6754
|
-
var Button = (0,
|
|
6987
|
+
var Button = (0, import_react14.forwardRef)(
|
|
6755
6988
|
({
|
|
6756
6989
|
children,
|
|
6757
6990
|
forceState,
|
|
@@ -6808,7 +7041,7 @@ var Button = (0, import_react13.forwardRef)(
|
|
|
6808
7041
|
event.preventDefault();
|
|
6809
7042
|
return;
|
|
6810
7043
|
}
|
|
6811
|
-
if ((0,
|
|
7044
|
+
if ((0, import_type_guards14.isNotNil)(onClick)) {
|
|
6812
7045
|
onClick(event);
|
|
6813
7046
|
}
|
|
6814
7047
|
};
|
|
@@ -6930,7 +7163,7 @@ var StyledLabel = import_styled_components22.default.span`
|
|
|
6930
7163
|
grid-row: 2;
|
|
6931
7164
|
text-align: left;
|
|
6932
7165
|
`;
|
|
6933
|
-
var ActionButton = (0,
|
|
7166
|
+
var ActionButton = (0, import_react15.forwardRef)(
|
|
6934
7167
|
({
|
|
6935
7168
|
icon,
|
|
6936
7169
|
colorScheme = "default",
|
|
@@ -6974,8 +7207,8 @@ var ActionButton = (0, import_react14.forwardRef)(
|
|
|
6974
7207
|
ActionButton.displayName = "ActionButton";
|
|
6975
7208
|
|
|
6976
7209
|
// src/components/Avatar/Avatar.tsx
|
|
6977
|
-
var
|
|
6978
|
-
var
|
|
7210
|
+
var import_react16 = require("react");
|
|
7211
|
+
var import_type_guards16 = require("@wistia/type-guards");
|
|
6979
7212
|
var import_styled_components24 = __toESM(require("styled-components"));
|
|
6980
7213
|
|
|
6981
7214
|
// src/components/ColorSchemeWrapper/ColorSchemeWrapper.tsx
|
|
@@ -7018,13 +7251,13 @@ var ColorSchemeWrapper = ({
|
|
|
7018
7251
|
ColorSchemeWrapper.displayName = "ColorSchemeWrapper";
|
|
7019
7252
|
|
|
7020
7253
|
// src/components/Avatar/formatNameForDisplay.tsx
|
|
7021
|
-
var
|
|
7254
|
+
var import_type_guards15 = require("@wistia/type-guards");
|
|
7022
7255
|
var containsEmojiCharacter = (char) => {
|
|
7023
7256
|
const emojiRegex = /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu;
|
|
7024
7257
|
return emojiRegex.test(char);
|
|
7025
7258
|
};
|
|
7026
7259
|
var formatNameForDisplay = (name) => {
|
|
7027
|
-
if ((0,
|
|
7260
|
+
if ((0, import_type_guards15.isNil)(name) || !(0, import_type_guards15.isString)(name) || (0, import_type_guards15.isEmptyString)(name) || containsEmojiCharacter(name)) {
|
|
7028
7261
|
return "U";
|
|
7029
7262
|
}
|
|
7030
7263
|
const firstChar = name.trim().substring(0, 1);
|
|
@@ -7087,7 +7320,7 @@ var AvatarWrapper = import_styled_components24.default.div`
|
|
|
7087
7320
|
max-height: ${({ $maxHeight }) => $maxHeight}px;
|
|
7088
7321
|
`;
|
|
7089
7322
|
var chooseColorScheme = (name) => {
|
|
7090
|
-
if ((0,
|
|
7323
|
+
if ((0, import_type_guards16.isNil)(name) || name === "Anonymous") {
|
|
7091
7324
|
return "default";
|
|
7092
7325
|
}
|
|
7093
7326
|
const filteredColors = colorSchemeOptions.filter(
|
|
@@ -7106,8 +7339,8 @@ var Avatar = ({
|
|
|
7106
7339
|
onImageLoad,
|
|
7107
7340
|
...otherProps
|
|
7108
7341
|
}) => {
|
|
7109
|
-
const [imageLoadState, setImageLoadState] = (0,
|
|
7110
|
-
(0,
|
|
7342
|
+
const [imageLoadState, setImageLoadState] = (0, import_react16.useState)("loading");
|
|
7343
|
+
(0, import_react16.useEffect)(() => {
|
|
7111
7344
|
setImageLoadState("loading");
|
|
7112
7345
|
}, [imageUrl]);
|
|
7113
7346
|
const handleImageLoad = () => {
|
|
@@ -7119,8 +7352,8 @@ var Avatar = ({
|
|
|
7119
7352
|
onImageLoad?.({ state: "error", type: "initials" });
|
|
7120
7353
|
};
|
|
7121
7354
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
7122
|
-
const avatarColor = (0,
|
|
7123
|
-
const showInitials = (0,
|
|
7355
|
+
const avatarColor = (0, import_react16.useMemo)(() => chooseColorScheme(name), [name]);
|
|
7356
|
+
const showInitials = (0, import_type_guards16.isNil)(imageUrl) || imageLoadState === "error";
|
|
7124
7357
|
return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(
|
|
7125
7358
|
AvatarWrapper,
|
|
7126
7359
|
{
|
|
@@ -7149,9 +7382,9 @@ var Avatar = ({
|
|
|
7149
7382
|
Avatar.displayName = "Avatar";
|
|
7150
7383
|
|
|
7151
7384
|
// src/components/Badge/Badge.tsx
|
|
7152
|
-
var
|
|
7385
|
+
var import_react17 = require("react");
|
|
7153
7386
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
7154
|
-
var
|
|
7387
|
+
var import_type_guards17 = require("@wistia/type-guards");
|
|
7155
7388
|
var import_jsx_runtime193 = require("react/jsx-runtime");
|
|
7156
7389
|
var StyledBadge = import_styled_components25.default.div`
|
|
7157
7390
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -7173,9 +7406,9 @@ var StyledBadge = import_styled_components25.default.div`
|
|
|
7173
7406
|
width: 12px;
|
|
7174
7407
|
}
|
|
7175
7408
|
`;
|
|
7176
|
-
var Badge = (0,
|
|
7409
|
+
var Badge = (0, import_react17.forwardRef)(
|
|
7177
7410
|
({ colorScheme = "inherit", label, icon, ...otherProps }, ref) => {
|
|
7178
|
-
const hasIcon = (0,
|
|
7411
|
+
const hasIcon = (0, import_type_guards17.isNotNil)(icon);
|
|
7179
7412
|
return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
7180
7413
|
StyledBadge,
|
|
7181
7414
|
{
|
|
@@ -7194,9 +7427,9 @@ var Badge = (0, import_react16.forwardRef)(
|
|
|
7194
7427
|
Badge.displayName = "Badge";
|
|
7195
7428
|
|
|
7196
7429
|
// src/components/Box/Box.tsx
|
|
7197
|
-
var
|
|
7430
|
+
var import_react18 = require("react");
|
|
7198
7431
|
var import_styled_components26 = __toESM(require("styled-components"));
|
|
7199
|
-
var
|
|
7432
|
+
var import_type_guards18 = require("@wistia/type-guards");
|
|
7200
7433
|
|
|
7201
7434
|
// src/private/helpers/makePolymorphic/makePolymorphic.tsx
|
|
7202
7435
|
var makePolymorphic = (component) => {
|
|
@@ -7207,8 +7440,8 @@ var makePolymorphic = (component) => {
|
|
|
7207
7440
|
var import_jsx_runtime194 = require("react/jsx-runtime");
|
|
7208
7441
|
var isDev = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
|
|
7209
7442
|
var getGapStyle = (gap) => {
|
|
7210
|
-
if ((0,
|
|
7211
|
-
if ((0,
|
|
7443
|
+
if ((0, import_type_guards18.isNotNil)(gap)) {
|
|
7444
|
+
if ((0, import_type_guards18.isRecord)(gap)) {
|
|
7212
7445
|
return Object.entries(gap).map(([key, value]) => {
|
|
7213
7446
|
return `${key}-gap: var(--wui-${value})};`;
|
|
7214
7447
|
}).join("");
|
|
@@ -7251,8 +7484,8 @@ var StyledBoxComponent = import_styled_components26.default.div`
|
|
|
7251
7484
|
align-content: ${({ $alignContent }) => $alignContent};
|
|
7252
7485
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
7253
7486
|
align-self: ${({ $alignSelf }) => $alignSelf ?? null};
|
|
7254
|
-
display: ${({ $inline }) => (0,
|
|
7255
|
-
flex-basis: ${({ $basis }) => (0,
|
|
7487
|
+
display: ${({ $inline }) => (0, import_type_guards18.isNotNil)($inline) && $inline ? "inline-flex" : "flex"};
|
|
7488
|
+
flex-basis: ${({ $basis }) => (0, import_type_guards18.isNotNil)($basis) ? $basis : null};
|
|
7256
7489
|
flex-direction: ${({ $flexDirection }) => $flexDirection};
|
|
7257
7490
|
${({ $fillBox: fill }) => getFillStyle(fill)};
|
|
7258
7491
|
${({ $fillViewport }) => getFillViewportStyle($fillViewport)};
|
|
@@ -7260,23 +7493,23 @@ var StyledBoxComponent = import_styled_components26.default.div`
|
|
|
7260
7493
|
width: ${({ $width }) => $width ?? null};
|
|
7261
7494
|
|
|
7262
7495
|
/* Box children styles */
|
|
7263
|
-
flex-grow: ${({ $grow }) => (0,
|
|
7264
|
-
flex-shrink: ${({ $shrink }) => (0,
|
|
7496
|
+
flex-grow: ${({ $grow }) => (0, import_type_guards18.isNotNil)($grow) ? $grow : null};
|
|
7497
|
+
flex-shrink: ${({ $shrink }) => (0, import_type_guards18.isNotNil)($shrink) ? $shrink : null};
|
|
7265
7498
|
flex-wrap: ${({ $wrapItems }) => $wrapItems ? "wrap" : "nowrap"};
|
|
7266
7499
|
${({ $gap }) => getGapStyle($gap)};
|
|
7267
7500
|
justify-content: ${({ $justifyContent }) => $justifyContent};
|
|
7268
|
-
order: ${({ $order }) => (0,
|
|
7501
|
+
order: ${({ $order }) => (0, import_type_guards18.isNotNil)($order) ? $order : null};
|
|
7269
7502
|
`;
|
|
7270
7503
|
var wrapChildren = (children) => {
|
|
7271
|
-
if ((0,
|
|
7504
|
+
if ((0, import_type_guards18.isNotNil)(children)) {
|
|
7272
7505
|
if (typeof children === "object" && isDev) {
|
|
7273
|
-
return
|
|
7274
|
-
if ((0,
|
|
7506
|
+
return import_react18.Children.map(children, (child) => {
|
|
7507
|
+
if ((0, import_type_guards18.isNil)(child)) return null;
|
|
7275
7508
|
const elementParams = {};
|
|
7276
7509
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
7277
7510
|
elementParams.hasBoxParent = true;
|
|
7278
7511
|
}
|
|
7279
|
-
return (0,
|
|
7512
|
+
return (0, import_react18.cloneElement)(child, elementParams);
|
|
7280
7513
|
});
|
|
7281
7514
|
}
|
|
7282
7515
|
return children;
|
|
@@ -7284,7 +7517,7 @@ var wrapChildren = (children) => {
|
|
|
7284
7517
|
return null;
|
|
7285
7518
|
};
|
|
7286
7519
|
var DEFAULT_ELEMENT = "div";
|
|
7287
|
-
var BoxComponent = (0,
|
|
7520
|
+
var BoxComponent = (0, import_react18.forwardRef)(
|
|
7288
7521
|
({
|
|
7289
7522
|
alignContent = "stretch",
|
|
7290
7523
|
alignItems = "flex-start",
|
|
@@ -7308,21 +7541,21 @@ var BoxComponent = (0, import_react17.forwardRef)(
|
|
|
7308
7541
|
wrapItems = false,
|
|
7309
7542
|
...otherProps
|
|
7310
7543
|
}, ref) => {
|
|
7311
|
-
if ((0,
|
|
7312
|
-
if ((0,
|
|
7544
|
+
if ((0, import_type_guards18.isNotUndefined)(height)) {
|
|
7545
|
+
if ((0, import_type_guards18.isTruthy)(fill) || fill === "vertical") {
|
|
7313
7546
|
throw new Error('Cannot use height prop with fill="vertical" or fill={true}');
|
|
7314
7547
|
}
|
|
7315
|
-
if ((0,
|
|
7548
|
+
if ((0, import_type_guards18.isTruthy)(fillViewport) || fillViewport === "vertical") {
|
|
7316
7549
|
throw new Error(
|
|
7317
7550
|
'Cannot use height prop with fillViewport="vertical" or fillViewport={true}'
|
|
7318
7551
|
);
|
|
7319
7552
|
}
|
|
7320
7553
|
}
|
|
7321
|
-
if ((0,
|
|
7322
|
-
if ((0,
|
|
7554
|
+
if ((0, import_type_guards18.isNotUndefined)(width)) {
|
|
7555
|
+
if ((0, import_type_guards18.isTruthy)(fill) || fill === "horizontal") {
|
|
7323
7556
|
throw new Error('Cannot use width prop with fill="horizontal" or fill={true}');
|
|
7324
7557
|
}
|
|
7325
|
-
if ((0,
|
|
7558
|
+
if ((0, import_type_guards18.isTruthy)(fillViewport) || fillViewport === "horizontal") {
|
|
7326
7559
|
throw new Error(
|
|
7327
7560
|
'Cannot use width prop with fillViewport="horizontal" or fillViewport={true}'
|
|
7328
7561
|
);
|
|
@@ -7359,7 +7592,7 @@ BoxComponent.displayName = "Box";
|
|
|
7359
7592
|
var Box = makePolymorphic(BoxComponent);
|
|
7360
7593
|
|
|
7361
7594
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
7362
|
-
var
|
|
7595
|
+
var import_react19 = require("react");
|
|
7363
7596
|
var import_styled_components27 = __toESM(require("styled-components"));
|
|
7364
7597
|
var import_jsx_runtime195 = require("react/jsx-runtime");
|
|
7365
7598
|
var StyledBreadcrumbs = import_styled_components27.default.nav`
|
|
@@ -7375,7 +7608,7 @@ var StyledBreadcrumbs = import_styled_components27.default.nav`
|
|
|
7375
7608
|
var BUFFER_WIDTH = 10;
|
|
7376
7609
|
var Breadcrumbs = ({ children, ...props }) => {
|
|
7377
7610
|
const { isXsAndDown } = useMq();
|
|
7378
|
-
let crumbs =
|
|
7611
|
+
let crumbs = import_react19.Children.toArray(children);
|
|
7379
7612
|
if (isXsAndDown) {
|
|
7380
7613
|
crumbs = crumbs.slice(-1);
|
|
7381
7614
|
}
|
|
@@ -7442,7 +7675,7 @@ var Breadcrumb = ({ icon, href, children, ...props }) => {
|
|
|
7442
7675
|
|
|
7443
7676
|
// src/components/ButtonGroup/ButtonGroup.tsx
|
|
7444
7677
|
var import_styled_components29 = __toESM(require("styled-components"));
|
|
7445
|
-
var
|
|
7678
|
+
var import_type_guards19 = require("@wistia/type-guards");
|
|
7446
7679
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
7447
7680
|
var getAlignment = (align) => {
|
|
7448
7681
|
if (align === "center") {
|
|
@@ -7488,7 +7721,7 @@ var ButtonGroup = ({
|
|
|
7488
7721
|
collapseOnSmallScreens = true,
|
|
7489
7722
|
...otherProps
|
|
7490
7723
|
}) => {
|
|
7491
|
-
if ((0,
|
|
7724
|
+
if ((0, import_type_guards19.isNil)(children)) {
|
|
7492
7725
|
return null;
|
|
7493
7726
|
}
|
|
7494
7727
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(
|
|
@@ -7562,17 +7795,17 @@ var Card = ({
|
|
|
7562
7795
|
Card.displayName = "Card";
|
|
7563
7796
|
|
|
7564
7797
|
// src/components/Checkbox/Checkbox.tsx
|
|
7565
|
-
var
|
|
7798
|
+
var import_react20 = require("react");
|
|
7566
7799
|
var import_styled_components34 = __toESM(require("styled-components"));
|
|
7567
|
-
var
|
|
7800
|
+
var import_type_guards23 = require("@wistia/type-guards");
|
|
7568
7801
|
|
|
7569
7802
|
// src/private/components/FormControlLabel/FormControlLabel.tsx
|
|
7570
7803
|
var import_styled_components33 = __toESM(require("styled-components"));
|
|
7571
|
-
var
|
|
7804
|
+
var import_type_guards22 = require("@wistia/type-guards");
|
|
7572
7805
|
|
|
7573
7806
|
// src/private/components/FormControlLabel/FormControlLabelDescription.tsx
|
|
7574
7807
|
var import_styled_components31 = __toESM(require("styled-components"));
|
|
7575
|
-
var
|
|
7808
|
+
var import_type_guards20 = require("@wistia/type-guards");
|
|
7576
7809
|
var import_jsx_runtime199 = require("react/jsx-runtime");
|
|
7577
7810
|
var disabledStyle = import_styled_components31.css`
|
|
7578
7811
|
color: var(--wui-color-text-disabled);
|
|
@@ -7592,7 +7825,7 @@ var FormControlLabelDescription = ({
|
|
|
7592
7825
|
disabled = false,
|
|
7593
7826
|
...props
|
|
7594
7827
|
}) => {
|
|
7595
|
-
if ((0,
|
|
7828
|
+
if ((0, import_type_guards20.isNil)(children)) {
|
|
7596
7829
|
return null;
|
|
7597
7830
|
}
|
|
7598
7831
|
return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(
|
|
@@ -7608,7 +7841,7 @@ FormControlLabelDescription.displayName = "FormControlLabelDescription";
|
|
|
7608
7841
|
|
|
7609
7842
|
// src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
|
|
7610
7843
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
7611
|
-
var
|
|
7844
|
+
var import_type_guards21 = require("@wistia/type-guards");
|
|
7612
7845
|
var import_jsx_runtime200 = require("react/jsx-runtime");
|
|
7613
7846
|
var VisuallyHidden = import_styled_components32.default.div({ ...visuallyHiddenStyle });
|
|
7614
7847
|
var VisuallyHiddenButFocusable = import_styled_components32.default.div({
|
|
@@ -7620,7 +7853,7 @@ var ScreenReaderOnly = ({
|
|
|
7620
7853
|
focusable = false,
|
|
7621
7854
|
...otherProps
|
|
7622
7855
|
}) => {
|
|
7623
|
-
const accessibleText = (0,
|
|
7856
|
+
const accessibleText = (0, import_type_guards21.isNotNil)(text) ? text : children;
|
|
7624
7857
|
if (focusable) {
|
|
7625
7858
|
return /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(VisuallyHiddenButFocusable, { ...otherProps, children: accessibleText });
|
|
7626
7859
|
}
|
|
@@ -7660,7 +7893,7 @@ var FormControlLabel = ({
|
|
|
7660
7893
|
hideLabel = false,
|
|
7661
7894
|
...props
|
|
7662
7895
|
}) => {
|
|
7663
|
-
if ((0,
|
|
7896
|
+
if ((0, import_type_guards22.isNil)(label)) {
|
|
7664
7897
|
return null;
|
|
7665
7898
|
}
|
|
7666
7899
|
const labelContent = hideLabel ? /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(ScreenReaderOnly, { children: label }) : /* @__PURE__ */ (0, import_jsx_runtime201.jsxs)(StyledLabelWrapper, { children: [
|
|
@@ -7674,7 +7907,7 @@ var FormControlLabel = ({
|
|
|
7674
7907
|
htmlFor,
|
|
7675
7908
|
...props,
|
|
7676
7909
|
children: [
|
|
7677
|
-
(0,
|
|
7910
|
+
(0, import_type_guards22.isNotNil)(controlSlot) ? controlSlot : null,
|
|
7678
7911
|
labelContent
|
|
7679
7912
|
]
|
|
7680
7913
|
}
|
|
@@ -7782,7 +8015,7 @@ var StyledHiddenCheckboxInput = import_styled_components34.default.input`
|
|
|
7782
8015
|
display: block;
|
|
7783
8016
|
}
|
|
7784
8017
|
`;
|
|
7785
|
-
var Checkbox = (0,
|
|
8018
|
+
var Checkbox = (0, import_react20.forwardRef)(
|
|
7786
8019
|
({
|
|
7787
8020
|
checked,
|
|
7788
8021
|
disabled = false,
|
|
@@ -7797,8 +8030,8 @@ var Checkbox = (0, import_react19.forwardRef)(
|
|
|
7797
8030
|
hideLabel = false,
|
|
7798
8031
|
...props
|
|
7799
8032
|
}, ref) => {
|
|
7800
|
-
const generatedId = (0,
|
|
7801
|
-
const computedId = (0,
|
|
8033
|
+
const generatedId = (0, import_react20.useId)();
|
|
8034
|
+
const computedId = (0, import_type_guards23.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-${generatedId}`;
|
|
7802
8035
|
return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)(StyledCheckboxWrapper, { disabled, children: [
|
|
7803
8036
|
/* @__PURE__ */ (0, import_jsx_runtime202.jsx)(
|
|
7804
8037
|
StyledHiddenCheckboxInput,
|
|
@@ -7840,9 +8073,9 @@ var Checkbox = (0, import_react19.forwardRef)(
|
|
|
7840
8073
|
Checkbox.displayName = "Checkbox";
|
|
7841
8074
|
|
|
7842
8075
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
7843
|
-
var
|
|
8076
|
+
var import_react21 = require("react");
|
|
7844
8077
|
var ClickRegion = ({ children, targetRef }) => {
|
|
7845
|
-
(0,
|
|
8078
|
+
(0, import_react21.useEffect)(() => {
|
|
7846
8079
|
if (targetRef.current && targetRef.current.tagName === "A") {
|
|
7847
8080
|
targetRef.current.setAttribute("data-click-region-target-link", "");
|
|
7848
8081
|
} else if (targetRef.current && targetRef.current.tagName === "BUTTON") {
|
|
@@ -7850,7 +8083,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
7850
8083
|
} else {
|
|
7851
8084
|
}
|
|
7852
8085
|
}, [targetRef]);
|
|
7853
|
-
const handleClick = (0,
|
|
8086
|
+
const handleClick = (0, import_react21.useCallback)(
|
|
7854
8087
|
(event) => {
|
|
7855
8088
|
const node = targetRef.current;
|
|
7856
8089
|
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")) {
|
|
@@ -7867,7 +8100,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
7867
8100
|
},
|
|
7868
8101
|
[targetRef]
|
|
7869
8102
|
);
|
|
7870
|
-
return (0,
|
|
8103
|
+
return (0, import_react21.cloneElement)(import_react21.Children.only(children), {
|
|
7871
8104
|
"data-click-region": true,
|
|
7872
8105
|
onClick: handleClick
|
|
7873
8106
|
});
|
|
@@ -7876,7 +8109,7 @@ ClickRegion.displayName = "ClickRegion";
|
|
|
7876
8109
|
|
|
7877
8110
|
// src/components/Collapsible/Collapsible.tsx
|
|
7878
8111
|
var import_react_collapsible = require("@radix-ui/react-collapsible");
|
|
7879
|
-
var
|
|
8112
|
+
var import_type_guards24 = require("@wistia/type-guards");
|
|
7880
8113
|
var import_styled_components35 = __toESM(require("styled-components"));
|
|
7881
8114
|
var import_jsx_runtime203 = require("react/jsx-runtime");
|
|
7882
8115
|
var StyledRoot = (0, import_styled_components35.default)(import_react_collapsible.Root)`
|
|
@@ -7893,31 +8126,31 @@ var Collapsible = ({
|
|
|
7893
8126
|
onOpenChange
|
|
7894
8127
|
}) => {
|
|
7895
8128
|
const controlProps = {
|
|
7896
|
-
...(0,
|
|
8129
|
+
...(0, import_type_guards24.isNotNil)(onOpenChange) && (0, import_type_guards24.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
7897
8130
|
};
|
|
7898
8131
|
return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(StyledRoot, { ...controlProps, children });
|
|
7899
8132
|
};
|
|
7900
8133
|
Collapsible.displayName = "Collapsible";
|
|
7901
8134
|
|
|
7902
8135
|
// src/components/Collapsible/CollapsibleTrigger.tsx
|
|
7903
|
-
var
|
|
8136
|
+
var import_react22 = require("react");
|
|
7904
8137
|
var import_react_collapsible2 = require("@radix-ui/react-collapsible");
|
|
7905
8138
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
7906
8139
|
var CollapsibleTrigger = ({ children }) => {
|
|
7907
|
-
|
|
8140
|
+
import_react22.Children.only(children);
|
|
7908
8141
|
return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(import_react_collapsible2.Trigger, { asChild: true, children });
|
|
7909
8142
|
};
|
|
7910
8143
|
|
|
7911
8144
|
// src/components/Collapsible/CollapsibleContent.tsx
|
|
7912
8145
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
7913
8146
|
var import_react_collapsible3 = require("@radix-ui/react-collapsible");
|
|
7914
|
-
var
|
|
8147
|
+
var import_type_guards25 = require("@wistia/type-guards");
|
|
7915
8148
|
var import_jsx_runtime205 = require("react/jsx-runtime");
|
|
7916
8149
|
var ClampedContent = import_styled_components36.default.div.attrs({ "data-wui-collapsible-content": true })`
|
|
7917
8150
|
--wui-collapsible-content-clamp-lines: ${({ $clamp }) => $clamp};
|
|
7918
8151
|
`;
|
|
7919
8152
|
var CollapsibleContent = ({ clamp, children }) => {
|
|
7920
|
-
if ((0,
|
|
8153
|
+
if ((0, import_type_guards25.isNotUndefined)(clamp)) {
|
|
7921
8154
|
return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(ClampedContent, { $clamp: clamp, children });
|
|
7922
8155
|
}
|
|
7923
8156
|
return /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(import_react_collapsible3.Content, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(import_jsx_runtime205.Fragment, { children: [
|
|
@@ -7928,10 +8161,10 @@ var CollapsibleContent = ({ clamp, children }) => {
|
|
|
7928
8161
|
|
|
7929
8162
|
// src/components/DataCards/DataCard.tsx
|
|
7930
8163
|
var import_styled_components38 = __toESM(require("styled-components"));
|
|
7931
|
-
var
|
|
8164
|
+
var import_type_guards26 = require("@wistia/type-guards");
|
|
7932
8165
|
|
|
7933
8166
|
// src/components/Heading/Heading.tsx
|
|
7934
|
-
var
|
|
8167
|
+
var import_react23 = require("react");
|
|
7935
8168
|
var import_styled_components37 = __toESM(require("styled-components"));
|
|
7936
8169
|
var import_jsx_runtime206 = require("react/jsx-runtime");
|
|
7937
8170
|
var heroStyle = import_styled_components37.css`
|
|
@@ -8018,7 +8251,7 @@ var variantElementMap = {
|
|
|
8018
8251
|
heading5: "h5",
|
|
8019
8252
|
heading6: "h6"
|
|
8020
8253
|
};
|
|
8021
|
-
var HeadingComponent = (0,
|
|
8254
|
+
var HeadingComponent = (0, import_react23.forwardRef)(
|
|
8022
8255
|
({
|
|
8023
8256
|
align = "left",
|
|
8024
8257
|
colorScheme = "inherit",
|
|
@@ -8137,8 +8370,8 @@ var DataCard = ({
|
|
|
8137
8370
|
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(StyledLoadingValue, {}) : value
|
|
8138
8371
|
}
|
|
8139
8372
|
),
|
|
8140
|
-
(0,
|
|
8141
|
-
(0,
|
|
8373
|
+
(0, import_type_guards26.isNotNull)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(StyledSlot, { children: upperRightSlot }),
|
|
8374
|
+
(0, import_type_guards26.isNotNull)(trend) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(StyledDataCardTrendContainer, { children: trend })
|
|
8142
8375
|
]
|
|
8143
8376
|
}
|
|
8144
8377
|
);
|
|
@@ -8182,7 +8415,7 @@ DataCards.displayName = "DataCards";
|
|
|
8182
8415
|
var import_styled_components41 = __toESM(require("styled-components"));
|
|
8183
8416
|
|
|
8184
8417
|
// src/components/Text/Text.tsx
|
|
8185
|
-
var
|
|
8418
|
+
var import_react24 = require("react");
|
|
8186
8419
|
var import_styled_components40 = __toESM(require("styled-components"));
|
|
8187
8420
|
var import_jsx_runtime209 = require("react/jsx-runtime");
|
|
8188
8421
|
var bodyBoldStyles = import_styled_components40.css`
|
|
@@ -8348,7 +8581,7 @@ var StyledText = import_styled_components40.default.div`
|
|
|
8348
8581
|
}
|
|
8349
8582
|
`}
|
|
8350
8583
|
`;
|
|
8351
|
-
var TextComponent = (0,
|
|
8584
|
+
var TextComponent = (0, import_react24.forwardRef)(
|
|
8352
8585
|
({
|
|
8353
8586
|
align = "left",
|
|
8354
8587
|
colorScheme = "inherit",
|
|
@@ -8464,7 +8697,7 @@ Divider.displayName = "Divider";
|
|
|
8464
8697
|
|
|
8465
8698
|
// src/components/EditableHeading/EditableHeading.tsx
|
|
8466
8699
|
var import_styled_components45 = __toESM(require("styled-components"));
|
|
8467
|
-
var
|
|
8700
|
+
var import_react26 = require("react");
|
|
8468
8701
|
|
|
8469
8702
|
// src/components/Tooltip/Tooltip.tsx
|
|
8470
8703
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
@@ -8573,9 +8806,9 @@ var Tooltip = ({
|
|
|
8573
8806
|
Tooltip.displayName = "Tooltip";
|
|
8574
8807
|
|
|
8575
8808
|
// src/components/Input/Input.tsx
|
|
8576
|
-
var
|
|
8809
|
+
var import_react25 = require("react");
|
|
8577
8810
|
var import_styled_components44 = __toESM(require("styled-components"));
|
|
8578
|
-
var
|
|
8811
|
+
var import_type_guards27 = require("@wistia/type-guards");
|
|
8579
8812
|
var import_jsx_runtime213 = require("react/jsx-runtime");
|
|
8580
8813
|
var inputStyles = import_styled_components44.css`
|
|
8581
8814
|
--wui-input-color-bg: var(--wui-color-bg-surface);
|
|
@@ -8662,7 +8895,7 @@ var StyledInputContainer = import_styled_components44.default.div`
|
|
|
8662
8895
|
padding-right: 32px;
|
|
8663
8896
|
}
|
|
8664
8897
|
`;
|
|
8665
|
-
var Input = (0,
|
|
8898
|
+
var Input = (0, import_react25.forwardRef)(
|
|
8666
8899
|
({
|
|
8667
8900
|
fullWidth = true,
|
|
8668
8901
|
monospace = false,
|
|
@@ -8672,30 +8905,30 @@ var Input = (0, import_react24.forwardRef)(
|
|
|
8672
8905
|
rightIcon,
|
|
8673
8906
|
...props
|
|
8674
8907
|
}, externalRef) => {
|
|
8675
|
-
const internalRef = (0,
|
|
8908
|
+
const internalRef = (0, import_react25.useRef)();
|
|
8676
8909
|
const ref = (
|
|
8677
8910
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
8678
|
-
(0,
|
|
8911
|
+
(0, import_type_guards27.isNotNil)(externalRef) && (0, import_type_guards27.isRecord)(externalRef) && "current" in externalRef ? externalRef : internalRef
|
|
8679
8912
|
);
|
|
8680
8913
|
let leftIconToDisplay = leftIcon;
|
|
8681
|
-
if ((0,
|
|
8914
|
+
if ((0, import_type_guards27.isNil)(leftIcon) && type === "search") {
|
|
8682
8915
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(Icon, { type: "search" });
|
|
8683
8916
|
}
|
|
8684
|
-
if ((0,
|
|
8685
|
-
leftIconToDisplay = (0,
|
|
8917
|
+
if ((0, import_type_guards27.isNotNil)(leftIconToDisplay)) {
|
|
8918
|
+
leftIconToDisplay = (0, import_react25.cloneElement)(leftIconToDisplay, {
|
|
8686
8919
|
size: "md",
|
|
8687
8920
|
className: "wui-input-left-icon"
|
|
8688
8921
|
});
|
|
8689
8922
|
}
|
|
8690
8923
|
let rightIconToDisplay = rightIcon;
|
|
8691
|
-
if ((0,
|
|
8692
|
-
rightIconToDisplay = (0,
|
|
8924
|
+
if ((0, import_type_guards27.isNotNil)(rightIconToDisplay)) {
|
|
8925
|
+
rightIconToDisplay = (0, import_react25.cloneElement)(rightIconToDisplay, {
|
|
8693
8926
|
size: "md",
|
|
8694
8927
|
className: "wui-input-right-icon"
|
|
8695
8928
|
});
|
|
8696
8929
|
}
|
|
8697
|
-
const
|
|
8698
|
-
if ((0,
|
|
8930
|
+
const handleFocus2 = (event) => {
|
|
8931
|
+
if ((0, import_type_guards27.isNotNil)(props.onFocus)) {
|
|
8699
8932
|
props.onFocus(event);
|
|
8700
8933
|
}
|
|
8701
8934
|
if (autoSelect && isValidRef(ref) && "current" in ref) {
|
|
@@ -8716,14 +8949,14 @@ var Input = (0, import_react24.forwardRef)(
|
|
|
8716
8949
|
{
|
|
8717
8950
|
...props,
|
|
8718
8951
|
ref,
|
|
8719
|
-
onFocus:
|
|
8952
|
+
onFocus: handleFocus2
|
|
8720
8953
|
}
|
|
8721
8954
|
) : /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
|
|
8722
8955
|
"input",
|
|
8723
8956
|
{
|
|
8724
8957
|
...props,
|
|
8725
8958
|
ref,
|
|
8726
|
-
onFocus:
|
|
8959
|
+
onFocus: handleFocus2,
|
|
8727
8960
|
type
|
|
8728
8961
|
}
|
|
8729
8962
|
),
|
|
@@ -8784,11 +9017,11 @@ var EditableHeading = ({
|
|
|
8784
9017
|
forceEditing = false,
|
|
8785
9018
|
editingDisabled = false
|
|
8786
9019
|
}) => {
|
|
8787
|
-
const [isEditing, setIsEditing] = (0,
|
|
8788
|
-
const [value, setValue] = (0,
|
|
8789
|
-
const [previousValue, setPreviousValue] = (0,
|
|
8790
|
-
const [headingHeight, setHeadingHeight] = (0,
|
|
8791
|
-
const headingRef = (0,
|
|
9020
|
+
const [isEditing, setIsEditing] = (0, import_react26.useState)(false);
|
|
9021
|
+
const [value, setValue] = (0, import_react26.useState)(children);
|
|
9022
|
+
const [previousValue, setPreviousValue] = (0, import_react26.useState)(children);
|
|
9023
|
+
const [headingHeight, setHeadingHeight] = (0, import_react26.useState)("60");
|
|
9024
|
+
const headingRef = (0, import_react26.useRef)(null);
|
|
8792
9025
|
const handleSetEditing = (editing) => {
|
|
8793
9026
|
if (editingDisabled) return;
|
|
8794
9027
|
if (editing && headingRef.current) {
|
|
@@ -8874,12 +9107,12 @@ var EditableHeading = ({
|
|
|
8874
9107
|
};
|
|
8875
9108
|
|
|
8876
9109
|
// src/components/Form/Form.tsx
|
|
8877
|
-
var
|
|
9110
|
+
var import_react28 = require("react");
|
|
8878
9111
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
8879
|
-
var
|
|
9112
|
+
var import_type_guards28 = require("@wistia/type-guards");
|
|
8880
9113
|
|
|
8881
9114
|
// src/components/Stack/Stack.tsx
|
|
8882
|
-
var
|
|
9115
|
+
var import_react27 = require("react");
|
|
8883
9116
|
var import_styled_components46 = __toESM(require("styled-components"));
|
|
8884
9117
|
var import_jsx_runtime215 = require("react/jsx-runtime");
|
|
8885
9118
|
var DEFAULT_ELEMENT4 = "div";
|
|
@@ -8889,7 +9122,7 @@ var StyledStack = import_styled_components46.default.div`
|
|
|
8889
9122
|
gap: ${({ $gap }) => `var(--wui-${$gap})`};
|
|
8890
9123
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
8891
9124
|
`;
|
|
8892
|
-
var StackComponent = (0,
|
|
9125
|
+
var StackComponent = (0, import_react27.forwardRef)(
|
|
8893
9126
|
({ renderAs, direction = "vertical", gap = "space-02", alignItems = "stretch", ...props }, ref) => {
|
|
8894
9127
|
const responsiveGap = useResponsiveProp(gap);
|
|
8895
9128
|
const responsiveDirection = useResponsiveProp(direction);
|
|
@@ -8918,7 +9151,7 @@ var StyledForm = import_styled_components47.default.form`
|
|
|
8918
9151
|
max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
|
|
8919
9152
|
align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
|
|
8920
9153
|
`;
|
|
8921
|
-
var FormContext = (0,
|
|
9154
|
+
var FormContext = (0, import_react28.createContext)({
|
|
8922
9155
|
values: {},
|
|
8923
9156
|
errors: {},
|
|
8924
9157
|
hasSubmitted: false,
|
|
@@ -8934,25 +9167,25 @@ var FormComponent = ({
|
|
|
8934
9167
|
fullWidth = false,
|
|
8935
9168
|
...props
|
|
8936
9169
|
}, forwardedRef) => {
|
|
8937
|
-
const [errors, setErrors] = (0,
|
|
8938
|
-
const [hasSubmitted, setHasSubmitted] = (0,
|
|
8939
|
-
const innerRef = (0,
|
|
9170
|
+
const [errors, setErrors] = (0, import_react28.useState)({});
|
|
9171
|
+
const [hasSubmitted, setHasSubmitted] = (0, import_react28.useState)(false);
|
|
9172
|
+
const innerRef = (0, import_react28.useRef)();
|
|
8940
9173
|
const ref = forwardedRef ?? innerRef;
|
|
8941
|
-
const autoId = (0,
|
|
9174
|
+
const autoId = (0, import_react28.useId)();
|
|
8942
9175
|
const id = props.id ?? autoId;
|
|
8943
9176
|
const handleValidate = (nextFormData) => {
|
|
8944
9177
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
8945
|
-
if ((0,
|
|
9178
|
+
if ((0, import_type_guards28.isUndefined)(validate)) {
|
|
8946
9179
|
return {};
|
|
8947
9180
|
}
|
|
8948
9181
|
return validate(nextData);
|
|
8949
9182
|
};
|
|
8950
|
-
const
|
|
9183
|
+
const handleBlur2 = (event) => {
|
|
8951
9184
|
if (props.onBlur) {
|
|
8952
9185
|
props.onBlur(event);
|
|
8953
9186
|
}
|
|
8954
9187
|
const formData = new FormData(event.currentTarget);
|
|
8955
|
-
if ((0,
|
|
9188
|
+
if ((0, import_type_guards28.isNotUndefined)(validate)) {
|
|
8956
9189
|
handleValidate(formData);
|
|
8957
9190
|
}
|
|
8958
9191
|
};
|
|
@@ -8980,7 +9213,7 @@ var FormComponent = ({
|
|
|
8980
9213
|
void action(null);
|
|
8981
9214
|
}
|
|
8982
9215
|
};
|
|
8983
|
-
const context = (0,
|
|
9216
|
+
const context = (0, import_react28.useMemo)(() => {
|
|
8984
9217
|
return {
|
|
8985
9218
|
values,
|
|
8986
9219
|
errors,
|
|
@@ -9000,7 +9233,7 @@ var FormComponent = ({
|
|
|
9000
9233
|
as: StyledForm,
|
|
9001
9234
|
gap: "space-05",
|
|
9002
9235
|
id,
|
|
9003
|
-
onBlur:
|
|
9236
|
+
onBlur: handleBlur2,
|
|
9004
9237
|
onReset: handleReset,
|
|
9005
9238
|
onSubmit: handleSubmit,
|
|
9006
9239
|
children
|
|
@@ -9009,15 +9242,15 @@ var FormComponent = ({
|
|
|
9009
9242
|
);
|
|
9010
9243
|
};
|
|
9011
9244
|
FormComponent.displayName = "Form";
|
|
9012
|
-
var Form = (0,
|
|
9245
|
+
var Form = (0, import_react28.forwardRef)(FormComponent);
|
|
9013
9246
|
|
|
9014
9247
|
// src/components/Form/useFormState.tsx
|
|
9015
|
-
var
|
|
9248
|
+
var import_react29 = require("react");
|
|
9016
9249
|
var useFormState = (action, initialData = {}) => {
|
|
9017
|
-
const [data, setData] = (0,
|
|
9018
|
-
const [isPending, setIsPending] = (0,
|
|
9019
|
-
const [error, setError] = (0,
|
|
9020
|
-
const formAction = (0,
|
|
9250
|
+
const [data, setData] = (0, import_react29.useState)(initialData);
|
|
9251
|
+
const [isPending, setIsPending] = (0, import_react29.useState)(false);
|
|
9252
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
9253
|
+
const formAction = (0, import_react29.useCallback)(
|
|
9021
9254
|
async (nextFormData) => {
|
|
9022
9255
|
if (nextFormData === null) {
|
|
9023
9256
|
setData(initialData);
|
|
@@ -9048,23 +9281,23 @@ var useFormState = (action, initialData = {}) => {
|
|
|
9048
9281
|
};
|
|
9049
9282
|
|
|
9050
9283
|
// src/components/Form/FormErrorSummary.tsx
|
|
9051
|
-
var
|
|
9052
|
-
var
|
|
9284
|
+
var import_react30 = require("react");
|
|
9285
|
+
var import_type_guards29 = require("@wistia/type-guards");
|
|
9053
9286
|
var import_jsx_runtime217 = require("react/jsx-runtime");
|
|
9054
9287
|
var ErrorItem = ({ name, error, formId }) => {
|
|
9055
9288
|
return /* @__PURE__ */ (0, import_jsx_runtime217.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(Link, { href: `#${formId}-${name}`, children: error }) }, name);
|
|
9056
9289
|
};
|
|
9057
9290
|
var FormErrorSummary = ({ description }) => {
|
|
9058
|
-
const ref = (0,
|
|
9059
|
-
const { formId, errors, hasSubmitted } = (0,
|
|
9291
|
+
const ref = (0, import_react30.useRef)(null);
|
|
9292
|
+
const { formId, errors, hasSubmitted } = (0, import_react30.useContext)(FormContext);
|
|
9060
9293
|
const isValid = Object.keys(errors).length === 0;
|
|
9061
9294
|
if (isValid || !hasSubmitted) {
|
|
9062
9295
|
return null;
|
|
9063
9296
|
}
|
|
9064
9297
|
return /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)("div", { ref, children: [
|
|
9065
9298
|
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)("p", { children: description }),
|
|
9066
|
-
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0,
|
|
9067
|
-
([name, error]) => (0,
|
|
9299
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)("ul", { children: Object.entries(errors).filter(([, error]) => (0, import_type_guards29.isNotUndefined)(error)).map(
|
|
9300
|
+
([name, error]) => (0, import_type_guards29.isArray)(error) ? error.map((err) => /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
|
|
9068
9301
|
ErrorItem,
|
|
9069
9302
|
{
|
|
9070
9303
|
error: err,
|
|
@@ -9086,9 +9319,9 @@ var FormErrorSummary = ({ description }) => {
|
|
|
9086
9319
|
};
|
|
9087
9320
|
|
|
9088
9321
|
// src/components/FormField/FormField.tsx
|
|
9089
|
-
var
|
|
9322
|
+
var import_react33 = require("react");
|
|
9090
9323
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
9091
|
-
var
|
|
9324
|
+
var import_type_guards30 = require("@wistia/type-guards");
|
|
9092
9325
|
|
|
9093
9326
|
// src/components/Label/Label.tsx
|
|
9094
9327
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
@@ -9151,11 +9384,11 @@ var Label = ({
|
|
|
9151
9384
|
Label.displayName = "Label";
|
|
9152
9385
|
|
|
9153
9386
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9154
|
-
var
|
|
9387
|
+
var import_react32 = require("react");
|
|
9155
9388
|
|
|
9156
9389
|
// src/components/FormGroup/FormGroup.tsx
|
|
9157
9390
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
9158
|
-
var
|
|
9391
|
+
var import_react31 = require("react");
|
|
9159
9392
|
var import_jsx_runtime219 = require("react/jsx-runtime");
|
|
9160
9393
|
var StyledFieldset = import_styled_components49.default.fieldset`
|
|
9161
9394
|
border: 0;
|
|
@@ -9164,7 +9397,7 @@ var StyledLegend = import_styled_components49.default.legend`
|
|
|
9164
9397
|
margin-bottom: var(--space-01);
|
|
9165
9398
|
`;
|
|
9166
9399
|
var FormGroup = ({ children, label, ...props }) => {
|
|
9167
|
-
const ref = (0,
|
|
9400
|
+
const ref = (0, import_react31.useRef)();
|
|
9168
9401
|
return /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(
|
|
9169
9402
|
Stack,
|
|
9170
9403
|
{
|
|
@@ -9189,7 +9422,7 @@ FormGroup.displayName = "FormGroup";
|
|
|
9189
9422
|
|
|
9190
9423
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9191
9424
|
var import_jsx_runtime220 = require("react/jsx-runtime");
|
|
9192
|
-
var CheckboxGroupContext = (0,
|
|
9425
|
+
var CheckboxGroupContext = (0, import_react32.createContext)(null);
|
|
9193
9426
|
var CheckboxGroup = ({
|
|
9194
9427
|
children,
|
|
9195
9428
|
name,
|
|
@@ -9197,7 +9430,7 @@ var CheckboxGroup = ({
|
|
|
9197
9430
|
value,
|
|
9198
9431
|
...props
|
|
9199
9432
|
}) => {
|
|
9200
|
-
const context = (0,
|
|
9433
|
+
const context = (0, import_react32.useMemo)(() => {
|
|
9201
9434
|
return {
|
|
9202
9435
|
name,
|
|
9203
9436
|
onChange
|
|
@@ -9221,6 +9454,12 @@ var StyledFormField = import_styled_components50.default.div`
|
|
|
9221
9454
|
grid-template-columns: auto 1fr;
|
|
9222
9455
|
grid-template-rows: auto 1fr;
|
|
9223
9456
|
|
|
9457
|
+
&[data-label-position='inline-compact'] {
|
|
9458
|
+
gap: var(--form-field-spacing-inline);
|
|
9459
|
+
grid-template-columns: auto 1fr;
|
|
9460
|
+
grid-template-rows: 1fr auto;
|
|
9461
|
+
}
|
|
9462
|
+
|
|
9224
9463
|
&[data-label-position='inline'] {
|
|
9225
9464
|
gap: var(--form-field-spacing-inline);
|
|
9226
9465
|
grid-template-columns: minmax(auto, 1fr) 1fr;
|
|
@@ -9242,7 +9481,7 @@ var StyledErrorList = import_styled_components50.default.ul`
|
|
|
9242
9481
|
gap: var(--wui-space-01);
|
|
9243
9482
|
`;
|
|
9244
9483
|
var ErrorMessages = ({ errors, id }) => {
|
|
9245
|
-
const isMultipleErrors = (0,
|
|
9484
|
+
const isMultipleErrors = (0, import_type_guards30.isArray)(errors);
|
|
9246
9485
|
return isMultipleErrors ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(StyledErrorList, { children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
|
|
9247
9486
|
Text,
|
|
9248
9487
|
{
|
|
@@ -9275,8 +9514,8 @@ var FormField = ({
|
|
|
9275
9514
|
id,
|
|
9276
9515
|
...props
|
|
9277
9516
|
}) => {
|
|
9278
|
-
const formState = (0,
|
|
9279
|
-
const checkboxGroup = (0,
|
|
9517
|
+
const formState = (0, import_react33.useContext)(FormContext);
|
|
9518
|
+
const checkboxGroup = (0, import_react33.useContext)(CheckboxGroupContext);
|
|
9280
9519
|
const isIntegratedLabel = children.type === Checkbox;
|
|
9281
9520
|
const computedId = id ?? `${formState.formId}-${name}`;
|
|
9282
9521
|
const computedError = error ?? formState.errors[name];
|
|
@@ -9287,19 +9526,19 @@ var FormField = ({
|
|
|
9287
9526
|
label: isIntegratedLabel ? label : void 0,
|
|
9288
9527
|
...props
|
|
9289
9528
|
};
|
|
9290
|
-
if ((0,
|
|
9529
|
+
if ((0, import_type_guards30.isUndefined)(value) && (0, import_type_guards30.isNotUndefined)(defaultValue)) {
|
|
9291
9530
|
childProps = {
|
|
9292
9531
|
...childProps,
|
|
9293
9532
|
defaultValue
|
|
9294
9533
|
};
|
|
9295
9534
|
}
|
|
9296
|
-
if ((0,
|
|
9297
|
-
const computedName = (0,
|
|
9535
|
+
if ((0, import_type_guards30.isNotNil)(checkboxGroup)) {
|
|
9536
|
+
const computedName = (0, import_type_guards30.isNotNil)(checkboxGroup.name) ? `${checkboxGroup.name}[${name}]` : name;
|
|
9298
9537
|
const handleChange = (event) => {
|
|
9299
|
-
if ((0,
|
|
9538
|
+
if ((0, import_type_guards30.isNotUndefined)(props.onChange)) {
|
|
9300
9539
|
props.onChange(event);
|
|
9301
9540
|
}
|
|
9302
|
-
if ((0,
|
|
9541
|
+
if ((0, import_type_guards30.isNotUndefined)(checkboxGroup.onChange)) {
|
|
9303
9542
|
checkboxGroup.onChange(event);
|
|
9304
9543
|
}
|
|
9305
9544
|
};
|
|
@@ -9307,11 +9546,11 @@ var FormField = ({
|
|
|
9307
9546
|
...childProps,
|
|
9308
9547
|
name: computedName,
|
|
9309
9548
|
onChange: handleChange,
|
|
9310
|
-
"aria-invalid": (0,
|
|
9311
|
-
"aria-describedby": (0,
|
|
9549
|
+
"aria-invalid": (0, import_type_guards30.isNotNil)(error),
|
|
9550
|
+
"aria-describedby": (0, import_type_guards30.isNotNil)(error) ? `${computedId}-error` : void 0
|
|
9312
9551
|
};
|
|
9313
9552
|
}
|
|
9314
|
-
|
|
9553
|
+
import_react33.Children.only(children);
|
|
9315
9554
|
return /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(
|
|
9316
9555
|
StyledFormField,
|
|
9317
9556
|
{
|
|
@@ -9319,8 +9558,8 @@ var FormField = ({
|
|
|
9319
9558
|
"data-label-position": labelPosition ?? formState.labelPosition,
|
|
9320
9559
|
children: [
|
|
9321
9560
|
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(Label, { htmlFor: computedId, children: label }),
|
|
9322
|
-
(0,
|
|
9323
|
-
(0,
|
|
9561
|
+
(0, import_react33.cloneElement)(children, childProps),
|
|
9562
|
+
(0, import_type_guards30.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(import_jsx_runtime221.Fragment, { children: [
|
|
9324
9563
|
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)("div", {}),
|
|
9325
9564
|
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
|
|
9326
9565
|
ErrorMessages,
|
|
@@ -9337,9 +9576,9 @@ var FormField = ({
|
|
|
9337
9576
|
FormField.displayName = "FormField";
|
|
9338
9577
|
|
|
9339
9578
|
// src/components/FormGroup/RadioGroup.tsx
|
|
9340
|
-
var
|
|
9579
|
+
var import_react34 = require("react");
|
|
9341
9580
|
var import_jsx_runtime222 = require("react/jsx-runtime");
|
|
9342
|
-
var RadioGroupContext = (0,
|
|
9581
|
+
var RadioGroupContext = (0, import_react34.createContext)(null);
|
|
9343
9582
|
var RadioGroup = ({
|
|
9344
9583
|
children,
|
|
9345
9584
|
name,
|
|
@@ -9347,7 +9586,7 @@ var RadioGroup = ({
|
|
|
9347
9586
|
value,
|
|
9348
9587
|
...props
|
|
9349
9588
|
}) => {
|
|
9350
|
-
const context = (0,
|
|
9589
|
+
const context = (0, import_react34.useMemo)(() => {
|
|
9351
9590
|
return {
|
|
9352
9591
|
name,
|
|
9353
9592
|
onChange
|
|
@@ -9358,7 +9597,7 @@ var RadioGroup = ({
|
|
|
9358
9597
|
RadioGroup.displayName = "RadioGroup";
|
|
9359
9598
|
|
|
9360
9599
|
// src/components/IconButton/IconButton.tsx
|
|
9361
|
-
var
|
|
9600
|
+
var import_react35 = require("react");
|
|
9362
9601
|
var import_styled_components51 = __toESM(require("styled-components"));
|
|
9363
9602
|
var import_jsx_runtime223 = require("react/jsx-runtime");
|
|
9364
9603
|
var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
@@ -9375,7 +9614,7 @@ var StyledButton2 = (0, import_styled_components51.default)(Button)`
|
|
|
9375
9614
|
align-items: center;
|
|
9376
9615
|
line-height: 1;
|
|
9377
9616
|
`;
|
|
9378
|
-
var IconButton = (0,
|
|
9617
|
+
var IconButton = (0, import_react35.forwardRef)(
|
|
9379
9618
|
({ children, label, size = "md", ...props }, ref) => {
|
|
9380
9619
|
const responsiveSize = useResponsiveProp(size);
|
|
9381
9620
|
return /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(
|
|
@@ -9386,7 +9625,7 @@ var IconButton = (0, import_react34.forwardRef)(
|
|
|
9386
9625
|
"aria-label": label,
|
|
9387
9626
|
"data-wistia-ui-icon-button": true,
|
|
9388
9627
|
size: responsiveSize,
|
|
9389
|
-
children: (0,
|
|
9628
|
+
children: (0, import_react35.cloneElement)(import_react35.Children.only(children), {
|
|
9390
9629
|
size: responsiveSize
|
|
9391
9630
|
})
|
|
9392
9631
|
}
|
|
@@ -9397,7 +9636,7 @@ IconButton.displayName = "IconButton";
|
|
|
9397
9636
|
|
|
9398
9637
|
// src/components/Image/Image.tsx
|
|
9399
9638
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
9400
|
-
var
|
|
9639
|
+
var import_type_guards31 = require("@wistia/type-guards");
|
|
9401
9640
|
var import_jsx_runtime224 = require("react/jsx-runtime");
|
|
9402
9641
|
var getFillStyle2 = (fillContainer) => {
|
|
9403
9642
|
if (fillContainer === "horizontal") {
|
|
@@ -9415,7 +9654,7 @@ var getFillStyle2 = (fillContainer) => {
|
|
|
9415
9654
|
return void 0;
|
|
9416
9655
|
};
|
|
9417
9656
|
var StyledImage = import_styled_components52.default.img`
|
|
9418
|
-
border-radius: ${({ $borderRadius }) => (0,
|
|
9657
|
+
border-radius: ${({ $borderRadius }) => (0, import_type_guards31.isNotNil)($borderRadius) ? `var(--wui-${$borderRadius})` : void 0};
|
|
9419
9658
|
${({ $fillContainer }) => getFillStyle2($fillContainer)};
|
|
9420
9659
|
object-fit: ${({ $objFit }) => $objFit};
|
|
9421
9660
|
object-position: ${({ $objPosition }) => $objPosition};
|
|
@@ -9447,13 +9686,13 @@ Image.displayName = "Image";
|
|
|
9447
9686
|
// src/components/Menu/Menu.tsx
|
|
9448
9687
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
9449
9688
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
9450
|
-
var
|
|
9451
|
-
var
|
|
9689
|
+
var import_type_guards32 = require("@wistia/type-guards");
|
|
9690
|
+
var import_react37 = require("react");
|
|
9452
9691
|
|
|
9453
9692
|
// src/components/Menu/MenuContext.tsx
|
|
9454
|
-
var
|
|
9455
|
-
var MenuContext = (0,
|
|
9456
|
-
var useMenuContext = () => (0,
|
|
9693
|
+
var import_react36 = require("react");
|
|
9694
|
+
var MenuContext = (0, import_react36.createContext)({ compact: false });
|
|
9695
|
+
var useMenuContext = () => (0, import_react36.useContext)(MenuContext);
|
|
9457
9696
|
|
|
9458
9697
|
// src/components/Menu/Menu.tsx
|
|
9459
9698
|
var import_jsx_runtime225 = require("react/jsx-runtime");
|
|
@@ -9557,9 +9796,9 @@ var Menu = ({
|
|
|
9557
9796
|
onInteractOutside,
|
|
9558
9797
|
...props
|
|
9559
9798
|
}) => {
|
|
9560
|
-
const contextValue = (0,
|
|
9799
|
+
const contextValue = (0, import_react37.useMemo)(() => ({ compact }), [compact]);
|
|
9561
9800
|
let controlProps = {
|
|
9562
|
-
...(0,
|
|
9801
|
+
...(0, import_type_guards32.isNotNil)(onOpenChange) && (0, import_type_guards32.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
9563
9802
|
};
|
|
9564
9803
|
if (disabled) {
|
|
9565
9804
|
controlProps = {
|
|
@@ -9573,7 +9812,7 @@ var Menu = ({
|
|
|
9573
9812
|
modal: false,
|
|
9574
9813
|
...controlProps,
|
|
9575
9814
|
children: [
|
|
9576
|
-
/* @__PURE__ */ (0, import_jsx_runtime225.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0,
|
|
9815
|
+
/* @__PURE__ */ (0, import_jsx_runtime225.jsx)(import_react_dropdown_menu.DropdownMenuTrigger, { asChild: true, children: (0, import_type_guards32.isNotUndefined)(trigger) ? trigger : /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
9577
9816
|
Button,
|
|
9578
9817
|
{
|
|
9579
9818
|
"aria-expanded": isOpen,
|
|
@@ -9631,15 +9870,15 @@ var MenuLabel = ({ children, ...props }) => {
|
|
|
9631
9870
|
MenuLabel.displayName = "MenuLabel";
|
|
9632
9871
|
|
|
9633
9872
|
// src/components/Menu/SubMenu.tsx
|
|
9634
|
-
var
|
|
9873
|
+
var import_react39 = require("react");
|
|
9635
9874
|
var import_styled_components57 = __toESM(require("styled-components"));
|
|
9636
9875
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
9637
|
-
var
|
|
9876
|
+
var import_type_guards34 = require("@wistia/type-guards");
|
|
9638
9877
|
|
|
9639
9878
|
// src/components/Menu/MenuItemButton.tsx
|
|
9640
|
-
var
|
|
9879
|
+
var import_react38 = require("react");
|
|
9641
9880
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
9642
|
-
var
|
|
9881
|
+
var import_type_guards33 = require("@wistia/type-guards");
|
|
9643
9882
|
var import_jsx_runtime227 = require("react/jsx-runtime");
|
|
9644
9883
|
var StyledButton3 = (0, import_styled_components55.default)(Button)`
|
|
9645
9884
|
${({ colorScheme }) => getColorScheme(colorScheme)};
|
|
@@ -9714,10 +9953,10 @@ var StyledBadgeContainer = import_styled_components55.default.div`
|
|
|
9714
9953
|
font-size: var(--wui-typography-label-4-size);
|
|
9715
9954
|
color: var(--wui-color-text-secondary);
|
|
9716
9955
|
`;
|
|
9717
|
-
var MenuItemButton = (0,
|
|
9956
|
+
var MenuItemButton = (0, import_react38.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
9718
9957
|
let { colorScheme, badge } = props;
|
|
9719
9958
|
if (appearance === "dangerous") {
|
|
9720
|
-
if ((0,
|
|
9959
|
+
if ((0, import_type_guards33.isNotUndefined)(colorScheme)) {
|
|
9721
9960
|
console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
9722
9961
|
}
|
|
9723
9962
|
colorScheme = "error";
|
|
@@ -9747,7 +9986,7 @@ var MenuItemButton = (0, import_react37.forwardRef)(({ children, appearance, com
|
|
|
9747
9986
|
children: [
|
|
9748
9987
|
props.leftIcon ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
9749
9988
|
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(StyledLabelAndDescriptionContainer, { children }),
|
|
9750
|
-
(0,
|
|
9989
|
+
(0, import_type_guards33.isNotNil)(badge) || (0, import_type_guards33.isNotNil)(command) ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(StyledBadgeContainer, { children: badge ?? command }) : null,
|
|
9751
9990
|
props.rightIcon ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
9752
9991
|
]
|
|
9753
9992
|
}
|
|
@@ -9810,12 +10049,12 @@ var SubMenu = ({
|
|
|
9810
10049
|
...props
|
|
9811
10050
|
}) => {
|
|
9812
10051
|
const { isSmAndUp } = useMq();
|
|
9813
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
10052
|
+
const [isExpanded, setIsExpanded] = (0, import_react39.useState)(false);
|
|
9814
10053
|
const { compact } = useMenuContext();
|
|
9815
10054
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime229.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
9816
10055
|
/* @__PURE__ */ (0, import_jsx_runtime229.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
9817
10056
|
/* @__PURE__ */ (0, import_jsx_runtime229.jsx)(MenuItemLabel, { children: label }),
|
|
9818
|
-
(0,
|
|
10057
|
+
(0, import_type_guards34.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(MenuItemDescription, { children: description }) : null
|
|
9819
10058
|
] }),
|
|
9820
10059
|
/* @__PURE__ */ (0, import_jsx_runtime229.jsx)(import_react_dropdown_menu3.DropdownMenuPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(SubMenuContent, { $compact: compact, children }) })
|
|
9821
10060
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime229.jsxs)(import_react_dropdown_menu3.DropdownMenuGroup, { children: [
|
|
@@ -9839,10 +10078,10 @@ var SubMenu = ({
|
|
|
9839
10078
|
SubMenu.displayName = "SubMenu";
|
|
9840
10079
|
|
|
9841
10080
|
// src/components/Menu/MenuItem.tsx
|
|
9842
|
-
var
|
|
10081
|
+
var import_react40 = require("react");
|
|
9843
10082
|
var import_react_dropdown_menu4 = require("@radix-ui/react-dropdown-menu");
|
|
9844
10083
|
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
9845
|
-
var MenuItem = (0,
|
|
10084
|
+
var MenuItem = (0, import_react40.forwardRef)(
|
|
9846
10085
|
({ onSelect = () => null, ...props }, ref) => {
|
|
9847
10086
|
return /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
9848
10087
|
import_react_dropdown_menu4.DropdownMenuItem,
|
|
@@ -9992,10 +10231,10 @@ var CheckboxMenuItem = ({
|
|
|
9992
10231
|
CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
9993
10232
|
|
|
9994
10233
|
// src/components/Modal/Modal.tsx
|
|
9995
|
-
var
|
|
10234
|
+
var import_react44 = require("react");
|
|
9996
10235
|
var import_styled_components62 = __toESM(require("styled-components"));
|
|
9997
10236
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
9998
|
-
var
|
|
10237
|
+
var import_type_guards36 = require("@wistia/type-guards");
|
|
9999
10238
|
|
|
10000
10239
|
// src/components/Modal/ModalHeader.tsx
|
|
10001
10240
|
var import_styled_components59 = __toESM(require("styled-components"));
|
|
@@ -10052,21 +10291,21 @@ var ModalHeader = ({
|
|
|
10052
10291
|
};
|
|
10053
10292
|
|
|
10054
10293
|
// src/components/Modal/ModalContent.tsx
|
|
10055
|
-
var
|
|
10294
|
+
var import_react42 = require("react");
|
|
10056
10295
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
10057
10296
|
var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
10058
10297
|
|
|
10059
10298
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
10060
|
-
var
|
|
10061
|
-
var
|
|
10299
|
+
var import_react41 = require("react");
|
|
10300
|
+
var import_type_guards35 = require("@wistia/type-guards");
|
|
10062
10301
|
var useFocusRestore = () => {
|
|
10063
|
-
const previouslyFocusedRef = (0,
|
|
10064
|
-
(0,
|
|
10302
|
+
const previouslyFocusedRef = (0, import_react41.useRef)(null);
|
|
10303
|
+
(0, import_react41.useEffect)(() => {
|
|
10065
10304
|
previouslyFocusedRef.current = document.activeElement;
|
|
10066
10305
|
}, []);
|
|
10067
|
-
(0,
|
|
10306
|
+
(0, import_react41.useEffect)(() => {
|
|
10068
10307
|
return () => {
|
|
10069
|
-
if ((0,
|
|
10308
|
+
if ((0, import_type_guards35.isNotNil)(previouslyFocusedRef.current)) {
|
|
10070
10309
|
setTimeout(() => {
|
|
10071
10310
|
previouslyFocusedRef.current?.focus();
|
|
10072
10311
|
}, 0);
|
|
@@ -10118,7 +10357,7 @@ var StyledModalContent = (0, import_styled_components60.default)(import_react_di
|
|
|
10118
10357
|
}
|
|
10119
10358
|
}
|
|
10120
10359
|
`;
|
|
10121
|
-
var ModalContent = (0,
|
|
10360
|
+
var ModalContent = (0, import_react42.forwardRef)(
|
|
10122
10361
|
({ fullHeight, width, children, ...otherProps }, ref) => {
|
|
10123
10362
|
useFocusRestore();
|
|
10124
10363
|
return /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
|
|
@@ -10136,7 +10375,7 @@ var ModalContent = (0, import_react41.forwardRef)(
|
|
|
10136
10375
|
);
|
|
10137
10376
|
|
|
10138
10377
|
// src/private/components/Backdrop/Backdrop.tsx
|
|
10139
|
-
var
|
|
10378
|
+
var import_react43 = require("react");
|
|
10140
10379
|
var import_styled_components61 = __toESM(require("styled-components"));
|
|
10141
10380
|
var import_jsx_runtime237 = require("react/jsx-runtime");
|
|
10142
10381
|
var backdropAnimationDuration = 150;
|
|
@@ -10174,7 +10413,7 @@ var BackdropComponent = import_styled_components61.default.div`
|
|
|
10174
10413
|
}
|
|
10175
10414
|
}
|
|
10176
10415
|
`;
|
|
10177
|
-
var Backdrop = (0,
|
|
10416
|
+
var Backdrop = (0, import_react43.forwardRef)(
|
|
10178
10417
|
({ alignHorizontal = "center", alignVertical = "center", children, ...otherProps }, ref) => /* @__PURE__ */ (0, import_jsx_runtime237.jsx)(
|
|
10179
10418
|
BackdropComponent,
|
|
10180
10419
|
{
|
|
@@ -10196,7 +10435,7 @@ var ModalBody = import_styled_components62.default.div`
|
|
|
10196
10435
|
display: flex;
|
|
10197
10436
|
order: 2;
|
|
10198
10437
|
`;
|
|
10199
|
-
var Modal = (0,
|
|
10438
|
+
var Modal = (0, import_react44.forwardRef)(
|
|
10200
10439
|
({
|
|
10201
10440
|
children,
|
|
10202
10441
|
fullHeight = false,
|
|
@@ -10213,7 +10452,7 @@ var Modal = (0, import_react43.forwardRef)(
|
|
|
10213
10452
|
import_react_dialog4.Root,
|
|
10214
10453
|
{
|
|
10215
10454
|
onOpenChange: (open2) => {
|
|
10216
|
-
if (!open2 && (0,
|
|
10455
|
+
if (!open2 && (0, import_type_guards36.isNotNil)(onRequestClose)) {
|
|
10217
10456
|
onRequestClose();
|
|
10218
10457
|
}
|
|
10219
10458
|
},
|
|
@@ -10226,7 +10465,7 @@ var Modal = (0, import_react43.forwardRef)(
|
|
|
10226
10465
|
ref,
|
|
10227
10466
|
fullHeight,
|
|
10228
10467
|
onOpenAutoFocus: (event) => {
|
|
10229
|
-
if ((0,
|
|
10468
|
+
if ((0, import_type_guards36.isNotNil)(initialFocusRef) && initialFocusRef.current) {
|
|
10230
10469
|
event.preventDefault();
|
|
10231
10470
|
requestAnimationFrame(() => {
|
|
10232
10471
|
initialFocusRef.current?.focus();
|
|
@@ -10260,9 +10499,9 @@ var import_react_popover = require("@radix-ui/react-popover");
|
|
|
10260
10499
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
10261
10500
|
|
|
10262
10501
|
// src/private/helpers/getControls/getControlProps.tsx
|
|
10263
|
-
var
|
|
10502
|
+
var import_type_guards37 = require("@wistia/type-guards");
|
|
10264
10503
|
var getControlProps = (isOpen, onOpenChange) => {
|
|
10265
|
-
return (0,
|
|
10504
|
+
return (0, import_type_guards37.isNotNil)(onOpenChange) && (0, import_type_guards37.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {};
|
|
10266
10505
|
};
|
|
10267
10506
|
|
|
10268
10507
|
// src/components/Popover/Popover.tsx
|
|
@@ -10321,7 +10560,7 @@ Popover.displayName = "Popover";
|
|
|
10321
10560
|
// src/components/ProgressBar/ProgressBar.tsx
|
|
10322
10561
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
10323
10562
|
var import_react_progress = require("@radix-ui/react-progress");
|
|
10324
|
-
var
|
|
10563
|
+
var import_type_guards38 = require("@wistia/type-guards");
|
|
10325
10564
|
var import_jsx_runtime240 = require("react/jsx-runtime");
|
|
10326
10565
|
var ProgressBarWrapper = import_styled_components64.default.div`
|
|
10327
10566
|
--progress-bar-height: 8px;
|
|
@@ -10376,7 +10615,7 @@ var ProgressBar = ({
|
|
|
10376
10615
|
...props
|
|
10377
10616
|
}) => {
|
|
10378
10617
|
return /* @__PURE__ */ (0, import_jsx_runtime240.jsxs)(ProgressBarWrapper, { children: [
|
|
10379
|
-
(0,
|
|
10618
|
+
(0, import_type_guards38.isNotNil)(labelLeft) ? /* @__PURE__ */ (0, import_jsx_runtime240.jsx)(ProgressBarLabel, { children: labelLeft }) : null,
|
|
10380
10619
|
/* @__PURE__ */ (0, import_jsx_runtime240.jsx)(
|
|
10381
10620
|
StyledProgressBar,
|
|
10382
10621
|
{
|
|
@@ -10392,15 +10631,15 @@ var ProgressBar = ({
|
|
|
10392
10631
|
)
|
|
10393
10632
|
}
|
|
10394
10633
|
),
|
|
10395
|
-
(0,
|
|
10634
|
+
(0, import_type_guards38.isNotNil)(labelRight) ? /* @__PURE__ */ (0, import_jsx_runtime240.jsx)(ProgressBarLabel, { children: labelRight }) : null
|
|
10396
10635
|
] });
|
|
10397
10636
|
};
|
|
10398
10637
|
ProgressBar.displayName = "ProgressBar";
|
|
10399
10638
|
|
|
10400
10639
|
// src/components/Radio/Radio.tsx
|
|
10401
|
-
var
|
|
10640
|
+
var import_react45 = require("react");
|
|
10402
10641
|
var import_styled_components65 = __toESM(require("styled-components"));
|
|
10403
|
-
var
|
|
10642
|
+
var import_type_guards39 = require("@wistia/type-guards");
|
|
10404
10643
|
var import_jsx_runtime241 = require("react/jsx-runtime");
|
|
10405
10644
|
var RadioIcon = () => /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
|
|
10406
10645
|
"svg",
|
|
@@ -10501,7 +10740,7 @@ var StyledHiddenRadioInput = import_styled_components65.default.input`
|
|
|
10501
10740
|
display: block;
|
|
10502
10741
|
}
|
|
10503
10742
|
`;
|
|
10504
|
-
var Radio = (0,
|
|
10743
|
+
var Radio = (0, import_react45.forwardRef)(
|
|
10505
10744
|
({
|
|
10506
10745
|
checked,
|
|
10507
10746
|
disabled = false,
|
|
@@ -10516,8 +10755,8 @@ var Radio = (0, import_react44.forwardRef)(
|
|
|
10516
10755
|
hideLabel = false,
|
|
10517
10756
|
...props
|
|
10518
10757
|
}, ref) => {
|
|
10519
|
-
const generatedId = (0,
|
|
10520
|
-
const computedId = (0,
|
|
10758
|
+
const generatedId = (0, import_react45.useId)();
|
|
10759
|
+
const computedId = (0, import_type_guards39.isNonEmptyString)(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
10521
10760
|
return /* @__PURE__ */ (0, import_jsx_runtime241.jsxs)(
|
|
10522
10761
|
StyledRadioWrapper,
|
|
10523
10762
|
{
|
|
@@ -10566,22 +10805,22 @@ var Radio = (0, import_react44.forwardRef)(
|
|
|
10566
10805
|
Radio.displayName = "Radio";
|
|
10567
10806
|
|
|
10568
10807
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
10569
|
-
var
|
|
10808
|
+
var import_react49 = require("react");
|
|
10570
10809
|
var import_styled_components67 = __toESM(require("styled-components"));
|
|
10571
10810
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
10572
|
-
var
|
|
10811
|
+
var import_type_guards40 = require("@wistia/type-guards");
|
|
10573
10812
|
|
|
10574
10813
|
// src/components/SegmentedControl/useSelectedItemMeasurements.tsx
|
|
10575
|
-
var
|
|
10814
|
+
var import_react46 = require("react");
|
|
10576
10815
|
var import_jsx_runtime242 = require("react/jsx-runtime");
|
|
10577
|
-
var SelectedItemMeasurementsContext = (0,
|
|
10816
|
+
var SelectedItemMeasurementsContext = (0, import_react46.createContext)(
|
|
10578
10817
|
null
|
|
10579
10818
|
);
|
|
10580
10819
|
var SelectedItemMeasurementsProvider = ({
|
|
10581
10820
|
children
|
|
10582
10821
|
}) => {
|
|
10583
|
-
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0,
|
|
10584
|
-
const contextValue = (0,
|
|
10822
|
+
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0, import_react46.useState)(null);
|
|
10823
|
+
const contextValue = (0, import_react46.useMemo)(
|
|
10585
10824
|
() => ({
|
|
10586
10825
|
setSelectedItemMeasurements,
|
|
10587
10826
|
selectedItemMeasurements
|
|
@@ -10591,7 +10830,7 @@ var SelectedItemMeasurementsProvider = ({
|
|
|
10591
10830
|
return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(SelectedItemMeasurementsContext.Provider, { value: contextValue, children });
|
|
10592
10831
|
};
|
|
10593
10832
|
var useSelectedItemMeasurements = () => {
|
|
10594
|
-
const context = (0,
|
|
10833
|
+
const context = (0, import_react46.useContext)(SelectedItemMeasurementsContext);
|
|
10595
10834
|
if (context === null) {
|
|
10596
10835
|
throw new Error(
|
|
10597
10836
|
"useSelectedItemMeasurements must be used within a SelectedItemMeasurementsProvider"
|
|
@@ -10601,15 +10840,15 @@ var useSelectedItemMeasurements = () => {
|
|
|
10601
10840
|
};
|
|
10602
10841
|
|
|
10603
10842
|
// src/components/SegmentedControl/SelectedItemIndicator.tsx
|
|
10604
|
-
var
|
|
10843
|
+
var import_react48 = require("react");
|
|
10605
10844
|
var import_styled_components66 = __toESM(require("styled-components"));
|
|
10606
10845
|
|
|
10607
10846
|
// src/components/SegmentedControl/useSegmentedControlValue.tsx
|
|
10608
|
-
var
|
|
10609
|
-
var SegmentedControlValueContext = (0,
|
|
10847
|
+
var import_react47 = require("react");
|
|
10848
|
+
var SegmentedControlValueContext = (0, import_react47.createContext)(null);
|
|
10610
10849
|
var SegmentedControlValueProvider = SegmentedControlValueContext.Provider;
|
|
10611
10850
|
var useSegmentedControlValue = () => {
|
|
10612
|
-
const context = (0,
|
|
10851
|
+
const context = (0, import_react47.useContext)(SegmentedControlValueContext);
|
|
10613
10852
|
if (context === null) {
|
|
10614
10853
|
throw new Error("useSegmentedControlValue must be used within a SegmentedControlValueProvider");
|
|
10615
10854
|
}
|
|
@@ -10633,7 +10872,7 @@ var SelectedItemIndicatorDiv = import_styled_components66.default.div`
|
|
|
10633
10872
|
var SelectedItemIndicator = () => {
|
|
10634
10873
|
const selectedValue = useSegmentedControlValue();
|
|
10635
10874
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
10636
|
-
const selectedItemIndicatorStyle = (0,
|
|
10875
|
+
const selectedItemIndicatorStyle = (0, import_react48.useMemo)(
|
|
10637
10876
|
() => selectedItemMeasurements != null ? {
|
|
10638
10877
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
10639
10878
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -10671,7 +10910,7 @@ var segmentedControlStyles = import_styled_components67.css`
|
|
|
10671
10910
|
var StyledSegmentedControl = (0, import_styled_components67.default)(import_react_toggle_group.Root)`
|
|
10672
10911
|
${segmentedControlStyles}
|
|
10673
10912
|
`;
|
|
10674
|
-
var SegmentedControl = (0,
|
|
10913
|
+
var SegmentedControl = (0, import_react49.forwardRef)(
|
|
10675
10914
|
({
|
|
10676
10915
|
children,
|
|
10677
10916
|
disabled = false,
|
|
@@ -10680,7 +10919,7 @@ var SegmentedControl = (0, import_react48.forwardRef)(
|
|
|
10680
10919
|
onSelectedValueChange,
|
|
10681
10920
|
...props
|
|
10682
10921
|
}, ref) => {
|
|
10683
|
-
if ((0,
|
|
10922
|
+
if ((0, import_type_guards40.isNil)(children)) {
|
|
10684
10923
|
return null;
|
|
10685
10924
|
}
|
|
10686
10925
|
return /* @__PURE__ */ (0, import_jsx_runtime244.jsx)(
|
|
@@ -10706,20 +10945,20 @@ var SegmentedControl = (0, import_react48.forwardRef)(
|
|
|
10706
10945
|
SegmentedControl.displayName = "SegmentedControl";
|
|
10707
10946
|
|
|
10708
10947
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
10709
|
-
var
|
|
10948
|
+
var import_react50 = require("react");
|
|
10710
10949
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
10711
10950
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
10712
|
-
var
|
|
10951
|
+
var import_type_guards42 = require("@wistia/type-guards");
|
|
10713
10952
|
|
|
10714
10953
|
// src/private/helpers/mergeRefs/mergeRefs.ts
|
|
10715
|
-
var
|
|
10954
|
+
var import_type_guards41 = require("@wistia/type-guards");
|
|
10716
10955
|
var mergeRefs = (refs) => (value) => {
|
|
10717
10956
|
refs.forEach((ref) => {
|
|
10718
|
-
if ((0,
|
|
10957
|
+
if ((0, import_type_guards41.isFunction)(ref)) {
|
|
10719
10958
|
ref(value);
|
|
10720
10959
|
return;
|
|
10721
10960
|
}
|
|
10722
|
-
if ((0,
|
|
10961
|
+
if ((0, import_type_guards41.isNotNil)(ref)) {
|
|
10723
10962
|
ref.current = value;
|
|
10724
10963
|
}
|
|
10725
10964
|
});
|
|
@@ -10789,11 +11028,11 @@ var segmentedControlItemStyles = import_styled_components68.css`
|
|
|
10789
11028
|
var StyledSegmentedControlItem = (0, import_styled_components68.default)(import_react_toggle_group2.Item)`
|
|
10790
11029
|
${segmentedControlItemStyles}
|
|
10791
11030
|
`;
|
|
10792
|
-
var SegmentedControlItem = (0,
|
|
11031
|
+
var SegmentedControlItem = (0, import_react50.forwardRef)(
|
|
10793
11032
|
({ disabled, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
10794
11033
|
const selectedValue = useSegmentedControlValue();
|
|
10795
11034
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
10796
|
-
const buttonRef = (0,
|
|
11035
|
+
const buttonRef = (0, import_react50.useRef)(null);
|
|
10797
11036
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
10798
11037
|
const handleClick = (event) => {
|
|
10799
11038
|
const target = event.target;
|
|
@@ -10802,7 +11041,7 @@ var SegmentedControlItem = (0, import_react49.forwardRef)(
|
|
|
10802
11041
|
event.preventDefault();
|
|
10803
11042
|
}
|
|
10804
11043
|
};
|
|
10805
|
-
(0,
|
|
11044
|
+
(0, import_react50.useEffect)(() => {
|
|
10806
11045
|
const buttonElem = buttonRef.current;
|
|
10807
11046
|
if (!buttonElem) {
|
|
10808
11047
|
return void 0;
|
|
@@ -10831,8 +11070,8 @@ var SegmentedControlItem = (0, import_react49.forwardRef)(
|
|
|
10831
11070
|
StyledSegmentedControlItem,
|
|
10832
11071
|
{
|
|
10833
11072
|
ref: combinedRef,
|
|
10834
|
-
$hasLabel: (0,
|
|
10835
|
-
"aria-label": (0,
|
|
11073
|
+
$hasLabel: (0, import_type_guards42.isNotNil)(label),
|
|
11074
|
+
"aria-label": (0, import_type_guards42.isNotNil)(label) ? void 0 : ariaLabel,
|
|
10836
11075
|
disabled,
|
|
10837
11076
|
onClick: handleClick,
|
|
10838
11077
|
value,
|
|
@@ -10848,7 +11087,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
10848
11087
|
|
|
10849
11088
|
// src/components/Select/Select.tsx
|
|
10850
11089
|
var import_react_select = require("@radix-ui/react-select");
|
|
10851
|
-
var
|
|
11090
|
+
var import_react51 = require("react");
|
|
10852
11091
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
10853
11092
|
var import_jsx_runtime246 = require("react/jsx-runtime");
|
|
10854
11093
|
var StyledTrigger = (0, import_styled_components69.default)(import_react_select.Trigger)`
|
|
@@ -10917,7 +11156,7 @@ var StyledContent3 = (0, import_styled_components69.default)(import_react_select
|
|
|
10917
11156
|
max-height: var(--radix-select-content-available-height);
|
|
10918
11157
|
z-index: var(--wui-zindex-select);
|
|
10919
11158
|
`;
|
|
10920
|
-
var Select = (0,
|
|
11159
|
+
var Select = (0, import_react51.forwardRef)(
|
|
10921
11160
|
({
|
|
10922
11161
|
colorScheme = "inherit",
|
|
10923
11162
|
children,
|
|
@@ -10966,7 +11205,7 @@ Select.displayName = "Select";
|
|
|
10966
11205
|
|
|
10967
11206
|
// src/components/Select/SelectOption.tsx
|
|
10968
11207
|
var import_react_select2 = require("@radix-ui/react-select");
|
|
10969
|
-
var
|
|
11208
|
+
var import_react52 = require("react");
|
|
10970
11209
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
10971
11210
|
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
10972
11211
|
var StyledItem = (0, import_styled_components70.default)(import_react_select2.Item)`
|
|
@@ -10995,7 +11234,7 @@ var StyledItem = (0, import_styled_components70.default)(import_react_select2.It
|
|
|
10995
11234
|
var StyledIconContainer = import_styled_components70.default.span`
|
|
10996
11235
|
width: 12px;
|
|
10997
11236
|
`;
|
|
10998
|
-
var SelectOption = (0,
|
|
11237
|
+
var SelectOption = (0, import_react52.forwardRef)(
|
|
10999
11238
|
({ children, ...props }, forwardedRef) => {
|
|
11000
11239
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(
|
|
11001
11240
|
StyledItem,
|
|
@@ -11040,9 +11279,9 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
11040
11279
|
};
|
|
11041
11280
|
|
|
11042
11281
|
// src/components/Switch/Switch.tsx
|
|
11043
|
-
var
|
|
11282
|
+
var import_react53 = require("react");
|
|
11044
11283
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
11045
|
-
var
|
|
11284
|
+
var import_type_guards43 = require("@wistia/type-guards");
|
|
11046
11285
|
var import_jsx_runtime249 = require("react/jsx-runtime");
|
|
11047
11286
|
var sizeSmall3 = import_styled_components72.css`
|
|
11048
11287
|
--wui-size-small-width: 24px;
|
|
@@ -11145,7 +11384,7 @@ var StyledHiddenSwitchInput = import_styled_components72.default.input`
|
|
|
11145
11384
|
}
|
|
11146
11385
|
}
|
|
11147
11386
|
`;
|
|
11148
|
-
var Switch = (0,
|
|
11387
|
+
var Switch = (0, import_react53.forwardRef)(
|
|
11149
11388
|
({
|
|
11150
11389
|
checked,
|
|
11151
11390
|
disabled = false,
|
|
@@ -11160,8 +11399,8 @@ var Switch = (0, import_react52.forwardRef)(
|
|
|
11160
11399
|
hideLabel = false,
|
|
11161
11400
|
...props
|
|
11162
11401
|
}, ref) => {
|
|
11163
|
-
const generatedId = (0,
|
|
11164
|
-
const computedId = (0,
|
|
11402
|
+
const generatedId = (0, import_react53.useId)();
|
|
11403
|
+
const computedId = (0, import_type_guards43.isNonEmptyString)(id) ? id : `wistia-ui-switch-${generatedId}`;
|
|
11165
11404
|
return /* @__PURE__ */ (0, import_jsx_runtime249.jsxs)(StyledSwitchWrapper, { $disabled: disabled, children: [
|
|
11166
11405
|
/* @__PURE__ */ (0, import_jsx_runtime249.jsx)(
|
|
11167
11406
|
StyledHiddenSwitchInput,
|
|
@@ -11242,8 +11481,8 @@ var Table = ({
|
|
|
11242
11481
|
var import_styled_components74 = __toESM(require("styled-components"));
|
|
11243
11482
|
|
|
11244
11483
|
// src/components/Table/TableSectionContext.ts
|
|
11245
|
-
var
|
|
11246
|
-
var TableSectionContext = (0,
|
|
11484
|
+
var import_react54 = require("react");
|
|
11485
|
+
var TableSectionContext = (0, import_react54.createContext)(null);
|
|
11247
11486
|
|
|
11248
11487
|
// src/components/Table/TableBody.tsx
|
|
11249
11488
|
var import_jsx_runtime251 = require("react/jsx-runtime");
|
|
@@ -11253,7 +11492,7 @@ var TableBody = ({ children, ...props }) => {
|
|
|
11253
11492
|
};
|
|
11254
11493
|
|
|
11255
11494
|
// src/components/Table/TableCell.tsx
|
|
11256
|
-
var
|
|
11495
|
+
var import_react55 = require("react");
|
|
11257
11496
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
11258
11497
|
var import_jsx_runtime252 = require("react/jsx-runtime");
|
|
11259
11498
|
var sharedStyles = import_styled_components75.css`
|
|
@@ -11274,7 +11513,7 @@ var StyledTd = import_styled_components75.default.td`
|
|
|
11274
11513
|
line-height: var(--wui-typography-body-2-line-height);
|
|
11275
11514
|
`;
|
|
11276
11515
|
var TableCell = ({ children, ...props }) => {
|
|
11277
|
-
const section = (0,
|
|
11516
|
+
const section = (0, import_react55.useContext)(TableSectionContext);
|
|
11278
11517
|
if (section === "head") {
|
|
11279
11518
|
return /* @__PURE__ */ (0, import_jsx_runtime252.jsx)(StyledTh, { ...props, children });
|
|
11280
11519
|
}
|
|
@@ -11306,9 +11545,9 @@ var TableRow = ({ children, ...props }) => {
|
|
|
11306
11545
|
};
|
|
11307
11546
|
|
|
11308
11547
|
// src/components/Tabs/Tabs.tsx
|
|
11309
|
-
var
|
|
11548
|
+
var import_react60 = require("react");
|
|
11310
11549
|
var import_react_tabs4 = require("@radix-ui/react-tabs");
|
|
11311
|
-
var
|
|
11550
|
+
var import_type_guards45 = require("@wistia/type-guards");
|
|
11312
11551
|
var import_styled_components83 = __toESM(require("styled-components"));
|
|
11313
11552
|
|
|
11314
11553
|
// src/components/Tabs/TabPanel.tsx
|
|
@@ -11361,17 +11600,17 @@ var TabList = ({
|
|
|
11361
11600
|
TabList.displayName = "TabList";
|
|
11362
11601
|
|
|
11363
11602
|
// src/components/Tabs/TabItem.tsx
|
|
11364
|
-
var
|
|
11603
|
+
var import_react57 = require("react");
|
|
11365
11604
|
var import_styled_components81 = __toESM(require("styled-components"));
|
|
11366
11605
|
var import_react_tabs3 = require("@radix-ui/react-tabs");
|
|
11367
|
-
var
|
|
11606
|
+
var import_type_guards44 = require("@wistia/type-guards");
|
|
11368
11607
|
|
|
11369
11608
|
// src/components/Tabs/useTabsValue.tsx
|
|
11370
|
-
var
|
|
11371
|
-
var TabsValueContext = (0,
|
|
11609
|
+
var import_react56 = require("react");
|
|
11610
|
+
var TabsValueContext = (0, import_react56.createContext)(null);
|
|
11372
11611
|
var TabsValueProvider = TabsValueContext.Provider;
|
|
11373
11612
|
var useTabsValue = () => {
|
|
11374
|
-
const context = (0,
|
|
11613
|
+
const context = (0, import_react56.useContext)(TabsValueContext);
|
|
11375
11614
|
if (context === null) {
|
|
11376
11615
|
throw new Error("useTabsValue must be used within a TabsValueProvider");
|
|
11377
11616
|
}
|
|
@@ -11387,13 +11626,13 @@ var StyledTabItem = (0, import_styled_components81.default)(import_react_tabs3.T
|
|
|
11387
11626
|
outline: none;
|
|
11388
11627
|
}
|
|
11389
11628
|
`;
|
|
11390
|
-
var TabItem = (0,
|
|
11629
|
+
var TabItem = (0, import_react57.forwardRef)(
|
|
11391
11630
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11392
11631
|
const selectedValue = useTabsValue();
|
|
11393
11632
|
const { setSelectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11394
|
-
const buttonRef = (0,
|
|
11633
|
+
const buttonRef = (0, import_react57.useRef)(null);
|
|
11395
11634
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11396
|
-
(0,
|
|
11635
|
+
(0, import_react57.useEffect)(() => {
|
|
11397
11636
|
const buttonElem = buttonRef.current;
|
|
11398
11637
|
if (!buttonElem) {
|
|
11399
11638
|
return void 0;
|
|
@@ -11422,8 +11661,8 @@ var TabItem = (0, import_react56.forwardRef)(
|
|
|
11422
11661
|
StyledTabItem,
|
|
11423
11662
|
{
|
|
11424
11663
|
ref: combinedRef,
|
|
11425
|
-
$hasLabel: (0,
|
|
11426
|
-
"aria-label": (0,
|
|
11664
|
+
$hasLabel: (0, import_type_guards44.isNotNil)(label),
|
|
11665
|
+
"aria-label": (0, import_type_guards44.isNotNil)(label) ? void 0 : ariaLabel,
|
|
11427
11666
|
disabled,
|
|
11428
11667
|
value,
|
|
11429
11668
|
children: [
|
|
@@ -11437,16 +11676,16 @@ var TabItem = (0, import_react56.forwardRef)(
|
|
|
11437
11676
|
TabItem.displayName = "TabItem";
|
|
11438
11677
|
|
|
11439
11678
|
// src/components/Tabs/extractTabItems.ts
|
|
11440
|
-
var
|
|
11679
|
+
var import_react58 = require("react");
|
|
11441
11680
|
var extractTabItems = (children) => {
|
|
11442
11681
|
const tabItems = [];
|
|
11443
|
-
|
|
11444
|
-
if (!(0,
|
|
11682
|
+
import_react58.Children.forEach(children, (child) => {
|
|
11683
|
+
if (!(0, import_react58.isValidElement)(child)) {
|
|
11445
11684
|
return;
|
|
11446
11685
|
}
|
|
11447
11686
|
if (typeof child.type !== "string" && child.type.displayName === "Tab") {
|
|
11448
11687
|
tabItems.push(child);
|
|
11449
|
-
} else if (child.type ===
|
|
11688
|
+
} else if (child.type === import_react58.Fragment) {
|
|
11450
11689
|
const fragmentElement = child;
|
|
11451
11690
|
tabItems.push(...extractTabItems(fragmentElement.props.children));
|
|
11452
11691
|
} else if ((child.props.children ?? null) != null) {
|
|
@@ -11459,7 +11698,7 @@ var extractTabItems = (children) => {
|
|
|
11459
11698
|
};
|
|
11460
11699
|
|
|
11461
11700
|
// src/components/Tabs/SelectedItemIndicator.tsx
|
|
11462
|
-
var
|
|
11701
|
+
var import_react59 = require("react");
|
|
11463
11702
|
var import_styled_components82 = __toESM(require("styled-components"));
|
|
11464
11703
|
var import_jsx_runtime259 = require("react/jsx-runtime");
|
|
11465
11704
|
var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(SelectedItemIndicatorDiv)`
|
|
@@ -11470,7 +11709,7 @@ var TabsSelectedItemIndicatorDiv = (0, import_styled_components82.default)(Selec
|
|
|
11470
11709
|
var SelectedItemIndicator2 = () => {
|
|
11471
11710
|
const { selectedItemMeasurements } = useSelectedItemMeasurements();
|
|
11472
11711
|
const selectedValue = useTabsValue();
|
|
11473
|
-
const selectedItemIndicatorStyle = (0,
|
|
11712
|
+
const selectedItemIndicatorStyle = (0, import_react59.useMemo)(
|
|
11474
11713
|
() => selectedItemMeasurements != null ? {
|
|
11475
11714
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
11476
11715
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px)`,
|
|
@@ -11511,7 +11750,7 @@ var StyledTabsRoot = (0, import_styled_components83.default)(import_react_tabs4.
|
|
|
11511
11750
|
flex-direction: column;
|
|
11512
11751
|
height: ${({ $stickyHeaders }) => $stickyHeaders ? "100%" : "auto"};
|
|
11513
11752
|
`;
|
|
11514
|
-
var Tabs = (0,
|
|
11753
|
+
var Tabs = (0, import_react60.forwardRef)(
|
|
11515
11754
|
({
|
|
11516
11755
|
children,
|
|
11517
11756
|
fullWidth = true,
|
|
@@ -11523,7 +11762,7 @@ var Tabs = (0, import_react59.forwardRef)(
|
|
|
11523
11762
|
...otherProps
|
|
11524
11763
|
}, ref) => {
|
|
11525
11764
|
const tabItems = extractTabItems(children);
|
|
11526
|
-
const [internalSelectedValue, setInternalSelectedValue] = (0,
|
|
11765
|
+
const [internalSelectedValue, setInternalSelectedValue] = (0, import_react60.useState)(defaultSelectedValue);
|
|
11527
11766
|
const modeProps = defaultSelectedValue !== void 0 ? {
|
|
11528
11767
|
defaultValue: defaultSelectedValue,
|
|
11529
11768
|
onValueChange: setInternalSelectedValue
|
|
@@ -11553,7 +11792,7 @@ var Tabs = (0, import_react59.forwardRef)(
|
|
|
11553
11792
|
label,
|
|
11554
11793
|
"aria-label": ariaLabelForTab
|
|
11555
11794
|
} = tab.props;
|
|
11556
|
-
if ((0,
|
|
11795
|
+
if ((0, import_type_guards45.isNil)(icon)) {
|
|
11557
11796
|
return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
|
|
11558
11797
|
TabItem,
|
|
11559
11798
|
{
|
|
@@ -11564,7 +11803,7 @@ var Tabs = (0, import_react59.forwardRef)(
|
|
|
11564
11803
|
value
|
|
11565
11804
|
);
|
|
11566
11805
|
}
|
|
11567
|
-
if ((0,
|
|
11806
|
+
if ((0, import_type_guards45.isNotNil)(label)) {
|
|
11568
11807
|
return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
|
|
11569
11808
|
TabItem,
|
|
11570
11809
|
{
|
|
@@ -11576,7 +11815,7 @@ var Tabs = (0, import_react59.forwardRef)(
|
|
|
11576
11815
|
value
|
|
11577
11816
|
);
|
|
11578
11817
|
}
|
|
11579
|
-
if ((0,
|
|
11818
|
+
if ((0, import_type_guards45.isNotNil)(ariaLabelForTab)) {
|
|
11580
11819
|
return /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(
|
|
11581
11820
|
TabItem,
|
|
11582
11821
|
{
|
|
@@ -11609,17 +11848,17 @@ var Tabs = (0, import_react59.forwardRef)(
|
|
|
11609
11848
|
Tabs.displayName = "Tabs";
|
|
11610
11849
|
|
|
11611
11850
|
// src/components/Tabs/Tab.tsx
|
|
11612
|
-
var
|
|
11851
|
+
var import_react61 = require("react");
|
|
11613
11852
|
var import_jsx_runtime261 = require("react/jsx-runtime");
|
|
11614
|
-
var Tab = (0,
|
|
11853
|
+
var Tab = (0, import_react61.forwardRef)(({ children }, ref) => {
|
|
11615
11854
|
return /* @__PURE__ */ (0, import_jsx_runtime261.jsx)("div", { ref, children });
|
|
11616
11855
|
});
|
|
11617
11856
|
Tab.displayName = "Tab";
|
|
11618
11857
|
|
|
11619
11858
|
// src/components/Tag/Tag.tsx
|
|
11620
|
-
var
|
|
11859
|
+
var import_react62 = require("react");
|
|
11621
11860
|
var import_styled_components84 = __toESM(require("styled-components"));
|
|
11622
|
-
var
|
|
11861
|
+
var import_type_guards46 = require("@wistia/type-guards");
|
|
11623
11862
|
var import_jsx_runtime262 = require("react/jsx-runtime");
|
|
11624
11863
|
var TagLabel = import_styled_components84.default.a`
|
|
11625
11864
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -11704,10 +11943,10 @@ var StyledTag = import_styled_components84.default.div`
|
|
|
11704
11943
|
}
|
|
11705
11944
|
`;
|
|
11706
11945
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
11707
|
-
if ((0,
|
|
11946
|
+
if ((0, import_type_guards46.isNil)(onClickRemove)) {
|
|
11708
11947
|
return null;
|
|
11709
11948
|
}
|
|
11710
|
-
if ((0,
|
|
11949
|
+
if ((0, import_type_guards46.isNil)(onClickRemoveLabel)) {
|
|
11711
11950
|
throw new Error(
|
|
11712
11951
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
11713
11952
|
);
|
|
@@ -11734,7 +11973,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
11734
11973
|
)
|
|
11735
11974
|
] });
|
|
11736
11975
|
};
|
|
11737
|
-
var Tag = (0,
|
|
11976
|
+
var Tag = (0, import_react62.forwardRef)(
|
|
11738
11977
|
({
|
|
11739
11978
|
onClickRemove,
|
|
11740
11979
|
colorScheme = "inherit",
|
|
@@ -11744,8 +11983,8 @@ var Tag = (0, import_react61.forwardRef)(
|
|
|
11744
11983
|
onClickRemoveLabel,
|
|
11745
11984
|
...otherProps
|
|
11746
11985
|
}, ref) => {
|
|
11747
|
-
const hasIcon = (0,
|
|
11748
|
-
const labelProps = (0,
|
|
11986
|
+
const hasIcon = (0, import_type_guards46.isNotNil)(icon);
|
|
11987
|
+
const labelProps = (0, import_type_guards46.isNotNil)(href) && (0, import_type_guards46.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
11749
11988
|
return /* @__PURE__ */ (0, import_jsx_runtime262.jsxs)(
|
|
11750
11989
|
StyledTag,
|
|
11751
11990
|
{
|
|
@@ -11781,7 +12020,7 @@ Tag.displayName = "Tag";
|
|
|
11781
12020
|
|
|
11782
12021
|
// src/components/WistiaLogo/WistiaLogo.tsx
|
|
11783
12022
|
var import_styled_components85 = __toESM(require("styled-components"));
|
|
11784
|
-
var
|
|
12023
|
+
var import_type_guards47 = require("@wistia/type-guards");
|
|
11785
12024
|
var import_jsx_runtime263 = require("react/jsx-runtime");
|
|
11786
12025
|
var renderBrandmark = (brandmarkColor, iconOnly) => {
|
|
11787
12026
|
if (iconOnly) {
|
|
@@ -11894,7 +12133,7 @@ var WistiaLogo = ({
|
|
|
11894
12133
|
...otherProps,
|
|
11895
12134
|
children: [
|
|
11896
12135
|
/* @__PURE__ */ (0, import_jsx_runtime263.jsx)("title", { children: title }),
|
|
11897
|
-
(0,
|
|
12136
|
+
(0, import_type_guards47.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime263.jsx)("desc", { children: description }) : null,
|
|
11898
12137
|
renderBrandmark(brandmarkColor, iconOnly),
|
|
11899
12138
|
renderLogotype(logotypeColor, iconOnly)
|
|
11900
12139
|
]
|
|
@@ -11989,6 +12228,7 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
11989
12228
|
useAriaLive,
|
|
11990
12229
|
useBoolean,
|
|
11991
12230
|
useFilePicker,
|
|
12231
|
+
useFocusTrap,
|
|
11992
12232
|
useFormState,
|
|
11993
12233
|
useImperativeFilePicker,
|
|
11994
12234
|
useKey,
|