@wistia/ui 0.8.9 → 0.8.10
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 +225 -226
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +26 -25
- package/dist/index.d.ts +26 -25
- package/dist/index.mjs +63 -64
- 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.8.
|
|
3
|
+
* @license @wistia/ui v0.8.10
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -142,6 +142,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
142
142
|
|
|
143
143
|
// src/providers/UIProvider/UIProvider.tsx
|
|
144
144
|
var import_react_tooltip = require("@radix-ui/react-tooltip");
|
|
145
|
+
var import_react3 = require("react");
|
|
145
146
|
|
|
146
147
|
// src/css/GlobalStyle.tsx
|
|
147
148
|
var import_styled_components12 = require("styled-components");
|
|
@@ -1600,12 +1601,17 @@ var ToastProvider = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_so
|
|
|
1600
1601
|
|
|
1601
1602
|
// src/providers/UIProvider/UIProvider.tsx
|
|
1602
1603
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1604
|
+
var UIProviderNestingContext = (0, import_react3.createContext)(false);
|
|
1603
1605
|
var UIProvider = ({ children }) => {
|
|
1604
|
-
|
|
1606
|
+
const isNested = (0, import_react3.useContext)(UIProviderNestingContext);
|
|
1607
|
+
if (isNested) {
|
|
1608
|
+
console.warn("UIProvider is nested. Only one instance of UIProvider.");
|
|
1609
|
+
}
|
|
1610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(UIProviderNestingContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AriaLiveProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_tooltip.Provider, { children: [
|
|
1605
1611
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(GlobalStyle, {}),
|
|
1606
1612
|
children,
|
|
1607
1613
|
process.env["NODE_ENV"] !== "test" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ToastProvider, {})
|
|
1608
|
-
] }) });
|
|
1614
|
+
] }) }) });
|
|
1609
1615
|
};
|
|
1610
1616
|
|
|
1611
1617
|
// src/helpers/copyToClipboard/copyToClipboard.ts
|
|
@@ -2073,10 +2079,10 @@ var mq = {
|
|
|
2073
2079
|
};
|
|
2074
2080
|
|
|
2075
2081
|
// src/hooks/useAriaLive/useAriaLive.tsx
|
|
2076
|
-
var
|
|
2082
|
+
var import_react4 = require("react");
|
|
2077
2083
|
var import_type_guards6 = require("@wistia/type-guards");
|
|
2078
2084
|
var useAriaLive = () => {
|
|
2079
|
-
const context = (0,
|
|
2085
|
+
const context = (0, import_react4.useContext)(AriaLiveContext);
|
|
2080
2086
|
if ((0, import_type_guards6.isNil)(context)) {
|
|
2081
2087
|
throw new Error("useAriaLive must be used within an AriaLiveProvider");
|
|
2082
2088
|
}
|
|
@@ -2084,12 +2090,12 @@ var useAriaLive = () => {
|
|
|
2084
2090
|
};
|
|
2085
2091
|
|
|
2086
2092
|
// src/hooks/useBoolean/useBoolean.ts
|
|
2087
|
-
var
|
|
2093
|
+
var import_react5 = require("react");
|
|
2088
2094
|
var useBoolean = (initialValue = false) => {
|
|
2089
|
-
const [value, setValue] = (0,
|
|
2090
|
-
const toggle = (0,
|
|
2091
|
-
const setTrue = (0,
|
|
2092
|
-
const setFalse = (0,
|
|
2095
|
+
const [value, setValue] = (0, import_react5.useState)(initialValue);
|
|
2096
|
+
const toggle = (0, import_react5.useCallback)(() => setValue((val) => !val), []);
|
|
2097
|
+
const setTrue = (0, import_react5.useCallback)(() => setValue(true), []);
|
|
2098
|
+
const setFalse = (0, import_react5.useCallback)(() => setValue(false), []);
|
|
2093
2099
|
return [value, toggle, setTrue, setFalse, setValue];
|
|
2094
2100
|
};
|
|
2095
2101
|
|
|
@@ -2098,10 +2104,10 @@ var import_use_file_picker = require("use-file-picker");
|
|
|
2098
2104
|
var import_validators = require("use-file-picker/validators");
|
|
2099
2105
|
|
|
2100
2106
|
// src/hooks/useKey/useKey.ts
|
|
2101
|
-
var
|
|
2107
|
+
var import_react7 = require("react");
|
|
2102
2108
|
|
|
2103
2109
|
// src/private/hooks/useEvent/useEvent.ts
|
|
2104
|
-
var
|
|
2110
|
+
var import_react6 = require("react");
|
|
2105
2111
|
|
|
2106
2112
|
// src/private/helpers/isValidRef/isValidRef.ts
|
|
2107
2113
|
var import_type_guards7 = require("@wistia/type-guards");
|
|
@@ -2120,15 +2126,15 @@ var isEventTargetSupported = (eventTarget) => (
|
|
|
2120
2126
|
!!(typeof eventTarget === "object" && eventTarget?.addEventListener)
|
|
2121
2127
|
);
|
|
2122
2128
|
var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}) => {
|
|
2123
|
-
const savedEventHandler = (0,
|
|
2124
|
-
const savedEventOptions = (0,
|
|
2125
|
-
(0,
|
|
2129
|
+
const savedEventHandler = (0, import_react6.useRef)();
|
|
2130
|
+
const savedEventOptions = (0, import_react6.useRef)();
|
|
2131
|
+
(0, import_react6.useEffect)(() => {
|
|
2126
2132
|
savedEventHandler.current = eventHandler;
|
|
2127
2133
|
}, [eventHandler]);
|
|
2128
|
-
(0,
|
|
2134
|
+
(0, import_react6.useEffect)(() => {
|
|
2129
2135
|
savedEventOptions.current = eventOptions;
|
|
2130
2136
|
}, [eventOptions]);
|
|
2131
|
-
(0,
|
|
2137
|
+
(0, import_react6.useEffect)(() => {
|
|
2132
2138
|
const target = isValidRef(eventTarget) ? eventTarget.current : eventTarget;
|
|
2133
2139
|
if (!eventName || !isEventTargetSupported(target)) {
|
|
2134
2140
|
return;
|
|
@@ -2148,7 +2154,7 @@ var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}
|
|
|
2148
2154
|
|
|
2149
2155
|
// src/hooks/useKey/useKey.ts
|
|
2150
2156
|
var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOptions } = {}) => {
|
|
2151
|
-
const memoizedEventHandler = (0,
|
|
2157
|
+
const memoizedEventHandler = (0, import_react7.useCallback)(
|
|
2152
2158
|
(handlerEvent) => {
|
|
2153
2159
|
if (["INPUT", "TEXTAREA", "SELECT"].includes(document.activeElement?.nodeName ?? "") || document.activeElement?.isContentEditable) {
|
|
2154
2160
|
return;
|
|
@@ -2173,9 +2179,9 @@ var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOpti
|
|
|
2173
2179
|
};
|
|
2174
2180
|
|
|
2175
2181
|
// src/hooks/useLocalStorage/useLocalStorage.ts
|
|
2176
|
-
var
|
|
2182
|
+
var import_react8 = require("react");
|
|
2177
2183
|
var useLocalStorage = (key, initialValue, storage = window.localStorage) => {
|
|
2178
|
-
const [storedValue, setStoredValue] = (0,
|
|
2184
|
+
const [storedValue, setStoredValue] = (0, import_react8.useState)(() => {
|
|
2179
2185
|
try {
|
|
2180
2186
|
const item = storage.getItem(key);
|
|
2181
2187
|
return item !== null && !!item ? JSON.parse(item) : initialValue;
|
|
@@ -2201,9 +2207,9 @@ var useLocalStorage = (key, initialValue, storage = window.localStorage) => {
|
|
|
2201
2207
|
};
|
|
2202
2208
|
|
|
2203
2209
|
// src/hooks/useLockBodyScroll/useLockBodyScroll.ts
|
|
2204
|
-
var
|
|
2210
|
+
var import_react9 = require("react");
|
|
2205
2211
|
var useLockBodyScroll = (locked) => {
|
|
2206
|
-
(0,
|
|
2212
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
2207
2213
|
if (locked) {
|
|
2208
2214
|
const originalStyle = window.getComputedStyle(document.body).overflow;
|
|
2209
2215
|
document.body.style.overflow = "hidden";
|
|
@@ -2216,9 +2222,9 @@ var useLockBodyScroll = (locked) => {
|
|
|
2216
2222
|
};
|
|
2217
2223
|
|
|
2218
2224
|
// src/hooks/useOnClickOutside/useOnClickOutside.ts
|
|
2219
|
-
var
|
|
2225
|
+
var import_react10 = require("react");
|
|
2220
2226
|
var useOnClickOutside = (ref, handler, eventTypes = ["mousedown", "touchend"]) => {
|
|
2221
|
-
(0,
|
|
2227
|
+
(0, import_react10.useEffect)(() => {
|
|
2222
2228
|
const listener = (event) => {
|
|
2223
2229
|
if (!ref.current || ref.current.contains(event.target)) {
|
|
2224
2230
|
return;
|
|
@@ -2248,7 +2254,7 @@ var useOnClickOutside = (ref, handler, eventTypes = ["mousedown", "touchend"]) =
|
|
|
2248
2254
|
var import_type_guards8 = require("@wistia/type-guards");
|
|
2249
2255
|
|
|
2250
2256
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
2251
|
-
var
|
|
2257
|
+
var import_react11 = require("react");
|
|
2252
2258
|
var import_throttle_debounce = require("throttle-debounce");
|
|
2253
2259
|
|
|
2254
2260
|
// src/private/helpers/isClient/isClient.ts
|
|
@@ -2256,11 +2262,11 @@ var isClient = () => typeof window !== "undefined" && typeof document !== "undef
|
|
|
2256
2262
|
|
|
2257
2263
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
2258
2264
|
var useWindowSize = (interval = 0) => {
|
|
2259
|
-
const [dimensions, setDimensions] = (0,
|
|
2265
|
+
const [dimensions, setDimensions] = (0, import_react11.useState)({
|
|
2260
2266
|
width: isClient() ? window.innerWidth : 0,
|
|
2261
2267
|
height: isClient() ? window.innerHeight : 0
|
|
2262
2268
|
});
|
|
2263
|
-
(0,
|
|
2269
|
+
(0, import_react11.useLayoutEffect)(() => {
|
|
2264
2270
|
const handleResize = (0, import_throttle_debounce.debounce)(
|
|
2265
2271
|
interval,
|
|
2266
2272
|
() => setDimensions({
|
|
@@ -2312,11 +2318,11 @@ var useActiveMq = () => {
|
|
|
2312
2318
|
};
|
|
2313
2319
|
|
|
2314
2320
|
// src/hooks/useToast/useToast.tsx
|
|
2315
|
-
var
|
|
2321
|
+
var import_react13 = require("react");
|
|
2316
2322
|
var import_sonner2 = require("sonner");
|
|
2317
2323
|
|
|
2318
2324
|
// src/private/components/Toast/Toast.tsx
|
|
2319
|
-
var
|
|
2325
|
+
var import_react12 = require("react");
|
|
2320
2326
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
2321
2327
|
var import_type_guards10 = require("@wistia/type-guards");
|
|
2322
2328
|
|
|
@@ -2554,8 +2560,8 @@ var StyledToast = import_styled_components16.default.div`
|
|
|
2554
2560
|
}
|
|
2555
2561
|
`;
|
|
2556
2562
|
var Action = ({ actionButton }) => {
|
|
2557
|
-
if ((0, import_type_guards10.isNotNil)(actionButton) && (0,
|
|
2558
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionWrapper, { children: (0,
|
|
2563
|
+
if ((0, import_type_guards10.isNotNil)(actionButton) && (0, import_react12.isValidElement)(actionButton)) {
|
|
2564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ActionWrapper, { children: (0, import_react12.cloneElement)(actionButton, {
|
|
2559
2565
|
variant: "soft",
|
|
2560
2566
|
// force Button variant
|
|
2561
2567
|
size: "sm"
|
|
@@ -2591,7 +2597,7 @@ Toast.displayName = "Toast";
|
|
|
2591
2597
|
// src/hooks/useToast/useToast.tsx
|
|
2592
2598
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2593
2599
|
var useToast = () => {
|
|
2594
|
-
return (0,
|
|
2600
|
+
return (0, import_react13.useCallback)(
|
|
2595
2601
|
({ message, action, colorScheme, icon, position = "bottom-left", duration = 3e3 }) => {
|
|
2596
2602
|
import_sonner2.toast.custom(
|
|
2597
2603
|
() => {
|
|
@@ -2613,7 +2619,7 @@ var useToast = () => {
|
|
|
2613
2619
|
};
|
|
2614
2620
|
|
|
2615
2621
|
// src/hooks/useFocusTrap/useFocusTrap.ts
|
|
2616
|
-
var
|
|
2622
|
+
var import_react14 = require("react");
|
|
2617
2623
|
var import_type_guards11 = require("@wistia/type-guards");
|
|
2618
2624
|
|
|
2619
2625
|
// src/hooks/useFocusTrap/helpers.ts
|
|
@@ -2763,9 +2769,9 @@ var isRef = (val) => {
|
|
|
2763
2769
|
return val !== null && typeof val === "object" && "current" in val;
|
|
2764
2770
|
};
|
|
2765
2771
|
var useFocusTrap = (active = true, options = {}) => {
|
|
2766
|
-
const ref = (0,
|
|
2767
|
-
const restoreAriaRef = (0,
|
|
2768
|
-
const setRef = (0,
|
|
2772
|
+
const ref = (0, import_react14.useRef)(null);
|
|
2773
|
+
const restoreAriaRef = (0, import_react14.useRef)(null);
|
|
2774
|
+
const setRef = (0, import_react14.useCallback)(
|
|
2769
2775
|
(node) => {
|
|
2770
2776
|
if (restoreAriaRef.current !== null) {
|
|
2771
2777
|
restoreAriaRef.current();
|
|
@@ -2827,7 +2833,7 @@ var useFocusTrap = (active = true, options = {}) => {
|
|
|
2827
2833
|
},
|
|
2828
2834
|
[active, options.focusSelector, options.disableAriaHider]
|
|
2829
2835
|
);
|
|
2830
|
-
(0,
|
|
2836
|
+
(0, import_react14.useEffect)(() => {
|
|
2831
2837
|
if (!active) {
|
|
2832
2838
|
return void 0;
|
|
2833
2839
|
}
|
|
@@ -2845,11 +2851,11 @@ var useFocusTrap = (active = true, options = {}) => {
|
|
|
2845
2851
|
};
|
|
2846
2852
|
|
|
2847
2853
|
// src/components/ActionButton/ActionButton.tsx
|
|
2848
|
-
var
|
|
2854
|
+
var import_react18 = require("react");
|
|
2849
2855
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
2850
2856
|
|
|
2851
2857
|
// src/components/Button/Button.tsx
|
|
2852
|
-
var
|
|
2858
|
+
var import_react17 = require("react");
|
|
2853
2859
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2854
2860
|
var import_type_guards15 = require("@wistia/type-guards");
|
|
2855
2861
|
|
|
@@ -6911,13 +6917,13 @@ var iconMap = {
|
|
|
6911
6917
|
|
|
6912
6918
|
// src/private/hooks/useResponsiveProp/useResponsiveProp.ts
|
|
6913
6919
|
var import_type_guards12 = require("@wistia/type-guards");
|
|
6914
|
-
var
|
|
6920
|
+
var import_react15 = require("react");
|
|
6915
6921
|
var isResponsiveObject = (values) => {
|
|
6916
6922
|
return typeof values === "object" && values !== null && !Array.isArray(values) && "base" in values;
|
|
6917
6923
|
};
|
|
6918
6924
|
var useResponsiveProp = (values) => {
|
|
6919
6925
|
const activeMediaQueries = useActiveMq();
|
|
6920
|
-
return (0,
|
|
6926
|
+
return (0, import_react15.useMemo)(() => {
|
|
6921
6927
|
if ((0, import_type_guards12.isRecord)(values) && isResponsiveObject(values)) {
|
|
6922
6928
|
const mq2 = activeMediaQueries.find((key) => key in values);
|
|
6923
6929
|
return (0, import_type_guards12.isNotUndefined)(mq2) && (0, import_type_guards12.isNotUndefined)(values[mq2]) ? values[mq2] : values.base;
|
|
@@ -6984,32 +6990,30 @@ var Icon = ({
|
|
|
6984
6990
|
Icon.displayName = "Icon";
|
|
6985
6991
|
|
|
6986
6992
|
// src/components/Link/Link.tsx
|
|
6987
|
-
var
|
|
6988
|
-
var import_type_guards14 = require("@wistia/type-guards");
|
|
6993
|
+
var import_react16 = require("react");
|
|
6989
6994
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
6990
6995
|
var import_react_router_dom = require("react-router-dom");
|
|
6996
|
+
var import_type_guards14 = require("@wistia/type-guards");
|
|
6991
6997
|
var import_jsx_runtime192 = require("react/jsx-runtime");
|
|
6992
6998
|
var generateHref = (href, type, disabled) => {
|
|
6993
6999
|
if (disabled || (0, import_type_guards14.isNil)(href)) {
|
|
6994
7000
|
return void 0;
|
|
6995
7001
|
}
|
|
6996
|
-
let
|
|
7002
|
+
let modifiedHref = href;
|
|
6997
7003
|
if (type === "phone") {
|
|
6998
|
-
|
|
7004
|
+
modifiedHref = `tel:${href}`;
|
|
6999
7005
|
}
|
|
7000
7006
|
if (type === "email") {
|
|
7001
|
-
|
|
7007
|
+
modifiedHref = `mailto:${href}`;
|
|
7002
7008
|
}
|
|
7003
|
-
return
|
|
7009
|
+
return modifiedHref;
|
|
7004
7010
|
};
|
|
7005
7011
|
var isButton = (props) => (0, import_type_guards14.isUndefined)(props.href);
|
|
7006
7012
|
var isLink = (props) => (0, import_type_guards14.isNotUndefined)(props.href);
|
|
7007
7013
|
var StyledLink = import_styled_components20.default.a`
|
|
7008
|
-
--link-icon-size: 14px;
|
|
7009
|
-
|
|
7010
7014
|
${({ href }) => (0, import_type_guards14.isNil)(href) && buttonResetCss};
|
|
7011
7015
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
7012
|
-
cursor: pointer;
|
|
7016
|
+
cursor: ${({ $disabled }) => $disabled ? "not-allowed" : "pointer"};
|
|
7013
7017
|
font-family: var(--wui-typography-family-default);
|
|
7014
7018
|
color: var(--wui-color-text-link);
|
|
7015
7019
|
text-decoration: ${({ $underline }) => $underline ? "underline" : "none"};
|
|
@@ -7019,12 +7023,12 @@ var StyledLink = import_styled_components20.default.a`
|
|
|
7019
7023
|
|
|
7020
7024
|
&& {
|
|
7021
7025
|
svg {
|
|
7022
|
-
width:
|
|
7023
|
-
height:
|
|
7026
|
+
width: 14px;
|
|
7027
|
+
height: 14px;
|
|
7024
7028
|
}
|
|
7025
7029
|
}
|
|
7026
7030
|
`;
|
|
7027
|
-
var Link = (0,
|
|
7031
|
+
var Link = (0, import_react16.forwardRef)(
|
|
7028
7032
|
({
|
|
7029
7033
|
beforeAction,
|
|
7030
7034
|
children,
|
|
@@ -7065,6 +7069,7 @@ var Link = (0, import_react15.forwardRef)(
|
|
|
7065
7069
|
};
|
|
7066
7070
|
const commonProps = {
|
|
7067
7071
|
$colorScheme: colorScheme,
|
|
7072
|
+
$disabled: disabled,
|
|
7068
7073
|
$underline: underline,
|
|
7069
7074
|
onClick: handleClick
|
|
7070
7075
|
};
|
|
@@ -7083,33 +7088,27 @@ var Link = (0, import_react15.forwardRef)(
|
|
|
7083
7088
|
}
|
|
7084
7089
|
if (isLink(props)) {
|
|
7085
7090
|
const externalLinkProps = type === "external" ? { target: "_blank", rel: "noopener noreferrer" } : null;
|
|
7091
|
+
const routerSpecificProps = shouldUseReactRouterLink ? {
|
|
7092
|
+
// TODO: Using 'any' here due to styled-components typing limitations with RouterLink
|
|
7093
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
|
|
7094
|
+
as: import_react_router_dom.Link,
|
|
7095
|
+
to: to ?? ""
|
|
7096
|
+
} : {
|
|
7097
|
+
as: "a",
|
|
7098
|
+
href: to
|
|
7099
|
+
};
|
|
7086
7100
|
const combinedProps = {
|
|
7087
7101
|
ref,
|
|
7088
7102
|
...props,
|
|
7089
7103
|
...commonProps,
|
|
7090
|
-
...externalLinkProps
|
|
7104
|
+
...externalLinkProps,
|
|
7105
|
+
...routerSpecificProps
|
|
7091
7106
|
};
|
|
7092
|
-
return
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
to: to ?? "",
|
|
7098
|
-
children
|
|
7099
|
-
}
|
|
7100
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
|
|
7101
|
-
StyledLink,
|
|
7102
|
-
{
|
|
7103
|
-
as: "a",
|
|
7104
|
-
...combinedProps,
|
|
7105
|
-
href: to,
|
|
7106
|
-
children: [
|
|
7107
|
-
leftIcon ?? null,
|
|
7108
|
-
children,
|
|
7109
|
-
rightIcon ?? null
|
|
7110
|
-
]
|
|
7111
|
-
}
|
|
7112
|
-
);
|
|
7107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(StyledLink, { ...combinedProps, children: [
|
|
7108
|
+
leftIcon ?? null,
|
|
7109
|
+
children,
|
|
7110
|
+
rightIcon ?? null
|
|
7111
|
+
] });
|
|
7113
7112
|
}
|
|
7114
7113
|
return null;
|
|
7115
7114
|
}
|
|
@@ -7170,7 +7169,7 @@ var ButtonContent = ({
|
|
|
7170
7169
|
)
|
|
7171
7170
|
] });
|
|
7172
7171
|
};
|
|
7173
|
-
var Button = (0,
|
|
7172
|
+
var Button = (0, import_react17.forwardRef)(
|
|
7174
7173
|
({
|
|
7175
7174
|
children,
|
|
7176
7175
|
forceState,
|
|
@@ -7349,7 +7348,7 @@ var StyledLabel = import_styled_components22.default.span`
|
|
|
7349
7348
|
grid-row: 2;
|
|
7350
7349
|
text-align: left;
|
|
7351
7350
|
`;
|
|
7352
|
-
var ActionButton = (0,
|
|
7351
|
+
var ActionButton = (0, import_react18.forwardRef)(
|
|
7353
7352
|
({
|
|
7354
7353
|
icon,
|
|
7355
7354
|
colorScheme = "default",
|
|
@@ -7393,7 +7392,7 @@ var ActionButton = (0, import_react17.forwardRef)(
|
|
|
7393
7392
|
ActionButton.displayName = "ActionButton";
|
|
7394
7393
|
|
|
7395
7394
|
// src/components/Avatar/Avatar.tsx
|
|
7396
|
-
var
|
|
7395
|
+
var import_react19 = require("react");
|
|
7397
7396
|
var import_type_guards18 = require("@wistia/type-guards");
|
|
7398
7397
|
var import_styled_components25 = __toESM(require("styled-components"));
|
|
7399
7398
|
|
|
@@ -7601,8 +7600,8 @@ var Avatar = ({
|
|
|
7601
7600
|
onImageLoad,
|
|
7602
7601
|
...props
|
|
7603
7602
|
}) => {
|
|
7604
|
-
const [imageLoadState, setImageLoadState] = (0,
|
|
7605
|
-
(0,
|
|
7603
|
+
const [imageLoadState, setImageLoadState] = (0, import_react19.useState)("loading");
|
|
7604
|
+
(0, import_react19.useEffect)(() => {
|
|
7606
7605
|
setImageLoadState("loading");
|
|
7607
7606
|
}, [imageUrl]);
|
|
7608
7607
|
const handleImageLoad = () => {
|
|
@@ -7614,7 +7613,7 @@ var Avatar = ({
|
|
|
7614
7613
|
onImageLoad?.({ state: "error", type: "initials" });
|
|
7615
7614
|
};
|
|
7616
7615
|
const avatarSize = heightAndWidth ?? avatarSizeMap[size];
|
|
7617
|
-
const avatarColor = (0,
|
|
7616
|
+
const avatarColor = (0, import_react19.useMemo)(() => chooseColorScheme(name), [name]);
|
|
7618
7617
|
return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
|
|
7619
7618
|
AvatarWrapper,
|
|
7620
7619
|
{
|
|
@@ -7641,7 +7640,7 @@ var Avatar = ({
|
|
|
7641
7640
|
Avatar.displayName = "Avatar";
|
|
7642
7641
|
|
|
7643
7642
|
// src/components/Badge/Badge.tsx
|
|
7644
|
-
var
|
|
7643
|
+
var import_react20 = require("react");
|
|
7645
7644
|
var import_styled_components26 = __toESM(require("styled-components"));
|
|
7646
7645
|
var import_type_guards19 = require("@wistia/type-guards");
|
|
7647
7646
|
var import_jsx_runtime198 = require("react/jsx-runtime");
|
|
@@ -7665,7 +7664,7 @@ var StyledBadge = import_styled_components26.default.div`
|
|
|
7665
7664
|
width: 12px;
|
|
7666
7665
|
}
|
|
7667
7666
|
`;
|
|
7668
|
-
var Badge = (0,
|
|
7667
|
+
var Badge = (0, import_react20.forwardRef)(
|
|
7669
7668
|
({ colorScheme = "inherit", label, icon, ...props }, ref) => {
|
|
7670
7669
|
const hasIcon = (0, import_type_guards19.isNotNil)(icon);
|
|
7671
7670
|
return /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(
|
|
@@ -7686,7 +7685,7 @@ var Badge = (0, import_react19.forwardRef)(
|
|
|
7686
7685
|
Badge.displayName = "Badge";
|
|
7687
7686
|
|
|
7688
7687
|
// src/components/Box/Box.tsx
|
|
7689
|
-
var
|
|
7688
|
+
var import_react21 = require("react");
|
|
7690
7689
|
var import_styled_components27 = __toESM(require("styled-components"));
|
|
7691
7690
|
var import_type_guards20 = require("@wistia/type-guards");
|
|
7692
7691
|
|
|
@@ -7795,13 +7794,13 @@ var StyledBoxComponent = import_styled_components27.default.div`
|
|
|
7795
7794
|
var wrapChildren = (children) => {
|
|
7796
7795
|
if ((0, import_type_guards20.isNotNil)(children)) {
|
|
7797
7796
|
if (typeof children === "object" && isDev) {
|
|
7798
|
-
return
|
|
7797
|
+
return import_react21.Children.map(children, (child) => {
|
|
7799
7798
|
if ((0, import_type_guards20.isNil)(child)) return null;
|
|
7800
7799
|
const elementParams = {};
|
|
7801
7800
|
if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
|
|
7802
7801
|
elementParams.hasBoxParent = true;
|
|
7803
7802
|
}
|
|
7804
|
-
return (0,
|
|
7803
|
+
return (0, import_react21.cloneElement)(child, elementParams);
|
|
7805
7804
|
});
|
|
7806
7805
|
}
|
|
7807
7806
|
return children;
|
|
@@ -7809,7 +7808,7 @@ var wrapChildren = (children) => {
|
|
|
7809
7808
|
return null;
|
|
7810
7809
|
};
|
|
7811
7810
|
var DEFAULT_ELEMENT = "div";
|
|
7812
|
-
var BoxComponent = (0,
|
|
7811
|
+
var BoxComponent = (0, import_react21.forwardRef)(
|
|
7813
7812
|
({
|
|
7814
7813
|
alignContent = "stretch",
|
|
7815
7814
|
alignItems = "flex-start",
|
|
@@ -7886,7 +7885,7 @@ BoxComponent.displayName = "Box";
|
|
|
7886
7885
|
var Box = makePolymorphic(BoxComponent);
|
|
7887
7886
|
|
|
7888
7887
|
// src/components/Breadcrumbs/Breadcrumbs.tsx
|
|
7889
|
-
var
|
|
7888
|
+
var import_react22 = require("react");
|
|
7890
7889
|
var import_styled_components28 = __toESM(require("styled-components"));
|
|
7891
7890
|
var import_jsx_runtime200 = require("react/jsx-runtime");
|
|
7892
7891
|
var StyledBreadcrumbs = import_styled_components28.default.nav`
|
|
@@ -7902,7 +7901,7 @@ var StyledBreadcrumbs = import_styled_components28.default.nav`
|
|
|
7902
7901
|
var BUFFER_WIDTH = 10;
|
|
7903
7902
|
var Breadcrumbs = ({ children, ...props }) => {
|
|
7904
7903
|
const { isXsAndDown } = useMq();
|
|
7905
|
-
let crumbs =
|
|
7904
|
+
let crumbs = import_react22.Children.toArray(children);
|
|
7906
7905
|
if (isXsAndDown) {
|
|
7907
7906
|
crumbs = crumbs.slice(-1);
|
|
7908
7907
|
}
|
|
@@ -8089,7 +8088,7 @@ var Card = ({
|
|
|
8089
8088
|
Card.displayName = "Card";
|
|
8090
8089
|
|
|
8091
8090
|
// src/components/Center/Center.tsx
|
|
8092
|
-
var
|
|
8091
|
+
var import_react23 = require("react");
|
|
8093
8092
|
var import_styled_components32 = __toESM(require("styled-components"));
|
|
8094
8093
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
8095
8094
|
var StyledCenter = import_styled_components32.default.div`
|
|
@@ -8104,7 +8103,7 @@ var StyledCenter = import_styled_components32.default.div`
|
|
|
8104
8103
|
align-items: center;
|
|
8105
8104
|
`}
|
|
8106
8105
|
`;
|
|
8107
|
-
var Center = (0,
|
|
8106
|
+
var Center = (0, import_react23.forwardRef)(
|
|
8108
8107
|
({ maxWidth = "100%", gutterWidth = "space-00", intrinsic = false, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(
|
|
8109
8108
|
StyledCenter,
|
|
8110
8109
|
{
|
|
@@ -8120,7 +8119,7 @@ var Center = (0, import_react22.forwardRef)(
|
|
|
8120
8119
|
Center.displayName = "Center";
|
|
8121
8120
|
|
|
8122
8121
|
// src/components/Checkbox/Checkbox.tsx
|
|
8123
|
-
var
|
|
8122
|
+
var import_react24 = require("react");
|
|
8124
8123
|
var import_styled_components36 = __toESM(require("styled-components"));
|
|
8125
8124
|
var import_type_guards25 = require("@wistia/type-guards");
|
|
8126
8125
|
|
|
@@ -8340,7 +8339,7 @@ var StyledHiddenCheckboxInput = import_styled_components36.default.input`
|
|
|
8340
8339
|
display: block;
|
|
8341
8340
|
}
|
|
8342
8341
|
`;
|
|
8343
|
-
var Checkbox = (0,
|
|
8342
|
+
var Checkbox = (0, import_react24.forwardRef)(
|
|
8344
8343
|
({
|
|
8345
8344
|
checked,
|
|
8346
8345
|
disabled = false,
|
|
@@ -8355,7 +8354,7 @@ var Checkbox = (0, import_react23.forwardRef)(
|
|
|
8355
8354
|
hideLabel = false,
|
|
8356
8355
|
...props
|
|
8357
8356
|
}, ref) => {
|
|
8358
|
-
const generatedId = (0,
|
|
8357
|
+
const generatedId = (0, import_react24.useId)();
|
|
8359
8358
|
const computedId = (0, import_type_guards25.isNonEmptyString)(id) ? id : `wistia-ui-checkbox-${generatedId}`;
|
|
8360
8359
|
return /* @__PURE__ */ (0, import_jsx_runtime208.jsxs)(StyledCheckboxWrapper, { disabled, children: [
|
|
8361
8360
|
/* @__PURE__ */ (0, import_jsx_runtime208.jsx)(
|
|
@@ -8398,9 +8397,9 @@ var Checkbox = (0, import_react23.forwardRef)(
|
|
|
8398
8397
|
Checkbox.displayName = "Checkbox";
|
|
8399
8398
|
|
|
8400
8399
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
8401
|
-
var
|
|
8400
|
+
var import_react25 = require("react");
|
|
8402
8401
|
var ClickRegion = ({ children, targetRef }) => {
|
|
8403
|
-
(0,
|
|
8402
|
+
(0, import_react25.useEffect)(() => {
|
|
8404
8403
|
if (targetRef.current && targetRef.current.tagName === "A") {
|
|
8405
8404
|
targetRef.current.setAttribute("data-click-region-target-link", "");
|
|
8406
8405
|
} else if (targetRef.current && targetRef.current.tagName === "BUTTON") {
|
|
@@ -8408,7 +8407,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8408
8407
|
} else {
|
|
8409
8408
|
}
|
|
8410
8409
|
}, [targetRef]);
|
|
8411
|
-
const handleClick = (0,
|
|
8410
|
+
const handleClick = (0, import_react25.useCallback)(
|
|
8412
8411
|
(event) => {
|
|
8413
8412
|
const node = targetRef.current;
|
|
8414
8413
|
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")) {
|
|
@@ -8425,7 +8424,7 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8425
8424
|
},
|
|
8426
8425
|
[targetRef]
|
|
8427
8426
|
);
|
|
8428
|
-
return (0,
|
|
8427
|
+
return (0, import_react25.cloneElement)(import_react25.Children.only(children), {
|
|
8429
8428
|
"data-click-region": true,
|
|
8430
8429
|
onClick: handleClick
|
|
8431
8430
|
});
|
|
@@ -8458,11 +8457,11 @@ var Collapsible = ({
|
|
|
8458
8457
|
Collapsible.displayName = "Collapsible";
|
|
8459
8458
|
|
|
8460
8459
|
// src/components/Collapsible/CollapsibleTrigger.tsx
|
|
8461
|
-
var
|
|
8460
|
+
var import_react26 = require("react");
|
|
8462
8461
|
var import_react_collapsible2 = require("@radix-ui/react-collapsible");
|
|
8463
8462
|
var import_jsx_runtime210 = require("react/jsx-runtime");
|
|
8464
8463
|
var CollapsibleTrigger = ({ children }) => {
|
|
8465
|
-
|
|
8464
|
+
import_react26.Children.only(children);
|
|
8466
8465
|
return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(import_react_collapsible2.Trigger, { asChild: true, children });
|
|
8467
8466
|
};
|
|
8468
8467
|
|
|
@@ -8489,7 +8488,7 @@ var import_styled_components40 = __toESM(require("styled-components"));
|
|
|
8489
8488
|
var import_type_guards29 = require("@wistia/type-guards");
|
|
8490
8489
|
|
|
8491
8490
|
// src/components/Heading/Heading.tsx
|
|
8492
|
-
var
|
|
8491
|
+
var import_react27 = require("react");
|
|
8493
8492
|
var import_styled_components39 = __toESM(require("styled-components"));
|
|
8494
8493
|
var import_type_guards28 = require("@wistia/type-guards");
|
|
8495
8494
|
var import_jsx_runtime212 = require("react/jsx-runtime");
|
|
@@ -8585,7 +8584,7 @@ var variantElementMap = {
|
|
|
8585
8584
|
heading5: "h5",
|
|
8586
8585
|
heading6: "h6"
|
|
8587
8586
|
};
|
|
8588
|
-
var HeadingComponent = (0,
|
|
8587
|
+
var HeadingComponent = (0, import_react27.forwardRef)(
|
|
8589
8588
|
({
|
|
8590
8589
|
align = "left",
|
|
8591
8590
|
colorScheme = "inherit",
|
|
@@ -8749,7 +8748,7 @@ DataCards.displayName = "DataCards";
|
|
|
8749
8748
|
var import_styled_components43 = __toESM(require("styled-components"));
|
|
8750
8749
|
|
|
8751
8750
|
// src/components/Text/Text.tsx
|
|
8752
|
-
var
|
|
8751
|
+
var import_react28 = require("react");
|
|
8753
8752
|
var import_styled_components42 = __toESM(require("styled-components"));
|
|
8754
8753
|
var import_type_guards30 = require("@wistia/type-guards");
|
|
8755
8754
|
var import_jsx_runtime215 = require("react/jsx-runtime");
|
|
@@ -8924,7 +8923,7 @@ var StyledText = import_styled_components42.default.div`
|
|
|
8924
8923
|
}
|
|
8925
8924
|
`}
|
|
8926
8925
|
`;
|
|
8927
|
-
var TextComponent = (0,
|
|
8926
|
+
var TextComponent = (0, import_react28.forwardRef)(
|
|
8928
8927
|
({
|
|
8929
8928
|
align = "left",
|
|
8930
8929
|
colorScheme = "inherit",
|
|
@@ -9037,7 +9036,7 @@ Divider.displayName = "Divider";
|
|
|
9037
9036
|
|
|
9038
9037
|
// src/components/EditableHeading/EditableHeading.tsx
|
|
9039
9038
|
var import_styled_components48 = __toESM(require("styled-components"));
|
|
9040
|
-
var
|
|
9039
|
+
var import_react30 = require("react");
|
|
9041
9040
|
|
|
9042
9041
|
// src/components/Tooltip/Tooltip.tsx
|
|
9043
9042
|
var import_react_tooltip2 = require("@radix-ui/react-tooltip");
|
|
@@ -9135,7 +9134,7 @@ var Tooltip = ({
|
|
|
9135
9134
|
Tooltip.displayName = "Tooltip";
|
|
9136
9135
|
|
|
9137
9136
|
// src/components/Input/Input.tsx
|
|
9138
|
-
var
|
|
9137
|
+
var import_react29 = require("react");
|
|
9139
9138
|
var import_styled_components47 = __toESM(require("styled-components"));
|
|
9140
9139
|
var import_type_guards31 = require("@wistia/type-guards");
|
|
9141
9140
|
|
|
@@ -9270,7 +9269,7 @@ var StyledInputContainer = import_styled_components47.default.div`
|
|
|
9270
9269
|
padding-right: 32px;
|
|
9271
9270
|
}
|
|
9272
9271
|
`;
|
|
9273
|
-
var Input = (0,
|
|
9272
|
+
var Input = (0, import_react29.forwardRef)(
|
|
9274
9273
|
({
|
|
9275
9274
|
fullWidth = true,
|
|
9276
9275
|
monospace = false,
|
|
@@ -9280,7 +9279,7 @@ var Input = (0, import_react28.forwardRef)(
|
|
|
9280
9279
|
rightIcon,
|
|
9281
9280
|
...props
|
|
9282
9281
|
}, externalRef) => {
|
|
9283
|
-
const internalRef = (0,
|
|
9282
|
+
const internalRef = (0, import_react29.useRef)();
|
|
9284
9283
|
const ref = (
|
|
9285
9284
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
9286
9285
|
(0, import_type_guards31.isNotNil)(externalRef) && (0, import_type_guards31.isRecord)(externalRef) && "current" in externalRef ? externalRef : internalRef
|
|
@@ -9290,14 +9289,14 @@ var Input = (0, import_react28.forwardRef)(
|
|
|
9290
9289
|
leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(Icon, { type: "search" });
|
|
9291
9290
|
}
|
|
9292
9291
|
if ((0, import_type_guards31.isNotNil)(leftIconToDisplay)) {
|
|
9293
|
-
leftIconToDisplay = (0,
|
|
9292
|
+
leftIconToDisplay = (0, import_react29.cloneElement)(leftIconToDisplay, {
|
|
9294
9293
|
size: "md",
|
|
9295
9294
|
className: "wui-input-left-icon"
|
|
9296
9295
|
});
|
|
9297
9296
|
}
|
|
9298
9297
|
let rightIconToDisplay = rightIcon;
|
|
9299
9298
|
if ((0, import_type_guards31.isNotNil)(rightIconToDisplay)) {
|
|
9300
|
-
rightIconToDisplay = (0,
|
|
9299
|
+
rightIconToDisplay = (0, import_react29.cloneElement)(rightIconToDisplay, {
|
|
9301
9300
|
size: "md",
|
|
9302
9301
|
className: "wui-input-right-icon"
|
|
9303
9302
|
});
|
|
@@ -9389,11 +9388,11 @@ var EditableHeading = ({
|
|
|
9389
9388
|
__forceEditing = false,
|
|
9390
9389
|
editingDisabled = false
|
|
9391
9390
|
}) => {
|
|
9392
|
-
const [isEditing, setIsEditing] = (0,
|
|
9393
|
-
const [value, setValue] = (0,
|
|
9394
|
-
const [previousValue, setPreviousValue] = (0,
|
|
9395
|
-
const [headingHeight, setHeadingHeight] = (0,
|
|
9396
|
-
const headingRef = (0,
|
|
9391
|
+
const [isEditing, setIsEditing] = (0, import_react30.useState)(false);
|
|
9392
|
+
const [value, setValue] = (0, import_react30.useState)(children);
|
|
9393
|
+
const [previousValue, setPreviousValue] = (0, import_react30.useState)(children);
|
|
9394
|
+
const [headingHeight, setHeadingHeight] = (0, import_react30.useState)("60");
|
|
9395
|
+
const headingRef = (0, import_react30.useRef)(null);
|
|
9397
9396
|
const handleSetEditing = (editing) => {
|
|
9398
9397
|
if (editingDisabled) return;
|
|
9399
9398
|
if (editing && headingRef.current) {
|
|
@@ -9472,12 +9471,12 @@ var EditableHeading = ({
|
|
|
9472
9471
|
};
|
|
9473
9472
|
|
|
9474
9473
|
// src/components/Form/Form.tsx
|
|
9475
|
-
var
|
|
9474
|
+
var import_react32 = require("react");
|
|
9476
9475
|
var import_styled_components50 = __toESM(require("styled-components"));
|
|
9477
9476
|
var import_type_guards32 = require("@wistia/type-guards");
|
|
9478
9477
|
|
|
9479
9478
|
// src/components/Stack/Stack.tsx
|
|
9480
|
-
var
|
|
9479
|
+
var import_react31 = require("react");
|
|
9481
9480
|
var import_styled_components49 = __toESM(require("styled-components"));
|
|
9482
9481
|
var import_jsx_runtime221 = require("react/jsx-runtime");
|
|
9483
9482
|
var DEFAULT_ELEMENT4 = "div";
|
|
@@ -9487,7 +9486,7 @@ var StyledStack = import_styled_components49.default.div`
|
|
|
9487
9486
|
gap: ${({ $gap }) => `var(--wui-${$gap})`};
|
|
9488
9487
|
align-items: ${({ $alignItems }) => $alignItems};
|
|
9489
9488
|
`;
|
|
9490
|
-
var StackComponent = (0,
|
|
9489
|
+
var StackComponent = (0, import_react31.forwardRef)(
|
|
9491
9490
|
({ renderAs, direction = "vertical", gap = "space-02", alignItems = "stretch", ...props }, ref) => {
|
|
9492
9491
|
const responsiveGap = useResponsiveProp(gap);
|
|
9493
9492
|
const responsiveDirection = useResponsiveProp(direction);
|
|
@@ -9516,7 +9515,7 @@ var StyledForm = import_styled_components50.default.form`
|
|
|
9516
9515
|
max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
|
|
9517
9516
|
align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
|
|
9518
9517
|
`;
|
|
9519
|
-
var FormContext = (0,
|
|
9518
|
+
var FormContext = (0, import_react32.createContext)({
|
|
9520
9519
|
values: {},
|
|
9521
9520
|
errors: {},
|
|
9522
9521
|
hasSubmitted: false,
|
|
@@ -9532,11 +9531,11 @@ var FormComponent = ({
|
|
|
9532
9531
|
fullWidth = false,
|
|
9533
9532
|
...props
|
|
9534
9533
|
}, forwardedRef) => {
|
|
9535
|
-
const [errors, setErrors] = (0,
|
|
9536
|
-
const [hasSubmitted, setHasSubmitted] = (0,
|
|
9537
|
-
const innerRef = (0,
|
|
9534
|
+
const [errors, setErrors] = (0, import_react32.useState)({});
|
|
9535
|
+
const [hasSubmitted, setHasSubmitted] = (0, import_react32.useState)(false);
|
|
9536
|
+
const innerRef = (0, import_react32.useRef)();
|
|
9538
9537
|
const ref = forwardedRef ?? innerRef;
|
|
9539
|
-
const autoId = (0,
|
|
9538
|
+
const autoId = (0, import_react32.useId)();
|
|
9540
9539
|
const id = props.id ?? autoId;
|
|
9541
9540
|
const handleValidate = (nextFormData) => {
|
|
9542
9541
|
const nextData = Object.fromEntries(nextFormData.entries());
|
|
@@ -9578,7 +9577,7 @@ var FormComponent = ({
|
|
|
9578
9577
|
void action(null);
|
|
9579
9578
|
}
|
|
9580
9579
|
};
|
|
9581
|
-
const context = (0,
|
|
9580
|
+
const context = (0, import_react32.useMemo)(() => {
|
|
9582
9581
|
return {
|
|
9583
9582
|
values,
|
|
9584
9583
|
errors,
|
|
@@ -9607,15 +9606,15 @@ var FormComponent = ({
|
|
|
9607
9606
|
);
|
|
9608
9607
|
};
|
|
9609
9608
|
FormComponent.displayName = "Form";
|
|
9610
|
-
var Form = (0,
|
|
9609
|
+
var Form = (0, import_react32.forwardRef)(FormComponent);
|
|
9611
9610
|
|
|
9612
9611
|
// src/components/Form/useFormState.tsx
|
|
9613
|
-
var
|
|
9612
|
+
var import_react33 = require("react");
|
|
9614
9613
|
var useFormState = (action, initialData = {}) => {
|
|
9615
|
-
const [data, setData] = (0,
|
|
9616
|
-
const [isPending, setIsPending] = (0,
|
|
9617
|
-
const [error, setError] = (0,
|
|
9618
|
-
const formAction = (0,
|
|
9614
|
+
const [data, setData] = (0, import_react33.useState)(initialData);
|
|
9615
|
+
const [isPending, setIsPending] = (0, import_react33.useState)(false);
|
|
9616
|
+
const [error, setError] = (0, import_react33.useState)(null);
|
|
9617
|
+
const formAction = (0, import_react33.useCallback)(
|
|
9619
9618
|
async (nextFormData) => {
|
|
9620
9619
|
if (nextFormData === null) {
|
|
9621
9620
|
setData(initialData);
|
|
@@ -9646,15 +9645,15 @@ var useFormState = (action, initialData = {}) => {
|
|
|
9646
9645
|
};
|
|
9647
9646
|
|
|
9648
9647
|
// src/components/Form/FormErrorSummary.tsx
|
|
9649
|
-
var
|
|
9648
|
+
var import_react34 = require("react");
|
|
9650
9649
|
var import_type_guards33 = require("@wistia/type-guards");
|
|
9651
9650
|
var import_jsx_runtime223 = require("react/jsx-runtime");
|
|
9652
9651
|
var ErrorItem = ({ name, error, formId }) => {
|
|
9653
9652
|
return /* @__PURE__ */ (0, import_jsx_runtime223.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(Link, { href: `#${formId}-${name}`, children: error }) }, name);
|
|
9654
9653
|
};
|
|
9655
9654
|
var FormErrorSummary = ({ description }) => {
|
|
9656
|
-
const ref = (0,
|
|
9657
|
-
const { formId, errors, hasSubmitted } = (0,
|
|
9655
|
+
const ref = (0, import_react34.useRef)(null);
|
|
9656
|
+
const { formId, errors, hasSubmitted } = (0, import_react34.useContext)(FormContext);
|
|
9658
9657
|
const isValid = Object.keys(errors).length === 0;
|
|
9659
9658
|
if (isValid || !hasSubmitted) {
|
|
9660
9659
|
return null;
|
|
@@ -9684,7 +9683,7 @@ var FormErrorSummary = ({ description }) => {
|
|
|
9684
9683
|
};
|
|
9685
9684
|
|
|
9686
9685
|
// src/components/FormField/FormField.tsx
|
|
9687
|
-
var
|
|
9686
|
+
var import_react37 = require("react");
|
|
9688
9687
|
var import_styled_components53 = __toESM(require("styled-components"));
|
|
9689
9688
|
var import_type_guards34 = require("@wistia/type-guards");
|
|
9690
9689
|
|
|
@@ -9749,11 +9748,11 @@ var Label = ({
|
|
|
9749
9748
|
Label.displayName = "Label";
|
|
9750
9749
|
|
|
9751
9750
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9752
|
-
var
|
|
9751
|
+
var import_react36 = require("react");
|
|
9753
9752
|
|
|
9754
9753
|
// src/components/FormGroup/FormGroup.tsx
|
|
9755
9754
|
var import_styled_components52 = __toESM(require("styled-components"));
|
|
9756
|
-
var
|
|
9755
|
+
var import_react35 = require("react");
|
|
9757
9756
|
var import_jsx_runtime225 = require("react/jsx-runtime");
|
|
9758
9757
|
var StyledFieldset = import_styled_components52.default.fieldset`
|
|
9759
9758
|
border: 0;
|
|
@@ -9762,7 +9761,7 @@ var StyledLegend = import_styled_components52.default.legend`
|
|
|
9762
9761
|
margin-bottom: var(--space-01);
|
|
9763
9762
|
`;
|
|
9764
9763
|
var FormGroup = ({ children, label, ...props }) => {
|
|
9765
|
-
const ref = (0,
|
|
9764
|
+
const ref = (0, import_react35.useRef)();
|
|
9766
9765
|
return /* @__PURE__ */ (0, import_jsx_runtime225.jsxs)(
|
|
9767
9766
|
Stack,
|
|
9768
9767
|
{
|
|
@@ -9787,7 +9786,7 @@ FormGroup.displayName = "FormGroup";
|
|
|
9787
9786
|
|
|
9788
9787
|
// src/components/FormGroup/CheckboxGroup.tsx
|
|
9789
9788
|
var import_jsx_runtime226 = require("react/jsx-runtime");
|
|
9790
|
-
var CheckboxGroupContext = (0,
|
|
9789
|
+
var CheckboxGroupContext = (0, import_react36.createContext)(null);
|
|
9791
9790
|
var CheckboxGroup = ({
|
|
9792
9791
|
children,
|
|
9793
9792
|
name,
|
|
@@ -9795,7 +9794,7 @@ var CheckboxGroup = ({
|
|
|
9795
9794
|
value,
|
|
9796
9795
|
...props
|
|
9797
9796
|
}) => {
|
|
9798
|
-
const context = (0,
|
|
9797
|
+
const context = (0, import_react36.useMemo)(() => {
|
|
9799
9798
|
return {
|
|
9800
9799
|
name,
|
|
9801
9800
|
onChange
|
|
@@ -9880,8 +9879,8 @@ var FormField = ({
|
|
|
9880
9879
|
value,
|
|
9881
9880
|
...props
|
|
9882
9881
|
}) => {
|
|
9883
|
-
const formState = (0,
|
|
9884
|
-
const checkboxGroup = (0,
|
|
9882
|
+
const formState = (0, import_react37.useContext)(FormContext);
|
|
9883
|
+
const checkboxGroup = (0, import_react37.useContext)(CheckboxGroupContext);
|
|
9885
9884
|
const defaultValue = formState.values[name];
|
|
9886
9885
|
const isIntegratedLabel = children.type === Checkbox;
|
|
9887
9886
|
const computedId = id ?? `${formState.formId}-${name}`;
|
|
@@ -9919,7 +9918,7 @@ var FormField = ({
|
|
|
9919
9918
|
"aria-invalid": (0, import_type_guards34.isNotNil)(error)
|
|
9920
9919
|
};
|
|
9921
9920
|
}
|
|
9922
|
-
|
|
9921
|
+
import_react37.Children.only(children);
|
|
9923
9922
|
return /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(
|
|
9924
9923
|
StyledFormField,
|
|
9925
9924
|
{
|
|
@@ -9928,7 +9927,7 @@ var FormField = ({
|
|
|
9928
9927
|
children: [
|
|
9929
9928
|
!isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(Label, { htmlFor: computedId, children: label }),
|
|
9930
9929
|
(0, import_type_guards34.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
|
|
9931
|
-
(0,
|
|
9930
|
+
(0, import_react37.cloneElement)(children, childProps),
|
|
9932
9931
|
(0, import_type_guards34.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(import_jsx_runtime227.Fragment, { children: [
|
|
9933
9932
|
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)("div", {}),
|
|
9934
9933
|
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
@@ -9946,9 +9945,9 @@ var FormField = ({
|
|
|
9946
9945
|
FormField.displayName = "FormField";
|
|
9947
9946
|
|
|
9948
9947
|
// src/components/FormGroup/RadioGroup.tsx
|
|
9949
|
-
var
|
|
9948
|
+
var import_react38 = require("react");
|
|
9950
9949
|
var import_jsx_runtime228 = require("react/jsx-runtime");
|
|
9951
|
-
var RadioGroupContext = (0,
|
|
9950
|
+
var RadioGroupContext = (0, import_react38.createContext)(null);
|
|
9952
9951
|
var RadioGroup = ({
|
|
9953
9952
|
children,
|
|
9954
9953
|
name,
|
|
@@ -9956,7 +9955,7 @@ var RadioGroup = ({
|
|
|
9956
9955
|
value,
|
|
9957
9956
|
...props
|
|
9958
9957
|
}) => {
|
|
9959
|
-
const context = (0,
|
|
9958
|
+
const context = (0, import_react38.useMemo)(() => {
|
|
9960
9959
|
return {
|
|
9961
9960
|
name,
|
|
9962
9961
|
onChange
|
|
@@ -9967,7 +9966,7 @@ var RadioGroup = ({
|
|
|
9967
9966
|
RadioGroup.displayName = "RadioGroup";
|
|
9968
9967
|
|
|
9969
9968
|
// src/components/IconButton/IconButton.tsx
|
|
9970
|
-
var
|
|
9969
|
+
var import_react39 = require("react");
|
|
9971
9970
|
var import_styled_components54 = __toESM(require("styled-components"));
|
|
9972
9971
|
var import_jsx_runtime229 = require("react/jsx-runtime");
|
|
9973
9972
|
var StyledButton2 = (0, import_styled_components54.default)(Button)`
|
|
@@ -9984,7 +9983,7 @@ var StyledButton2 = (0, import_styled_components54.default)(Button)`
|
|
|
9984
9983
|
align-items: center;
|
|
9985
9984
|
line-height: 1;
|
|
9986
9985
|
`;
|
|
9987
|
-
var IconButton = (0,
|
|
9986
|
+
var IconButton = (0, import_react39.forwardRef)(
|
|
9988
9987
|
({ children, label, size = "md", ...props }, ref) => {
|
|
9989
9988
|
const responsiveSize = useResponsiveProp(size);
|
|
9990
9989
|
return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(
|
|
@@ -9995,7 +9994,7 @@ var IconButton = (0, import_react38.forwardRef)(
|
|
|
9995
9994
|
"aria-label": label,
|
|
9996
9995
|
"data-wistia-ui-icon-button": true,
|
|
9997
9996
|
size: responsiveSize,
|
|
9998
|
-
children: (0,
|
|
9997
|
+
children: (0, import_react39.cloneElement)(import_react39.Children.only(children), {
|
|
9999
9998
|
size: responsiveSize
|
|
10000
9999
|
})
|
|
10001
10000
|
}
|
|
@@ -10006,7 +10005,7 @@ IconButton.displayName = "IconButton";
|
|
|
10006
10005
|
|
|
10007
10006
|
// src/components/InputClickToCopy/InputClickToCopy.tsx
|
|
10008
10007
|
var import_styled_components55 = __toESM(require("styled-components"));
|
|
10009
|
-
var
|
|
10008
|
+
var import_react40 = require("react");
|
|
10010
10009
|
var import_type_guards35 = require("@wistia/type-guards");
|
|
10011
10010
|
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
10012
10011
|
var StyledInput2 = (0, import_styled_components55.default)(Input)`
|
|
@@ -10019,10 +10018,10 @@ var StyledInput2 = (0, import_styled_components55.default)(Input)`
|
|
|
10019
10018
|
}
|
|
10020
10019
|
`;
|
|
10021
10020
|
var COPY_SUCCESS_DURATION = 2e3;
|
|
10022
|
-
var InputClickToCopy = (0,
|
|
10021
|
+
var InputClickToCopy = (0, import_react40.forwardRef)(
|
|
10023
10022
|
({ value, onCopy, ...props }, ref) => {
|
|
10024
|
-
const [isCopied, setIsCopied] = (0,
|
|
10025
|
-
(0,
|
|
10023
|
+
const [isCopied, setIsCopied] = (0, import_react40.useState)(false);
|
|
10024
|
+
(0, import_react40.useEffect)(() => {
|
|
10026
10025
|
if (isCopied) {
|
|
10027
10026
|
const timeout = setTimeout(() => {
|
|
10028
10027
|
setIsCopied(false);
|
|
@@ -10072,12 +10071,12 @@ InputClickToCopy.displayName = "InputClickToCopy";
|
|
|
10072
10071
|
var import_styled_components56 = __toESM(require("styled-components"));
|
|
10073
10072
|
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
10074
10073
|
var import_type_guards36 = require("@wistia/type-guards");
|
|
10075
|
-
var
|
|
10074
|
+
var import_react42 = require("react");
|
|
10076
10075
|
|
|
10077
10076
|
// src/components/Menu/MenuContext.tsx
|
|
10078
|
-
var
|
|
10079
|
-
var MenuContext = (0,
|
|
10080
|
-
var useMenuContext = () => (0,
|
|
10077
|
+
var import_react41 = require("react");
|
|
10078
|
+
var MenuContext = (0, import_react41.createContext)({ compact: false });
|
|
10079
|
+
var useMenuContext = () => (0, import_react41.useContext)(MenuContext);
|
|
10081
10080
|
|
|
10082
10081
|
// src/components/Menu/Menu.tsx
|
|
10083
10082
|
var import_jsx_runtime231 = require("react/jsx-runtime");
|
|
@@ -10181,7 +10180,7 @@ var Menu = ({
|
|
|
10181
10180
|
onInteractOutside,
|
|
10182
10181
|
...props
|
|
10183
10182
|
}) => {
|
|
10184
|
-
const contextValue = (0,
|
|
10183
|
+
const contextValue = (0, import_react42.useMemo)(() => ({ compact }), [compact]);
|
|
10185
10184
|
let controlProps = {
|
|
10186
10185
|
...(0, import_type_guards36.isNotNil)(onOpenChange) && (0, import_type_guards36.isNotNil)(isOpen) ? { open: isOpen, onOpenChange } : {}
|
|
10187
10186
|
};
|
|
@@ -10255,13 +10254,13 @@ var MenuLabel = ({ children, ...props }) => {
|
|
|
10255
10254
|
MenuLabel.displayName = "MenuLabel";
|
|
10256
10255
|
|
|
10257
10256
|
// src/components/Menu/SubMenu.tsx
|
|
10258
|
-
var
|
|
10257
|
+
var import_react44 = require("react");
|
|
10259
10258
|
var import_styled_components60 = __toESM(require("styled-components"));
|
|
10260
10259
|
var import_react_dropdown_menu3 = require("@radix-ui/react-dropdown-menu");
|
|
10261
10260
|
var import_type_guards38 = require("@wistia/type-guards");
|
|
10262
10261
|
|
|
10263
10262
|
// src/components/Menu/MenuItemButton.tsx
|
|
10264
|
-
var
|
|
10263
|
+
var import_react43 = require("react");
|
|
10265
10264
|
var import_styled_components58 = __toESM(require("styled-components"));
|
|
10266
10265
|
var import_type_guards37 = require("@wistia/type-guards");
|
|
10267
10266
|
var import_jsx_runtime233 = require("react/jsx-runtime");
|
|
@@ -10338,7 +10337,7 @@ var StyledBadgeContainer = import_styled_components58.default.div`
|
|
|
10338
10337
|
font-size: var(--wui-typography-label-4-size);
|
|
10339
10338
|
color: var(--wui-color-text-secondary);
|
|
10340
10339
|
`;
|
|
10341
|
-
var MenuItemButton = (0,
|
|
10340
|
+
var MenuItemButton = (0, import_react43.forwardRef)(({ children, appearance, command, icon, ...props }, ref) => {
|
|
10342
10341
|
let { colorScheme, badge } = props;
|
|
10343
10342
|
if (appearance === "dangerous") {
|
|
10344
10343
|
if ((0, import_type_guards37.isNotUndefined)(colorScheme)) {
|
|
@@ -10434,7 +10433,7 @@ var SubMenu = ({
|
|
|
10434
10433
|
...props
|
|
10435
10434
|
}) => {
|
|
10436
10435
|
const { isSmAndUp } = useMq();
|
|
10437
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
10436
|
+
const [isExpanded, setIsExpanded] = (0, import_react44.useState)(false);
|
|
10438
10437
|
const { compact } = useMenuContext();
|
|
10439
10438
|
return isSmAndUp ? /* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(import_react_dropdown_menu3.DropdownMenuSub, { onOpenChange, children: [
|
|
10440
10439
|
/* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(SubMenuTrigger, { ...props, children: [
|
|
@@ -10463,10 +10462,10 @@ var SubMenu = ({
|
|
|
10463
10462
|
SubMenu.displayName = "SubMenu";
|
|
10464
10463
|
|
|
10465
10464
|
// src/components/Menu/MenuItem.tsx
|
|
10466
|
-
var
|
|
10465
|
+
var import_react45 = require("react");
|
|
10467
10466
|
var import_react_dropdown_menu4 = require("@radix-ui/react-dropdown-menu");
|
|
10468
10467
|
var import_jsx_runtime236 = require("react/jsx-runtime");
|
|
10469
|
-
var MenuItem = (0,
|
|
10468
|
+
var MenuItem = (0, import_react45.forwardRef)(
|
|
10470
10469
|
({ onSelect = () => null, ...props }, ref) => {
|
|
10471
10470
|
return /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
|
|
10472
10471
|
import_react_dropdown_menu4.DropdownMenuItem,
|
|
@@ -10618,7 +10617,7 @@ var CheckboxMenuItem = ({
|
|
|
10618
10617
|
CheckboxMenuItem.displayName = "CheckboxMenuItem";
|
|
10619
10618
|
|
|
10620
10619
|
// src/components/Modal/Modal.tsx
|
|
10621
|
-
var
|
|
10620
|
+
var import_react49 = require("react");
|
|
10622
10621
|
var import_styled_components65 = __toESM(require("styled-components"));
|
|
10623
10622
|
var import_react_dialog4 = require("@radix-ui/react-dialog");
|
|
10624
10623
|
var import_type_guards41 = require("@wistia/type-guards");
|
|
@@ -10678,19 +10677,19 @@ var ModalHeader = ({
|
|
|
10678
10677
|
};
|
|
10679
10678
|
|
|
10680
10679
|
// src/components/Modal/ModalContent.tsx
|
|
10681
|
-
var
|
|
10680
|
+
var import_react47 = require("react");
|
|
10682
10681
|
var import_styled_components63 = __toESM(require("styled-components"));
|
|
10683
10682
|
var import_react_dialog3 = require("@radix-ui/react-dialog");
|
|
10684
10683
|
|
|
10685
10684
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
10686
|
-
var
|
|
10685
|
+
var import_react46 = require("react");
|
|
10687
10686
|
var import_type_guards40 = require("@wistia/type-guards");
|
|
10688
10687
|
var useFocusRestore = () => {
|
|
10689
|
-
const previouslyFocusedRef = (0,
|
|
10690
|
-
(0,
|
|
10688
|
+
const previouslyFocusedRef = (0, import_react46.useRef)(null);
|
|
10689
|
+
(0, import_react46.useEffect)(() => {
|
|
10691
10690
|
previouslyFocusedRef.current = document.activeElement;
|
|
10692
10691
|
}, []);
|
|
10693
|
-
(0,
|
|
10692
|
+
(0, import_react46.useEffect)(() => {
|
|
10694
10693
|
return () => {
|
|
10695
10694
|
if ((0, import_type_guards40.isNotNil)(previouslyFocusedRef.current)) {
|
|
10696
10695
|
setTimeout(() => {
|
|
@@ -10744,7 +10743,7 @@ var StyledModalContent = (0, import_styled_components63.default)(import_react_di
|
|
|
10744
10743
|
}
|
|
10745
10744
|
}
|
|
10746
10745
|
`;
|
|
10747
|
-
var ModalContent = (0,
|
|
10746
|
+
var ModalContent = (0, import_react47.forwardRef)(
|
|
10748
10747
|
({ fullHeight, width, children, ...props }, ref) => {
|
|
10749
10748
|
useFocusRestore();
|
|
10750
10749
|
return /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
|
|
@@ -10762,7 +10761,7 @@ var ModalContent = (0, import_react46.forwardRef)(
|
|
|
10762
10761
|
);
|
|
10763
10762
|
|
|
10764
10763
|
// src/private/components/Backdrop/Backdrop.tsx
|
|
10765
|
-
var
|
|
10764
|
+
var import_react48 = require("react");
|
|
10766
10765
|
var import_styled_components64 = __toESM(require("styled-components"));
|
|
10767
10766
|
var import_jsx_runtime243 = require("react/jsx-runtime");
|
|
10768
10767
|
var backdropAnimationDuration = 150;
|
|
@@ -10800,7 +10799,7 @@ var BackdropComponent = import_styled_components64.default.div`
|
|
|
10800
10799
|
}
|
|
10801
10800
|
}
|
|
10802
10801
|
`;
|
|
10803
|
-
var Backdrop = (0,
|
|
10802
|
+
var Backdrop = (0, import_react48.forwardRef)(
|
|
10804
10803
|
({ alignHorizontal = "center", alignVertical = "center", children, ...otherProps }, ref) => /* @__PURE__ */ (0, import_jsx_runtime243.jsx)(
|
|
10805
10804
|
BackdropComponent,
|
|
10806
10805
|
{
|
|
@@ -10822,7 +10821,7 @@ var ModalBody = import_styled_components65.default.div`
|
|
|
10822
10821
|
display: flex;
|
|
10823
10822
|
order: 2;
|
|
10824
10823
|
`;
|
|
10825
|
-
var Modal = (0,
|
|
10824
|
+
var Modal = (0, import_react49.forwardRef)(
|
|
10826
10825
|
({
|
|
10827
10826
|
children,
|
|
10828
10827
|
fullHeight = false,
|
|
@@ -11036,7 +11035,7 @@ var ProgressBar = ({
|
|
|
11036
11035
|
ProgressBar.displayName = "ProgressBar";
|
|
11037
11036
|
|
|
11038
11037
|
// src/components/Radio/Radio.tsx
|
|
11039
|
-
var
|
|
11038
|
+
var import_react50 = require("react");
|
|
11040
11039
|
var import_styled_components68 = __toESM(require("styled-components"));
|
|
11041
11040
|
var import_type_guards44 = require("@wistia/type-guards");
|
|
11042
11041
|
var import_jsx_runtime247 = require("react/jsx-runtime");
|
|
@@ -11139,7 +11138,7 @@ var StyledHiddenRadioInput = import_styled_components68.default.input`
|
|
|
11139
11138
|
display: block;
|
|
11140
11139
|
}
|
|
11141
11140
|
`;
|
|
11142
|
-
var Radio = (0,
|
|
11141
|
+
var Radio = (0, import_react50.forwardRef)(
|
|
11143
11142
|
({
|
|
11144
11143
|
checked,
|
|
11145
11144
|
disabled = false,
|
|
@@ -11154,7 +11153,7 @@ var Radio = (0, import_react49.forwardRef)(
|
|
|
11154
11153
|
hideLabel = false,
|
|
11155
11154
|
...props
|
|
11156
11155
|
}, ref) => {
|
|
11157
|
-
const generatedId = (0,
|
|
11156
|
+
const generatedId = (0, import_react50.useId)();
|
|
11158
11157
|
const computedId = (0, import_type_guards44.isNonEmptyString)(id) ? id : `wistia-ui-radio-${generatedId}`;
|
|
11159
11158
|
return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(
|
|
11160
11159
|
StyledRadioWrapper,
|
|
@@ -11204,20 +11203,20 @@ var Radio = (0, import_react49.forwardRef)(
|
|
|
11204
11203
|
Radio.displayName = "Radio";
|
|
11205
11204
|
|
|
11206
11205
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
11207
|
-
var
|
|
11206
|
+
var import_react53 = require("react");
|
|
11208
11207
|
var import_styled_components70 = __toESM(require("styled-components"));
|
|
11209
11208
|
var import_react_toggle_group = require("@radix-ui/react-toggle-group");
|
|
11210
11209
|
var import_type_guards45 = require("@wistia/type-guards");
|
|
11211
11210
|
|
|
11212
11211
|
// src/components/SegmentedControl/useSelectedItemStyle.tsx
|
|
11213
|
-
var
|
|
11212
|
+
var import_react51 = require("react");
|
|
11214
11213
|
var import_jsx_runtime248 = require("react/jsx-runtime");
|
|
11215
|
-
var SelectedItemStyleContext = (0,
|
|
11214
|
+
var SelectedItemStyleContext = (0, import_react51.createContext)(null);
|
|
11216
11215
|
var SelectedItemStyleProvider = ({
|
|
11217
11216
|
children
|
|
11218
11217
|
}) => {
|
|
11219
|
-
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0,
|
|
11220
|
-
const selectedItemIndicatorStyle = (0,
|
|
11218
|
+
const [selectedItemMeasurements, setSelectedItemMeasurements] = (0, import_react51.useState)(null);
|
|
11219
|
+
const selectedItemIndicatorStyle = (0, import_react51.useMemo)(
|
|
11221
11220
|
() => selectedItemMeasurements != null ? {
|
|
11222
11221
|
height: `${selectedItemMeasurements.offsetHeight}px`,
|
|
11223
11222
|
transform: `translateX(${selectedItemMeasurements.offsetLeft}px) translateY(-50%)`,
|
|
@@ -11227,7 +11226,7 @@ var SelectedItemStyleProvider = ({
|
|
|
11227
11226
|
},
|
|
11228
11227
|
[selectedItemMeasurements]
|
|
11229
11228
|
);
|
|
11230
|
-
const contextValue = (0,
|
|
11229
|
+
const contextValue = (0, import_react51.useMemo)(
|
|
11231
11230
|
() => ({
|
|
11232
11231
|
setSelectedItemMeasurements,
|
|
11233
11232
|
selectedItemIndicatorStyle
|
|
@@ -11237,7 +11236,7 @@ var SelectedItemStyleProvider = ({
|
|
|
11237
11236
|
return /* @__PURE__ */ (0, import_jsx_runtime248.jsx)(SelectedItemStyleContext.Provider, { value: contextValue, children });
|
|
11238
11237
|
};
|
|
11239
11238
|
var useSelectedItemStyle = () => {
|
|
11240
|
-
const context = (0,
|
|
11239
|
+
const context = (0, import_react51.useContext)(SelectedItemStyleContext);
|
|
11241
11240
|
if (context === null) {
|
|
11242
11241
|
throw new Error("useSelectedItemStyle must be used within a SelectedItemStyleProvider");
|
|
11243
11242
|
}
|
|
@@ -11248,11 +11247,11 @@ var useSelectedItemStyle = () => {
|
|
|
11248
11247
|
var import_styled_components69 = __toESM(require("styled-components"));
|
|
11249
11248
|
|
|
11250
11249
|
// src/components/SegmentedControl/useSegmentedControlValue.tsx
|
|
11251
|
-
var
|
|
11252
|
-
var SegmentedControlValueContext = (0,
|
|
11250
|
+
var import_react52 = require("react");
|
|
11251
|
+
var SegmentedControlValueContext = (0, import_react52.createContext)(null);
|
|
11253
11252
|
var SegmentedControlValueProvider = SegmentedControlValueContext.Provider;
|
|
11254
11253
|
var useSegmentedControlValue = () => {
|
|
11255
|
-
const context = (0,
|
|
11254
|
+
const context = (0, import_react52.useContext)(SegmentedControlValueContext);
|
|
11256
11255
|
if (context === null) {
|
|
11257
11256
|
throw new Error("useSegmentedControlValue must be used within a SegmentedControlValueProvider");
|
|
11258
11257
|
}
|
|
@@ -11298,7 +11297,7 @@ var segmentedControlStyles = import_styled_components70.css`
|
|
|
11298
11297
|
var StyledSegmentedControl = (0, import_styled_components70.default)(import_react_toggle_group.Root)`
|
|
11299
11298
|
${segmentedControlStyles}
|
|
11300
11299
|
`;
|
|
11301
|
-
var SegmentedControl = (0,
|
|
11300
|
+
var SegmentedControl = (0, import_react53.forwardRef)(
|
|
11302
11301
|
({
|
|
11303
11302
|
children,
|
|
11304
11303
|
disabled = false,
|
|
@@ -11333,7 +11332,7 @@ var SegmentedControl = (0, import_react52.forwardRef)(
|
|
|
11333
11332
|
SegmentedControl.displayName = "SegmentedControl";
|
|
11334
11333
|
|
|
11335
11334
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
11336
|
-
var
|
|
11335
|
+
var import_react54 = require("react");
|
|
11337
11336
|
var import_styled_components71 = __toESM(require("styled-components"));
|
|
11338
11337
|
var import_react_toggle_group2 = require("@radix-ui/react-toggle-group");
|
|
11339
11338
|
var import_type_guards46 = require("@wistia/type-guards");
|
|
@@ -11401,11 +11400,11 @@ var segmentedControlItemStyles = import_styled_components71.css`
|
|
|
11401
11400
|
var StyledSegmentedControlItem = (0, import_styled_components71.default)(import_react_toggle_group2.Item)`
|
|
11402
11401
|
${segmentedControlItemStyles}
|
|
11403
11402
|
`;
|
|
11404
|
-
var SegmentedControlItem = (0,
|
|
11403
|
+
var SegmentedControlItem = (0, import_react54.forwardRef)(
|
|
11405
11404
|
({ disabled, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
11406
11405
|
const selectedValue = useSegmentedControlValue();
|
|
11407
11406
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
11408
|
-
const buttonRef = (0,
|
|
11407
|
+
const buttonRef = (0, import_react54.useRef)(null);
|
|
11409
11408
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
11410
11409
|
const handleClick = (event) => {
|
|
11411
11410
|
const target = event.target;
|
|
@@ -11414,7 +11413,7 @@ var SegmentedControlItem = (0, import_react53.forwardRef)(
|
|
|
11414
11413
|
event.preventDefault();
|
|
11415
11414
|
}
|
|
11416
11415
|
};
|
|
11417
|
-
(0,
|
|
11416
|
+
(0, import_react54.useEffect)(() => {
|
|
11418
11417
|
const buttonElem = buttonRef.current;
|
|
11419
11418
|
if (!buttonElem) {
|
|
11420
11419
|
return void 0;
|
|
@@ -11460,7 +11459,7 @@ SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
|
11460
11459
|
|
|
11461
11460
|
// src/components/Select/Select.tsx
|
|
11462
11461
|
var import_react_select = require("@radix-ui/react-select");
|
|
11463
|
-
var
|
|
11462
|
+
var import_react55 = require("react");
|
|
11464
11463
|
var import_styled_components72 = __toESM(require("styled-components"));
|
|
11465
11464
|
var import_jsx_runtime252 = require("react/jsx-runtime");
|
|
11466
11465
|
var StyledTrigger = (0, import_styled_components72.default)(import_react_select.Trigger)`
|
|
@@ -11525,7 +11524,7 @@ var StyledContent3 = (0, import_styled_components72.default)(import_react_select
|
|
|
11525
11524
|
max-height: var(--radix-select-content-available-height);
|
|
11526
11525
|
z-index: var(--wui-zindex-select);
|
|
11527
11526
|
`;
|
|
11528
|
-
var Select = (0,
|
|
11527
|
+
var Select = (0, import_react55.forwardRef)(
|
|
11529
11528
|
({
|
|
11530
11529
|
colorScheme = "inherit",
|
|
11531
11530
|
children,
|
|
@@ -11574,7 +11573,7 @@ Select.displayName = "Select";
|
|
|
11574
11573
|
|
|
11575
11574
|
// src/components/Select/SelectOption.tsx
|
|
11576
11575
|
var import_react_select2 = require("@radix-ui/react-select");
|
|
11577
|
-
var
|
|
11576
|
+
var import_react56 = require("react");
|
|
11578
11577
|
var import_styled_components73 = __toESM(require("styled-components"));
|
|
11579
11578
|
var import_type_guards47 = require("@wistia/type-guards");
|
|
11580
11579
|
var import_jsx_runtime253 = require("react/jsx-runtime");
|
|
@@ -11605,7 +11604,7 @@ var StyledItem = (0, import_styled_components73.default)(import_react_select2.It
|
|
|
11605
11604
|
var StyledIconContainer = import_styled_components73.default.span`
|
|
11606
11605
|
width: 12px;
|
|
11607
11606
|
`;
|
|
11608
|
-
var SelectOption = (0,
|
|
11607
|
+
var SelectOption = (0, import_react56.forwardRef)(
|
|
11609
11608
|
({ children, selectedDisplayValue, ...props }, forwardedRef) => {
|
|
11610
11609
|
return /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(
|
|
11611
11610
|
StyledItem,
|
|
@@ -11653,7 +11652,7 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
11653
11652
|
};
|
|
11654
11653
|
|
|
11655
11654
|
// src/components/Switch/Switch.tsx
|
|
11656
|
-
var
|
|
11655
|
+
var import_react57 = require("react");
|
|
11657
11656
|
var import_styled_components75 = __toESM(require("styled-components"));
|
|
11658
11657
|
var import_type_guards48 = require("@wistia/type-guards");
|
|
11659
11658
|
var import_jsx_runtime255 = require("react/jsx-runtime");
|
|
@@ -11758,7 +11757,7 @@ var StyledHiddenSwitchInput = import_styled_components75.default.input`
|
|
|
11758
11757
|
}
|
|
11759
11758
|
}
|
|
11760
11759
|
`;
|
|
11761
|
-
var Switch = (0,
|
|
11760
|
+
var Switch = (0, import_react57.forwardRef)(
|
|
11762
11761
|
({
|
|
11763
11762
|
checked,
|
|
11764
11763
|
disabled = false,
|
|
@@ -11773,7 +11772,7 @@ var Switch = (0, import_react56.forwardRef)(
|
|
|
11773
11772
|
hideLabel = false,
|
|
11774
11773
|
...props
|
|
11775
11774
|
}, ref) => {
|
|
11776
|
-
const generatedId = (0,
|
|
11775
|
+
const generatedId = (0, import_react57.useId)();
|
|
11777
11776
|
const computedId = (0, import_type_guards48.isNonEmptyString)(id) ? id : `wistia-ui-switch-${generatedId}`;
|
|
11778
11777
|
return /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)(StyledSwitchWrapper, { $disabled: disabled, children: [
|
|
11779
11778
|
/* @__PURE__ */ (0, import_jsx_runtime255.jsx)(
|
|
@@ -11855,8 +11854,8 @@ var Table = ({
|
|
|
11855
11854
|
var import_styled_components77 = __toESM(require("styled-components"));
|
|
11856
11855
|
|
|
11857
11856
|
// src/components/Table/TableSectionContext.ts
|
|
11858
|
-
var
|
|
11859
|
-
var TableSectionContext = (0,
|
|
11857
|
+
var import_react58 = require("react");
|
|
11858
|
+
var TableSectionContext = (0, import_react58.createContext)(null);
|
|
11860
11859
|
|
|
11861
11860
|
// src/components/Table/TableBody.tsx
|
|
11862
11861
|
var import_jsx_runtime257 = require("react/jsx-runtime");
|
|
@@ -11866,7 +11865,7 @@ var TableBody = ({ children, ...props }) => {
|
|
|
11866
11865
|
};
|
|
11867
11866
|
|
|
11868
11867
|
// src/components/Table/TableCell.tsx
|
|
11869
|
-
var
|
|
11868
|
+
var import_react59 = require("react");
|
|
11870
11869
|
var import_styled_components78 = __toESM(require("styled-components"));
|
|
11871
11870
|
var import_jsx_runtime258 = require("react/jsx-runtime");
|
|
11872
11871
|
var sharedStyles = import_styled_components78.css`
|
|
@@ -11887,7 +11886,7 @@ var StyledTd = import_styled_components78.default.td`
|
|
|
11887
11886
|
line-height: var(--wui-typography-body-2-line-height);
|
|
11888
11887
|
`;
|
|
11889
11888
|
var TableCell = ({ children, ...props }) => {
|
|
11890
|
-
const section = (0,
|
|
11889
|
+
const section = (0, import_react59.useContext)(TableSectionContext);
|
|
11891
11890
|
if (section === "head") {
|
|
11892
11891
|
return /* @__PURE__ */ (0, import_jsx_runtime258.jsx)(StyledTh, { ...props, children });
|
|
11893
11892
|
}
|
|
@@ -11919,7 +11918,7 @@ var TableRow = ({ children, ...props }) => {
|
|
|
11919
11918
|
};
|
|
11920
11919
|
|
|
11921
11920
|
// src/components/Tabs/Tabs.tsx
|
|
11922
|
-
var
|
|
11921
|
+
var import_react63 = require("react");
|
|
11923
11922
|
var import_react_tabs4 = require("@radix-ui/react-tabs");
|
|
11924
11923
|
var import_type_guards50 = require("@wistia/type-guards");
|
|
11925
11924
|
var import_styled_components86 = __toESM(require("styled-components"));
|
|
@@ -11974,17 +11973,17 @@ var TabList = ({
|
|
|
11974
11973
|
TabList.displayName = "TabList";
|
|
11975
11974
|
|
|
11976
11975
|
// src/components/Tabs/TabItem.tsx
|
|
11977
|
-
var
|
|
11976
|
+
var import_react61 = require("react");
|
|
11978
11977
|
var import_styled_components84 = __toESM(require("styled-components"));
|
|
11979
11978
|
var import_react_tabs3 = require("@radix-ui/react-tabs");
|
|
11980
11979
|
var import_type_guards49 = require("@wistia/type-guards");
|
|
11981
11980
|
|
|
11982
11981
|
// src/components/Tabs/useTabsValue.tsx
|
|
11983
|
-
var
|
|
11984
|
-
var TabsValueContext = (0,
|
|
11982
|
+
var import_react60 = require("react");
|
|
11983
|
+
var TabsValueContext = (0, import_react60.createContext)(null);
|
|
11985
11984
|
var TabsValueProvider = TabsValueContext.Provider;
|
|
11986
11985
|
var useTabsValue = () => {
|
|
11987
|
-
const context = (0,
|
|
11986
|
+
const context = (0, import_react60.useContext)(TabsValueContext);
|
|
11988
11987
|
if (context === null) {
|
|
11989
11988
|
throw new Error("useTabsValue must be used within a TabsValueProvider");
|
|
11990
11989
|
}
|
|
@@ -12000,13 +11999,13 @@ var StyledTabItem = (0, import_styled_components84.default)(import_react_tabs3.T
|
|
|
12000
11999
|
outline: none;
|
|
12001
12000
|
}
|
|
12002
12001
|
`;
|
|
12003
|
-
var TabItem = (0,
|
|
12002
|
+
var TabItem = (0, import_react61.forwardRef)(
|
|
12004
12003
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
|
|
12005
12004
|
const selectedValue = useTabsValue();
|
|
12006
12005
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
12007
|
-
const buttonRef = (0,
|
|
12006
|
+
const buttonRef = (0, import_react61.useRef)(null);
|
|
12008
12007
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
12009
|
-
(0,
|
|
12008
|
+
(0, import_react61.useEffect)(() => {
|
|
12010
12009
|
const buttonElem = buttonRef.current;
|
|
12011
12010
|
if (!buttonElem) {
|
|
12012
12011
|
return void 0;
|
|
@@ -12050,16 +12049,16 @@ var TabItem = (0, import_react60.forwardRef)(
|
|
|
12050
12049
|
TabItem.displayName = "TabItem";
|
|
12051
12050
|
|
|
12052
12051
|
// src/components/Tabs/extractTabItems.ts
|
|
12053
|
-
var
|
|
12052
|
+
var import_react62 = require("react");
|
|
12054
12053
|
var extractTabItems = (children) => {
|
|
12055
12054
|
const tabItems = [];
|
|
12056
|
-
|
|
12057
|
-
if (!(0,
|
|
12055
|
+
import_react62.Children.forEach(children, (child) => {
|
|
12056
|
+
if (!(0, import_react62.isValidElement)(child)) {
|
|
12058
12057
|
return;
|
|
12059
12058
|
}
|
|
12060
12059
|
if (typeof child.type !== "string" && child.type.displayName === "Tab") {
|
|
12061
12060
|
tabItems.push(child);
|
|
12062
|
-
} else if (child.type ===
|
|
12061
|
+
} else if (child.type === import_react62.Fragment) {
|
|
12063
12062
|
const fragmentElement = child;
|
|
12064
12063
|
tabItems.push(...extractTabItems(fragmentElement.props.children));
|
|
12065
12064
|
} else if ((child.props.children ?? null) != null) {
|
|
@@ -12106,7 +12105,7 @@ var StyledTabsRoot = (0, import_styled_components86.default)(import_react_tabs4.
|
|
|
12106
12105
|
flex-direction: column;
|
|
12107
12106
|
height: ${({ $stickyHeaders }) => $stickyHeaders ? "100%" : "auto"};
|
|
12108
12107
|
`;
|
|
12109
|
-
var Tabs = (0,
|
|
12108
|
+
var Tabs = (0, import_react63.forwardRef)(
|
|
12110
12109
|
({
|
|
12111
12110
|
children,
|
|
12112
12111
|
fullWidth = true,
|
|
@@ -12118,7 +12117,7 @@ var Tabs = (0, import_react62.forwardRef)(
|
|
|
12118
12117
|
...props
|
|
12119
12118
|
}, ref) => {
|
|
12120
12119
|
const tabItems = extractTabItems(children);
|
|
12121
|
-
const [internalSelectedValue, setInternalSelectedValue] = (0,
|
|
12120
|
+
const [internalSelectedValue, setInternalSelectedValue] = (0, import_react63.useState)(defaultSelectedValue);
|
|
12122
12121
|
const modeProps = defaultSelectedValue !== void 0 ? {
|
|
12123
12122
|
defaultValue: defaultSelectedValue,
|
|
12124
12123
|
onValueChange: setInternalSelectedValue
|
|
@@ -12204,15 +12203,15 @@ var Tabs = (0, import_react62.forwardRef)(
|
|
|
12204
12203
|
Tabs.displayName = "Tabs";
|
|
12205
12204
|
|
|
12206
12205
|
// src/components/Tabs/Tab.tsx
|
|
12207
|
-
var
|
|
12206
|
+
var import_react64 = require("react");
|
|
12208
12207
|
var import_jsx_runtime267 = require("react/jsx-runtime");
|
|
12209
|
-
var Tab = (0,
|
|
12208
|
+
var Tab = (0, import_react64.forwardRef)(({ children }, ref) => {
|
|
12210
12209
|
return /* @__PURE__ */ (0, import_jsx_runtime267.jsx)("div", { ref, children });
|
|
12211
12210
|
});
|
|
12212
12211
|
Tab.displayName = "Tab";
|
|
12213
12212
|
|
|
12214
12213
|
// src/components/Tag/Tag.tsx
|
|
12215
|
-
var
|
|
12214
|
+
var import_react65 = require("react");
|
|
12216
12215
|
var import_styled_components87 = __toESM(require("styled-components"));
|
|
12217
12216
|
var import_type_guards51 = require("@wistia/type-guards");
|
|
12218
12217
|
var import_jsx_runtime268 = require("react/jsx-runtime");
|
|
@@ -12329,7 +12328,7 @@ var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
|
12329
12328
|
)
|
|
12330
12329
|
] });
|
|
12331
12330
|
};
|
|
12332
|
-
var Tag = (0,
|
|
12331
|
+
var Tag = (0, import_react65.forwardRef)(
|
|
12333
12332
|
({ onClickRemove, colorScheme = "inherit", href, icon, label, onClickRemoveLabel, ...props }, ref) => {
|
|
12334
12333
|
const hasIcon = (0, import_type_guards51.isNotNil)(icon);
|
|
12335
12334
|
const labelProps = (0, import_type_guards51.isNotNil)(href) && (0, import_type_guards51.isNonEmptyString)(href) ? { href, as: "a" } : { as: "span" };
|
|
@@ -12403,7 +12402,7 @@ var ThumbnailBadge = ({ icon, label, ...props }) => {
|
|
|
12403
12402
|
ThumbnailBadge.displayName = "ThumbnailBadge";
|
|
12404
12403
|
|
|
12405
12404
|
// src/components/Thumbnail/Thumbnail.tsx
|
|
12406
|
-
var
|
|
12405
|
+
var import_react66 = require("react");
|
|
12407
12406
|
var import_styled_components90 = __toESM(require("styled-components"));
|
|
12408
12407
|
var import_type_guards54 = require("@wistia/type-guards");
|
|
12409
12408
|
|
|
@@ -12590,7 +12589,7 @@ var StyledThumbnail = import_styled_components90.default.div`
|
|
|
12590
12589
|
border-radius: calc(8% * (9 / 16)) / 8%;
|
|
12591
12590
|
}
|
|
12592
12591
|
`;
|
|
12593
|
-
var Thumbnail = (0,
|
|
12592
|
+
var Thumbnail = (0, import_react66.forwardRef)(
|
|
12594
12593
|
({
|
|
12595
12594
|
gradientBackground = "defaultMidOne",
|
|
12596
12595
|
thumbnailImageType = "square",
|
|
@@ -12626,7 +12625,7 @@ var Thumbnail = (0, import_react65.forwardRef)(
|
|
|
12626
12625
|
Thumbnail.displayName = "Thumbnail";
|
|
12627
12626
|
|
|
12628
12627
|
// src/components/ThumbnailCollage/ThumbnailCollage.tsx
|
|
12629
|
-
var
|
|
12628
|
+
var import_react67 = __toESM(require("react"));
|
|
12630
12629
|
var import_styled_components91 = __toESM(require("styled-components"));
|
|
12631
12630
|
var import_type_guards55 = require("@wistia/type-guards");
|
|
12632
12631
|
var import_jsx_runtime271 = (
|
|
@@ -12706,10 +12705,10 @@ var ThumbnailCollage = ({
|
|
|
12706
12705
|
gradientBackground = "defaultMidOne",
|
|
12707
12706
|
...props
|
|
12708
12707
|
}) => {
|
|
12709
|
-
const thumbnailArray =
|
|
12708
|
+
const thumbnailArray = import_react67.default.Children.toArray(children);
|
|
12710
12709
|
const truncatedThumbnails = thumbnailArray.slice(0, 3);
|
|
12711
12710
|
const thumbnails = (0, import_type_guards55.isNonEmptyArray)(thumbnailArray) ? truncatedThumbnails.map((child) => {
|
|
12712
|
-
return
|
|
12711
|
+
return import_react67.default.cloneElement(child, {
|
|
12713
12712
|
...child.props,
|
|
12714
12713
|
children: void 0
|
|
12715
12714
|
});
|