@wistia/ui 3.3.0 → 3.4.0-beta.5b7334da.8f5cc34
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.d.ts +37 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +206 -178
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/CHANGELOG.md +0 -2582
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v3.
|
|
3
|
+
* @license @wistia/ui v3.4.0-beta.5b7334da.8f5cc34
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
11
11
|
import { Children, Fragment, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useTransition } from "react";
|
|
12
12
|
import { createGlobalStyle, css, keyframes, styled } from "styled-components";
|
|
13
|
-
import { isArray, isBoolean, isDate, isEmptyString, isFunction, isNil, isNonEmptyArray, isNonEmptyString, isNotNil, isNotUndefined, isNumber, isRecord, isString, isUndefined, noOpFn } from "@wistia/
|
|
13
|
+
import { isArray, isBoolean, isDate, isEmptyString, isFunction, isNil, isNonEmptyArray, isNonEmptyString, isNotNil, isNotUndefined, isNumber, isRecord, isString, isUndefined, noOpFn } from "@wistia/utils";
|
|
14
14
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
import { Toaster, toast } from "sonner";
|
|
16
16
|
import { getValueAndUnit } from "polished";
|
|
@@ -1546,21 +1546,34 @@ const scopeTab = (node, event) => {
|
|
|
1546
1546
|
const target = tabbable[event.shiftKey ? tabbable.length - 1 : 0];
|
|
1547
1547
|
if (target) target.focus();
|
|
1548
1548
|
};
|
|
1549
|
+
const ariaHiderState = /* @__PURE__ */ new WeakMap();
|
|
1549
1550
|
const createAriaHider = (containerNode, selector = "body > :not(script)") => {
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
const
|
|
1553
|
-
if (
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1551
|
+
const hiddenNodes = [...document.querySelectorAll(selector)].filter((node) => !node.contains(containerNode));
|
|
1552
|
+
hiddenNodes.forEach((node) => {
|
|
1553
|
+
const state = ariaHiderState.get(node);
|
|
1554
|
+
if (state) {
|
|
1555
|
+
state.count += 1;
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
const originalAriaHidden = node.getAttribute("aria-hidden");
|
|
1559
|
+
ariaHiderState.set(node, {
|
|
1560
|
+
count: 1,
|
|
1561
|
+
originalAriaHidden
|
|
1562
|
+
});
|
|
1563
|
+
if (originalAriaHidden === null || originalAriaHidden === "false") node.setAttribute("aria-hidden", "true");
|
|
1558
1564
|
});
|
|
1565
|
+
let isRestored = false;
|
|
1559
1566
|
return () => {
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1567
|
+
if (isRestored) return;
|
|
1568
|
+
isRestored = true;
|
|
1569
|
+
hiddenNodes.forEach((node) => {
|
|
1570
|
+
const state = ariaHiderState.get(node);
|
|
1571
|
+
if (!state) return;
|
|
1572
|
+
state.count -= 1;
|
|
1573
|
+
if (state.count > 0) return;
|
|
1574
|
+
ariaHiderState.delete(node);
|
|
1575
|
+
if (state.originalAriaHidden === null) node.removeAttribute("aria-hidden");
|
|
1576
|
+
else node.setAttribute("aria-hidden", state.originalAriaHidden);
|
|
1564
1577
|
});
|
|
1565
1578
|
};
|
|
1566
1579
|
};
|
|
@@ -1570,47 +1583,53 @@ const isRef = (val) => {
|
|
|
1570
1583
|
return val !== null && typeof val === "object" && "current" in val;
|
|
1571
1584
|
};
|
|
1572
1585
|
const useFocusTrap = (active = true, options = {}) => {
|
|
1573
|
-
const
|
|
1574
|
-
const
|
|
1575
|
-
const
|
|
1576
|
-
|
|
1577
|
-
|
|
1586
|
+
const { disableAriaHider = false, focusSelector } = options;
|
|
1587
|
+
const [node, setNode] = useState(null);
|
|
1588
|
+
const nodeRef = useRef(null);
|
|
1589
|
+
const setRef = useCallback((nextNode) => {
|
|
1590
|
+
nodeRef.current = nextNode ?? null;
|
|
1591
|
+
setNode(nextNode ?? null);
|
|
1592
|
+
}, []);
|
|
1593
|
+
useLayoutEffect(() => {
|
|
1594
|
+
if (!active || node === null) return;
|
|
1595
|
+
setupScopedFocus(node);
|
|
1596
|
+
markForFocusLater();
|
|
1597
|
+
let restoreAria = null;
|
|
1598
|
+
const processNode = () => {
|
|
1599
|
+
restoreAria = disableAriaHider ? null : createAriaHider(node);
|
|
1600
|
+
let focusElement = null;
|
|
1601
|
+
if (isNotUndefined(focusSelector)) {
|
|
1602
|
+
if (isRef(focusSelector)) focusElement = focusSelector.current;
|
|
1603
|
+
else focusElement = typeof focusSelector === "string" ? node.querySelector(focusSelector) : focusSelector;
|
|
1604
|
+
}
|
|
1605
|
+
if (!focusElement) {
|
|
1606
|
+
const children = [...node.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)];
|
|
1607
|
+
focusElement = children.find((element) => isTabbableElement(element)) ?? children.find((element) => isFocusableElement(element)) ?? null;
|
|
1608
|
+
if (!focusElement && isFocusableElement(node)) focusElement = node;
|
|
1609
|
+
}
|
|
1610
|
+
if (focusElement) focusElement.focus();
|
|
1611
|
+
if (!focusElement) console.warn("[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.", node);
|
|
1612
|
+
};
|
|
1613
|
+
const timeoutId = setTimeout(() => {
|
|
1614
|
+
if (node.ownerDocument) processNode();
|
|
1615
|
+
if (!node.ownerDocument) console.warn("[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.", node);
|
|
1616
|
+
}, 0);
|
|
1617
|
+
return () => {
|
|
1618
|
+
clearTimeout(timeoutId);
|
|
1619
|
+
restoreAria?.();
|
|
1578
1620
|
returnFocus();
|
|
1579
1621
|
teardownScopedFocus();
|
|
1580
|
-
}
|
|
1581
|
-
if (active && node !== null && node !== void 0) {
|
|
1582
|
-
setupScopedFocus(node);
|
|
1583
|
-
markForFocusLater();
|
|
1584
|
-
const processNode = (node2) => {
|
|
1585
|
-
restoreAriaRef.current = !(options.disableAriaHider ?? false) ? createAriaHider(node2) : null;
|
|
1586
|
-
let focusElement = null;
|
|
1587
|
-
if (isNotUndefined(options.focusSelector)) {
|
|
1588
|
-
if (isRef(options.focusSelector)) focusElement = options.focusSelector.current;
|
|
1589
|
-
else focusElement = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
|
|
1590
|
-
}
|
|
1591
|
-
if (!focusElement) {
|
|
1592
|
-
const children = [...node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)];
|
|
1593
|
-
focusElement = children.find((element) => isTabbableElement(element)) ?? children.find((element) => isFocusableElement(element)) ?? null;
|
|
1594
|
-
if (!focusElement && isFocusableElement(node2)) focusElement = node2;
|
|
1595
|
-
}
|
|
1596
|
-
if (focusElement) focusElement.focus();
|
|
1597
|
-
if (!focusElement) console.warn("[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.", node2);
|
|
1598
|
-
};
|
|
1599
|
-
setTimeout(() => {
|
|
1600
|
-
if (node.ownerDocument) processNode(node);
|
|
1601
|
-
if (!node.ownerDocument) console.warn("[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.", node);
|
|
1602
|
-
}, 0);
|
|
1603
|
-
ref.current = node;
|
|
1604
|
-
} else ref.current = null;
|
|
1622
|
+
};
|
|
1605
1623
|
}, [
|
|
1606
1624
|
active,
|
|
1607
|
-
|
|
1608
|
-
|
|
1625
|
+
node,
|
|
1626
|
+
focusSelector,
|
|
1627
|
+
disableAriaHider
|
|
1609
1628
|
]);
|
|
1610
1629
|
useEffect(() => {
|
|
1611
1630
|
if (!active) return;
|
|
1612
1631
|
const handleKeyDown = (event) => {
|
|
1613
|
-
if (event.key === "Tab" &&
|
|
1632
|
+
if (event.key === "Tab" && nodeRef.current) scopeTab(nodeRef.current, event);
|
|
1614
1633
|
};
|
|
1615
1634
|
document.addEventListener("keydown", handleKeyDown);
|
|
1616
1635
|
return () => {
|
|
@@ -1887,6 +1906,14 @@ const lineClampCss = ($lines = 1) => css`
|
|
|
1887
1906
|
white-space: initial;
|
|
1888
1907
|
`;
|
|
1889
1908
|
//#endregion
|
|
1909
|
+
//#region src/css/wordBreakCss.tsx
|
|
1910
|
+
const wordBreakCss = (wordBreak = "anywhere") => {
|
|
1911
|
+
if (wordBreak === "word") return css`
|
|
1912
|
+
word-break: normal;
|
|
1913
|
+
overflow-wrap: anywhere;
|
|
1914
|
+
`;
|
|
1915
|
+
};
|
|
1916
|
+
//#endregion
|
|
1890
1917
|
//#region src/components/Ellipsis/Ellipsis.tsx
|
|
1891
1918
|
const ellipsisStyle = css`
|
|
1892
1919
|
overflow: hidden;
|
|
@@ -1918,12 +1945,14 @@ const EllipsisComponent = styled.span`
|
|
|
1918
1945
|
${({ $lines }) => {
|
|
1919
1946
|
if (isNotNil($lines)) return lineClampCss($lines);
|
|
1920
1947
|
}}
|
|
1948
|
+
${({ $wordBreak }) => wordBreakCss($wordBreak)};
|
|
1921
1949
|
`;
|
|
1922
1950
|
/**
|
|
1923
1951
|
* Truncate text with an ellispsis visble at the end
|
|
1924
1952
|
*/
|
|
1925
|
-
const Ellipsis = ({ children, lines, ...props }) => /* @__PURE__ */ jsx(EllipsisComponent, {
|
|
1953
|
+
const Ellipsis = ({ children, lines, wordBreak = "anywhere", ...props }) => /* @__PURE__ */ jsx(EllipsisComponent, {
|
|
1926
1954
|
$lines: lines,
|
|
1955
|
+
$wordBreak: wordBreak,
|
|
1927
1956
|
...props,
|
|
1928
1957
|
children
|
|
1929
1958
|
});
|
|
@@ -6910,10 +6939,11 @@ const PolymorphicStyledHeading = withPolymorphicAs(styled.div`
|
|
|
6910
6939
|
line-height: var(--line-height);
|
|
6911
6940
|
color: var(--text-color);
|
|
6912
6941
|
${({ $variant }) => headingVariantStyleMap[$variant]}
|
|
6913
|
-
${({ $maxLines }) => {
|
|
6942
|
+
${({ $maxLines, $wordBreak }) => {
|
|
6914
6943
|
if (isNotNil($maxLines)) return css`
|
|
6915
6944
|
${ellipsisStyle};
|
|
6916
6945
|
${lineClampCss($maxLines)};
|
|
6946
|
+
${wordBreakCss($wordBreak)};
|
|
6917
6947
|
`;
|
|
6918
6948
|
}}
|
|
6919
6949
|
${({ $inline }) => $inline && css`
|
|
@@ -6941,7 +6971,7 @@ const headingVariantElementMap = {
|
|
|
6941
6971
|
heading5: "h5",
|
|
6942
6972
|
heading6: "h6"
|
|
6943
6973
|
};
|
|
6944
|
-
const HeadingComponent = ({ ref, align = "left", children, colorScheme = "inherit", disabled = false, inline = false, maxChars, preventUserSelect = false, prominence = "primary", maxLines, textTransform, variant = "heading1", renderAs, ...props }) => {
|
|
6974
|
+
const HeadingComponent = ({ ref, align = "left", children, colorScheme = "inherit", disabled = false, inline = false, maxChars, preventUserSelect = false, prominence = "primary", maxLines, textTransform, wordBreak = "anywhere", variant = "heading1", renderAs, ...props }) => {
|
|
6945
6975
|
const processedChildren = applyMaxCharsToChildren(children, maxChars);
|
|
6946
6976
|
return /* @__PURE__ */ jsx(PolymorphicStyledHeading, {
|
|
6947
6977
|
ref,
|
|
@@ -6954,6 +6984,7 @@ const HeadingComponent = ({ ref, align = "left", children, colorScheme = "inheri
|
|
|
6954
6984
|
$prominence: prominence,
|
|
6955
6985
|
$textTransform: textTransform,
|
|
6956
6986
|
$variant: variant,
|
|
6987
|
+
$wordBreak: wordBreak,
|
|
6957
6988
|
as: renderAs ?? headingVariantElementMap[variant] ?? DEFAULT_ELEMENT$3,
|
|
6958
6989
|
...props,
|
|
6959
6990
|
children: processedChildren
|
|
@@ -7137,10 +7168,11 @@ const PolymorphicStyledText = withPolymorphicAs(styled.div`
|
|
|
7137
7168
|
font-style: normal;
|
|
7138
7169
|
margin: 0;
|
|
7139
7170
|
${({ $variant }) => textVariantStyleMap[$variant]}
|
|
7140
|
-
${({ $maxLines }) => {
|
|
7171
|
+
${({ $maxLines, $wordBreak }) => {
|
|
7141
7172
|
if (isNotNil($maxLines)) return css`
|
|
7142
7173
|
${ellipsisStyle};
|
|
7143
7174
|
${lineClampCss($maxLines)};
|
|
7175
|
+
${wordBreakCss($wordBreak)};
|
|
7144
7176
|
`;
|
|
7145
7177
|
}}
|
|
7146
7178
|
${({ $inline }) => $inline && css`
|
|
@@ -7166,7 +7198,7 @@ const PolymorphicStyledText = withPolymorphicAs(styled.div`
|
|
|
7166
7198
|
}
|
|
7167
7199
|
`}
|
|
7168
7200
|
`);
|
|
7169
|
-
const TextComponent = ({ ref, align = "left", children, colorScheme = "inherit", disabled = false, inline = false, maxChars, preventUserSelect = false, prominence = "primary", maxLines, textTransform, variant = "body2", renderAs, ...props }) => {
|
|
7201
|
+
const TextComponent = ({ ref, align = "left", children, colorScheme = "inherit", disabled = false, inline = false, maxChars, preventUserSelect = false, prominence = "primary", maxLines, textTransform, wordBreak = "anywhere", variant = "body2", renderAs, ...props }) => {
|
|
7170
7202
|
const processedChildren = applyMaxCharsToChildren(children, maxChars);
|
|
7171
7203
|
return /* @__PURE__ */ jsx(PolymorphicStyledText, {
|
|
7172
7204
|
ref,
|
|
@@ -7179,6 +7211,7 @@ const TextComponent = ({ ref, align = "left", children, colorScheme = "inherit",
|
|
|
7179
7211
|
$prominence: prominence,
|
|
7180
7212
|
$textTransform: textTransform,
|
|
7181
7213
|
$variant: variant,
|
|
7214
|
+
$wordBreak: wordBreak,
|
|
7182
7215
|
as: renderAs ?? textVariantElementMap[variant] ?? DEFAULT_ELEMENT$2,
|
|
7183
7216
|
...props,
|
|
7184
7217
|
children: processedChildren
|
|
@@ -9229,6 +9262,112 @@ const RadioCardRoot = ({ children, disabled = false, id, isGated = false, name,
|
|
|
9229
9262
|
});
|
|
9230
9263
|
};
|
|
9231
9264
|
//#endregion
|
|
9265
|
+
//#region src/components/RadioCard/RadioCardIndicator.tsx
|
|
9266
|
+
const RadioCardIndicator = styled.div`
|
|
9267
|
+
--wui-radio-card-indicator-size: 14px;
|
|
9268
|
+
--wui-radio-card-indicator-background-color: var(--wui-color-bg-surface);
|
|
9269
|
+
--wui-radio-card-indicator-fill-color: var(--wui-color-bg-fill);
|
|
9270
|
+
|
|
9271
|
+
/* TODO: figure out radio / checkbox / switch colors */
|
|
9272
|
+
--wui-radio-card-indicator-border-color: var(--wui-color-border-secondary-active);
|
|
9273
|
+
|
|
9274
|
+
width: var(--wui-radio-card-indicator-size);
|
|
9275
|
+
height: var(--wui-radio-card-indicator-size);
|
|
9276
|
+
min-width: var(--wui-radio-card-indicator-size);
|
|
9277
|
+
min-height: var(--wui-radio-card-indicator-size);
|
|
9278
|
+
background-color: var(--wui-radio-card-indicator-background-color);
|
|
9279
|
+
box-shadow: inset 0 0 0 1px var(--wui-radio-card-indicator-border-color);
|
|
9280
|
+
border-radius: 100%;
|
|
9281
|
+
position: relative;
|
|
9282
|
+
cursor: pointer;
|
|
9283
|
+
transition: border-color var(--wui-motion-duration-03) var(--wui-motion-ease);
|
|
9284
|
+
|
|
9285
|
+
&::after {
|
|
9286
|
+
content: '';
|
|
9287
|
+
position: absolute;
|
|
9288
|
+
top: 50%;
|
|
9289
|
+
left: 50%;
|
|
9290
|
+
width: 0;
|
|
9291
|
+
height: 0;
|
|
9292
|
+
background-color: var(--wui-radio-card-indicator-fill-color);
|
|
9293
|
+
border-radius: 100%;
|
|
9294
|
+
transform: translate(-50%, -50%);
|
|
9295
|
+
}
|
|
9296
|
+
|
|
9297
|
+
${StyledCard}:has(input:checked) & {
|
|
9298
|
+
--wui-radio-card-indicator-border-color: var(--wui-color-focus-ring);
|
|
9299
|
+
--wui-radio-card-indicator-fill-color: var(--wui-color-focus-ring);
|
|
9300
|
+
|
|
9301
|
+
&::after {
|
|
9302
|
+
width: calc(var(--wui-radio-card-indicator-size) / 2);
|
|
9303
|
+
height: calc(var(--wui-radio-card-indicator-size) / 2);
|
|
9304
|
+
}
|
|
9305
|
+
}
|
|
9306
|
+
|
|
9307
|
+
${StyledCard}:has(input:disabled) & {
|
|
9308
|
+
--wui-radio-card-indicator-border-color: var(--wui-color-border-secondary);
|
|
9309
|
+
--wui-radio-card-indicator-background-color: var(--wui-color-bg-surface-disabled);
|
|
9310
|
+
}
|
|
9311
|
+
`;
|
|
9312
|
+
RadioCardIndicator.displayName = "RadioCardIndicator_UI";
|
|
9313
|
+
//#endregion
|
|
9314
|
+
//#region src/components/RadioCard/RadioCardDefaultLayout.tsx
|
|
9315
|
+
const StyledCardContent$1 = styled.div`
|
|
9316
|
+
display: grid;
|
|
9317
|
+
grid-auto-flow: column;
|
|
9318
|
+
gap: var(--wui-space-02);
|
|
9319
|
+
`;
|
|
9320
|
+
const StyledCardIcon$1 = styled.div`
|
|
9321
|
+
display: contents;
|
|
9322
|
+
`;
|
|
9323
|
+
const StyledGatedIcon = styled.div`
|
|
9324
|
+
position: absolute;
|
|
9325
|
+
right: 10px;
|
|
9326
|
+
top: 10px;
|
|
9327
|
+
z-index: 1;
|
|
9328
|
+
`;
|
|
9329
|
+
const StyledIndicatorContainer$1 = styled.div`
|
|
9330
|
+
height: ${({ $hasIcon }) => $hasIcon ? "24px" : "16px"};
|
|
9331
|
+
display: flex;
|
|
9332
|
+
align-items: center;
|
|
9333
|
+
`;
|
|
9334
|
+
const RadioCardDefaultLayout = ({ icon, label, description, showIndicator = true, isGated = false }) => {
|
|
9335
|
+
const gatedIcon = useGatedIcon();
|
|
9336
|
+
return /* @__PURE__ */ jsxs(StyledCardContent$1, { children: [
|
|
9337
|
+
showIndicator ? /* @__PURE__ */ jsx(StyledIndicatorContainer$1, {
|
|
9338
|
+
$hasIcon: isNotNil(icon),
|
|
9339
|
+
children: /* @__PURE__ */ jsx(RadioCardIndicator, { "data-testid": "wui-radio-card-indicator" })
|
|
9340
|
+
}) : null,
|
|
9341
|
+
isGated ? /* @__PURE__ */ jsx(StyledGatedIcon, {
|
|
9342
|
+
"data-testid": "wui-radio-gated-icon",
|
|
9343
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
9344
|
+
colorScheme: "purple",
|
|
9345
|
+
"data-testid": "wui-icon-sparkle",
|
|
9346
|
+
type: gatedIcon
|
|
9347
|
+
})
|
|
9348
|
+
}) : null,
|
|
9349
|
+
/* @__PURE__ */ jsxs(Stack, {
|
|
9350
|
+
gap: "space-02",
|
|
9351
|
+
children: [isNotNil(icon) && /* @__PURE__ */ jsx(StyledCardIcon$1, {
|
|
9352
|
+
"data-wui-radio-card-icon": true,
|
|
9353
|
+
children: icon
|
|
9354
|
+
}), /* @__PURE__ */ jsxs(Stack, {
|
|
9355
|
+
gap: "space-01",
|
|
9356
|
+
style: isNotNil(icon) ? { paddingLeft: 2 } : void 0,
|
|
9357
|
+
children: [isNotNil(label) && /* @__PURE__ */ jsx(Text, {
|
|
9358
|
+
variant: "label3",
|
|
9359
|
+
children: /* @__PURE__ */ jsx("strong", { children: label })
|
|
9360
|
+
}), isNotNil(description) && /* @__PURE__ */ jsx(Text, {
|
|
9361
|
+
prominence: "secondary",
|
|
9362
|
+
variant: "body3",
|
|
9363
|
+
children: description
|
|
9364
|
+
})]
|
|
9365
|
+
})]
|
|
9366
|
+
})
|
|
9367
|
+
] });
|
|
9368
|
+
};
|
|
9369
|
+
RadioCardDefaultLayout.displayName = "RadioCardDefaultLayout_UI";
|
|
9370
|
+
//#endregion
|
|
9232
9371
|
//#region src/components/CheckboxCard/CheckboxCardIndicator.tsx
|
|
9233
9372
|
const CheckIcon = () => /* @__PURE__ */ jsx("svg", {
|
|
9234
9373
|
fill: "inherit",
|
|
@@ -9290,33 +9429,27 @@ const CheckboxCardIndicator = (props) => /* @__PURE__ */ jsx(StyledIndicator, {
|
|
|
9290
9429
|
CheckboxCardIndicator.displayName = "CheckboxCardIndicator_UI";
|
|
9291
9430
|
//#endregion
|
|
9292
9431
|
//#region src/components/CheckboxCard/CheckboxCardDefaultLayout.tsx
|
|
9293
|
-
const StyledCardContent
|
|
9432
|
+
const StyledCardContent = styled.div`
|
|
9294
9433
|
display: grid;
|
|
9295
9434
|
grid-auto-flow: column;
|
|
9296
9435
|
gap: var(--wui-space-02);
|
|
9297
9436
|
`;
|
|
9298
|
-
const StyledCardIcon
|
|
9437
|
+
const StyledCardIcon = styled.div`
|
|
9299
9438
|
display: contents;
|
|
9300
9439
|
`;
|
|
9301
|
-
const
|
|
9302
|
-
position: absolute;
|
|
9303
|
-
right: 10px;
|
|
9304
|
-
top: 10px;
|
|
9305
|
-
z-index: 1;
|
|
9306
|
-
`;
|
|
9307
|
-
const StyledIndicatorContainer$1 = styled.div`
|
|
9440
|
+
const StyledIndicatorContainer = styled.div`
|
|
9308
9441
|
height: ${({ $hasIcon }) => $hasIcon ? "24px" : "16px"};
|
|
9309
9442
|
display: flex;
|
|
9310
9443
|
align-items: center;
|
|
9311
9444
|
`;
|
|
9312
9445
|
const CheckboxCardDefaultLayout = ({ icon, label, description, showIndicator = true, isGated = false }) => {
|
|
9313
9446
|
const gatedIcon = useGatedIcon();
|
|
9314
|
-
return /* @__PURE__ */ jsxs(StyledCardContent
|
|
9315
|
-
showIndicator ? /* @__PURE__ */ jsx(StyledIndicatorContainer
|
|
9447
|
+
return /* @__PURE__ */ jsxs(StyledCardContent, { children: [
|
|
9448
|
+
showIndicator ? /* @__PURE__ */ jsx(StyledIndicatorContainer, {
|
|
9316
9449
|
$hasIcon: isNotNil(icon),
|
|
9317
9450
|
children: /* @__PURE__ */ jsx(CheckboxCardIndicator, { "data-testid": "wui-checkbox-card-indicator" })
|
|
9318
9451
|
}) : null,
|
|
9319
|
-
isGated ? /* @__PURE__ */ jsx(StyledGatedIcon
|
|
9452
|
+
isGated ? /* @__PURE__ */ jsx(StyledGatedIcon, {
|
|
9320
9453
|
"data-testid": "wui-checkbox-gated-icon",
|
|
9321
9454
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
9322
9455
|
colorScheme: "purple",
|
|
@@ -9326,7 +9459,7 @@ const CheckboxCardDefaultLayout = ({ icon, label, description, showIndicator = t
|
|
|
9326
9459
|
}) : null,
|
|
9327
9460
|
/* @__PURE__ */ jsxs(Stack, {
|
|
9328
9461
|
gap: "space-02",
|
|
9329
|
-
children: [isNotNil(icon) && /* @__PURE__ */ jsx(StyledCardIcon
|
|
9462
|
+
children: [isNotNil(icon) && /* @__PURE__ */ jsx(StyledCardIcon, {
|
|
9330
9463
|
"data-wui-checkbox-card-icon": true,
|
|
9331
9464
|
children: icon
|
|
9332
9465
|
}), /* @__PURE__ */ jsxs(Stack, {
|
|
@@ -16256,112 +16389,6 @@ const RadioCardChildrenContainer = styled.div`
|
|
|
16256
16389
|
flex: 1 1 auto;
|
|
16257
16390
|
`;
|
|
16258
16391
|
//#endregion
|
|
16259
|
-
//#region src/components/RadioCard/RadioCardIndicator.tsx
|
|
16260
|
-
const RadioCardIndicator = styled.div`
|
|
16261
|
-
--wui-radio-card-indicator-size: 14px;
|
|
16262
|
-
--wui-radio-card-indicator-background-color: var(--wui-color-bg-surface);
|
|
16263
|
-
--wui-radio-card-indicator-fill-color: var(--wui-color-bg-fill);
|
|
16264
|
-
|
|
16265
|
-
/* TODO: figure out radio / checkbox / switch colors */
|
|
16266
|
-
--wui-radio-card-indicator-border-color: var(--wui-color-border-secondary-active);
|
|
16267
|
-
|
|
16268
|
-
width: var(--wui-radio-card-indicator-size);
|
|
16269
|
-
height: var(--wui-radio-card-indicator-size);
|
|
16270
|
-
min-width: var(--wui-radio-card-indicator-size);
|
|
16271
|
-
min-height: var(--wui-radio-card-indicator-size);
|
|
16272
|
-
background-color: var(--wui-radio-card-indicator-background-color);
|
|
16273
|
-
box-shadow: inset 0 0 0 1px var(--wui-radio-card-indicator-border-color);
|
|
16274
|
-
border-radius: 100%;
|
|
16275
|
-
position: relative;
|
|
16276
|
-
cursor: pointer;
|
|
16277
|
-
transition: border-color var(--wui-motion-duration-03) var(--wui-motion-ease);
|
|
16278
|
-
|
|
16279
|
-
&::after {
|
|
16280
|
-
content: '';
|
|
16281
|
-
position: absolute;
|
|
16282
|
-
top: 50%;
|
|
16283
|
-
left: 50%;
|
|
16284
|
-
width: 0;
|
|
16285
|
-
height: 0;
|
|
16286
|
-
background-color: var(--wui-radio-card-indicator-fill-color);
|
|
16287
|
-
border-radius: 100%;
|
|
16288
|
-
transform: translate(-50%, -50%);
|
|
16289
|
-
}
|
|
16290
|
-
|
|
16291
|
-
${StyledCard}:has(input:checked) & {
|
|
16292
|
-
--wui-radio-card-indicator-border-color: var(--wui-color-focus-ring);
|
|
16293
|
-
--wui-radio-card-indicator-fill-color: var(--wui-color-focus-ring);
|
|
16294
|
-
|
|
16295
|
-
&::after {
|
|
16296
|
-
width: calc(var(--wui-radio-card-indicator-size) / 2);
|
|
16297
|
-
height: calc(var(--wui-radio-card-indicator-size) / 2);
|
|
16298
|
-
}
|
|
16299
|
-
}
|
|
16300
|
-
|
|
16301
|
-
${StyledCard}:has(input:disabled) & {
|
|
16302
|
-
--wui-radio-card-indicator-border-color: var(--wui-color-border-secondary);
|
|
16303
|
-
--wui-radio-card-indicator-background-color: var(--wui-color-bg-surface-disabled);
|
|
16304
|
-
}
|
|
16305
|
-
`;
|
|
16306
|
-
RadioCardIndicator.displayName = "RadioCardIndicator_UI";
|
|
16307
|
-
//#endregion
|
|
16308
|
-
//#region src/components/RadioCard/RadioCardDefaultLayout.tsx
|
|
16309
|
-
const StyledCardContent = styled.div`
|
|
16310
|
-
display: grid;
|
|
16311
|
-
grid-auto-flow: column;
|
|
16312
|
-
gap: var(--wui-space-02);
|
|
16313
|
-
`;
|
|
16314
|
-
const StyledCardIcon = styled.div`
|
|
16315
|
-
display: contents;
|
|
16316
|
-
`;
|
|
16317
|
-
const StyledGatedIcon = styled.div`
|
|
16318
|
-
position: absolute;
|
|
16319
|
-
right: 10px;
|
|
16320
|
-
top: 10px;
|
|
16321
|
-
z-index: 1;
|
|
16322
|
-
`;
|
|
16323
|
-
const StyledIndicatorContainer = styled.div`
|
|
16324
|
-
height: ${({ $hasIcon }) => $hasIcon ? "24px" : "16px"};
|
|
16325
|
-
display: flex;
|
|
16326
|
-
align-items: center;
|
|
16327
|
-
`;
|
|
16328
|
-
const RadioCardDefaultLayout = ({ icon, label, description, showIndicator = true, isGated = false }) => {
|
|
16329
|
-
const gatedIcon = useGatedIcon();
|
|
16330
|
-
return /* @__PURE__ */ jsxs(StyledCardContent, { children: [
|
|
16331
|
-
showIndicator ? /* @__PURE__ */ jsx(StyledIndicatorContainer, {
|
|
16332
|
-
$hasIcon: isNotNil(icon),
|
|
16333
|
-
children: /* @__PURE__ */ jsx(RadioCardIndicator, { "data-testid": "wui-radio-card-indicator" })
|
|
16334
|
-
}) : null,
|
|
16335
|
-
isGated ? /* @__PURE__ */ jsx(StyledGatedIcon, {
|
|
16336
|
-
"data-testid": "wui-radio-gated-icon",
|
|
16337
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
16338
|
-
colorScheme: "purple",
|
|
16339
|
-
"data-testid": "wui-icon-sparkle",
|
|
16340
|
-
type: gatedIcon
|
|
16341
|
-
})
|
|
16342
|
-
}) : null,
|
|
16343
|
-
/* @__PURE__ */ jsxs(Stack, {
|
|
16344
|
-
gap: "space-02",
|
|
16345
|
-
children: [isNotNil(icon) && /* @__PURE__ */ jsx(StyledCardIcon, {
|
|
16346
|
-
"data-wui-radio-card-icon": true,
|
|
16347
|
-
children: icon
|
|
16348
|
-
}), /* @__PURE__ */ jsxs(Stack, {
|
|
16349
|
-
gap: "space-01",
|
|
16350
|
-
style: isNotNil(icon) ? { paddingLeft: 2 } : void 0,
|
|
16351
|
-
children: [isNotNil(label) && /* @__PURE__ */ jsx(Text, {
|
|
16352
|
-
variant: "label3",
|
|
16353
|
-
children: /* @__PURE__ */ jsx("strong", { children: label })
|
|
16354
|
-
}), isNotNil(description) && /* @__PURE__ */ jsx(Text, {
|
|
16355
|
-
prominence: "secondary",
|
|
16356
|
-
variant: "body3",
|
|
16357
|
-
children: description
|
|
16358
|
-
})]
|
|
16359
|
-
})]
|
|
16360
|
-
})
|
|
16361
|
-
] });
|
|
16362
|
-
};
|
|
16363
|
-
RadioCardDefaultLayout.displayName = "RadioCardDefaultLayout_UI";
|
|
16364
|
-
//#endregion
|
|
16365
16392
|
//#region src/components/RadioCard/RadioCard.tsx
|
|
16366
16393
|
/**
|
|
16367
16394
|
* A `RadioCard` lets users select exactly one option from a set of visually rich, card-based choices.
|
|
@@ -16902,14 +16929,19 @@ const Sidebar = ({ children, ref, ...props }) => {
|
|
|
16902
16929
|
});
|
|
16903
16930
|
};
|
|
16904
16931
|
//#endregion
|
|
16905
|
-
//#region src/components/Sidebar/
|
|
16906
|
-
const
|
|
16932
|
+
//#region src/components/Sidebar/sidebarSectionStyles.ts
|
|
16933
|
+
const sidebarSectionStyles = css`
|
|
16907
16934
|
display: flex;
|
|
16908
16935
|
flex-direction: column;
|
|
16909
16936
|
width: 100%;
|
|
16910
16937
|
padding-block: var(--wui-sidebar-padding-block);
|
|
16911
16938
|
padding-inline: var(--wui-sidebar-padding-inline);
|
|
16912
16939
|
`;
|
|
16940
|
+
//#endregion
|
|
16941
|
+
//#region src/components/Sidebar/SidebarHeader.tsx
|
|
16942
|
+
const StyledSidebarHeader = styled.div`
|
|
16943
|
+
${sidebarSectionStyles}
|
|
16944
|
+
`;
|
|
16913
16945
|
const SidebarHeader = ({ children }) => {
|
|
16914
16946
|
return /* @__PURE__ */ jsx(StyledSidebarHeader, {
|
|
16915
16947
|
"data-wui-sidebar-header": true,
|
|
@@ -16920,11 +16952,7 @@ SidebarHeader.displayName = "SidebarHeader_UI";
|
|
|
16920
16952
|
//#endregion
|
|
16921
16953
|
//#region src/components/Sidebar/SidebarFooter.tsx
|
|
16922
16954
|
const StyledSidebarFooter = styled.div`
|
|
16923
|
-
|
|
16924
|
-
flex-direction: column;
|
|
16925
|
-
width: 100%;
|
|
16926
|
-
padding-block: var(--wui-sidebar-padding-block);
|
|
16927
|
-
padding-inline: var(--wui-sidebar-padding-inline);
|
|
16955
|
+
${sidebarSectionStyles}
|
|
16928
16956
|
`;
|
|
16929
16957
|
const SidebarFooter = ({ children }) => {
|
|
16930
16958
|
return /* @__PURE__ */ jsx(StyledSidebarFooter, {
|