@wistia/ui 0.22.8 → 0.22.9-beta.014159f2.bdc0210
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 +190 -76
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +590 -456
- package/dist/index.js.map +1 -1
- package/package.json +24 -23
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.22.
|
|
3
|
+
* @license @wistia/ui v0.22.9-beta.014159f2.bdc0210
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
7
7
|
* This source code is unlicensed, all rights reserved.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
11
11
|
import { Children, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useTransition } from "react";
|
|
12
12
|
import { createGlobalStyle, css, keyframes, styled } from "styled-components";
|
|
13
13
|
import { isArray, isBoolean, isEmptyString, isFunction, isNil, isNonEmptyArray, isNonEmptyString, isNotNil, isNotUndefined, isNumber, isRecord, isString, isUndefined } from "@wistia/type-guards";
|
|
@@ -18,23 +18,25 @@ import { useFilePicker as useFilePicker$1, useImperativeFilePicker as useImperat
|
|
|
18
18
|
import { FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, ImageDimensionsValidator, PersistentFileAmountLimitValidator } from "use-file-picker/validators";
|
|
19
19
|
import { debounce, throttle } from "throttle-debounce";
|
|
20
20
|
import { Link as Link$1, useInRouterContext } from "react-router";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
21
|
+
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
22
|
+
import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
|
|
23
23
|
import { differenceEuclidean, easingSmootherstep, formatHex, interpolate, modeHsv, modeLrgb, modeRgb, parseHex, useMode, wcagContrast } from "culori/fn";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
24
|
+
import { Radio as Radio$1 } from "@base-ui/react/radio";
|
|
25
|
+
import { ToggleGroup } from "@base-ui/react/toggle-group";
|
|
26
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
27
|
+
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
28
|
+
import { Slider as Slider$1 } from "@base-ui/react/slider";
|
|
27
29
|
import * as Ariakit from "@ariakit/react";
|
|
28
30
|
import { matchSorter } from "match-sorter";
|
|
29
31
|
import { createPortal } from "react-dom";
|
|
30
|
-
import {
|
|
32
|
+
import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
31
33
|
import { ValidationError } from "yup";
|
|
32
|
-
import {
|
|
34
|
+
import { PreviewCard as PreviewCard$1 } from "@base-ui/react/preview-card";
|
|
33
35
|
import ReactMarkdown from "react-markdown";
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
36
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
37
|
+
import { Progress } from "@base-ui/react/progress";
|
|
38
|
+
import { Select as Select$1 } from "@base-ui/react/select";
|
|
39
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
38
40
|
//#region src/css/globalStyleAdjustmentsCss.tsx
|
|
39
41
|
const globalStyleAdjustmentsCss = css`
|
|
40
42
|
/**
|
|
@@ -444,7 +446,7 @@ const UIProvider = ({ children }) => {
|
|
|
444
446
|
if (useContext(UIProviderNestingContext)) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
445
447
|
return /* @__PURE__ */ jsx(UIProviderNestingContext.Provider, {
|
|
446
448
|
value: true,
|
|
447
|
-
children: /* @__PURE__ */ jsx(AriaLiveProvider, { children: /* @__PURE__ */ jsxs(Provider, { children: [
|
|
449
|
+
children: /* @__PURE__ */ jsx(AriaLiveProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1.Provider, { children: [
|
|
448
450
|
/* @__PURE__ */ jsx(GlobalStyle, {}),
|
|
449
451
|
children,
|
|
450
452
|
/* @__PURE__ */ jsx(ToastProvider, {})
|
|
@@ -6900,30 +6902,39 @@ const ClickRegion = ({ children, targetRef }) => {
|
|
|
6900
6902
|
ClickRegion.displayName = "ClickRegion_UI";
|
|
6901
6903
|
//#endregion
|
|
6902
6904
|
//#region src/components/Collapsible/Collapsible.tsx
|
|
6903
|
-
const StyledRoot = styled(
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6905
|
+
const StyledRoot = styled(Collapsible$1.Root)`
|
|
6906
|
+
${({ $isOpen }) => !$isOpen && css`
|
|
6907
|
+
[data-wui-collapsible-content] {
|
|
6908
|
+
display: -webkit-box;
|
|
6909
|
+
-webkit-box-orient: vertical;
|
|
6910
|
+
-webkit-line-clamp: var(--wui-collapsible-content-clamp-lines);
|
|
6911
|
+
overflow: hidden;
|
|
6912
|
+
}
|
|
6913
|
+
`}
|
|
6910
6914
|
`;
|
|
6911
6915
|
/**
|
|
6912
6916
|
* Toggle the visibility of content with a trigger.
|
|
6913
6917
|
*/
|
|
6914
|
-
const Collapsible = ({ children, isOpen
|
|
6918
|
+
const Collapsible = ({ children, isOpen, onOpenChange }) => {
|
|
6919
|
+
const isControlled = isNotNil(isOpen);
|
|
6920
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
6921
|
+
const handleOpenChange = (open) => {
|
|
6922
|
+
if (!isControlled) setInternalOpen(open);
|
|
6923
|
+
onOpenChange?.(open);
|
|
6924
|
+
};
|
|
6915
6925
|
return /* @__PURE__ */ jsx(StyledRoot, {
|
|
6916
|
-
|
|
6926
|
+
$isOpen: isControlled ? isOpen : internalOpen,
|
|
6927
|
+
...isControlled ? {
|
|
6917
6928
|
open: isOpen,
|
|
6918
|
-
onOpenChange
|
|
6919
|
-
} : {},
|
|
6929
|
+
onOpenChange: handleOpenChange
|
|
6930
|
+
} : { onOpenChange: handleOpenChange },
|
|
6920
6931
|
children
|
|
6921
6932
|
});
|
|
6922
6933
|
};
|
|
6923
6934
|
Collapsible.displayName = "Collapsible_UI";
|
|
6924
6935
|
//#endregion
|
|
6925
6936
|
//#region src/components/Collapsible/CollapsibleTrigger.tsx
|
|
6926
|
-
const StyledTrigger$1 = styled(
|
|
6937
|
+
const StyledTrigger$1 = styled(Collapsible$1.Trigger)`
|
|
6927
6938
|
[data-wui-collapsible-icon] {
|
|
6928
6939
|
transition: transform var(--wui-motion-duration-03) ease-in-out;
|
|
6929
6940
|
}
|
|
@@ -6946,10 +6957,7 @@ const StyledTrigger$1 = styled(Trigger$1)`
|
|
|
6946
6957
|
`;
|
|
6947
6958
|
const CollapsibleTrigger = ({ children }) => {
|
|
6948
6959
|
Children.only(children);
|
|
6949
|
-
return /* @__PURE__ */ jsx(StyledTrigger$1, {
|
|
6950
|
-
asChild: true,
|
|
6951
|
-
children
|
|
6952
|
-
});
|
|
6960
|
+
return /* @__PURE__ */ jsx(StyledTrigger$1, { render: children });
|
|
6953
6961
|
};
|
|
6954
6962
|
//#endregion
|
|
6955
6963
|
//#region src/components/Collapsible/CollapsibleTriggerIcon.tsx
|
|
@@ -6980,7 +6988,7 @@ const CollapsibleContent = ({ clamp, children }) => {
|
|
|
6980
6988
|
"data-wui-collapsible-content": "true",
|
|
6981
6989
|
children
|
|
6982
6990
|
});
|
|
6983
|
-
return /* @__PURE__ */ jsx(
|
|
6991
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Panel, { children: /* @__PURE__ */ jsxs(Fragment, { children: [children, " "] }) });
|
|
6984
6992
|
};
|
|
6985
6993
|
//#endregion
|
|
6986
6994
|
//#region src/components/ColorPicker/color-conversion-utils.ts
|
|
@@ -7455,7 +7463,7 @@ const Container$9 = styled.div`
|
|
|
7455
7463
|
const LabelContainer$1 = styled.div`
|
|
7456
7464
|
padding-top: var(--wui-space-01);
|
|
7457
7465
|
`;
|
|
7458
|
-
const ItemsContainer$1 = styled(
|
|
7466
|
+
const ItemsContainer$1 = styled(RadioGroup$1)`
|
|
7459
7467
|
display: flex;
|
|
7460
7468
|
flex-wrap: wrap;
|
|
7461
7469
|
align-items: center;
|
|
@@ -7470,7 +7478,7 @@ const ItemsContainer$1 = styled(Root$2)`
|
|
|
7470
7478
|
const ColorGrid = ({ children, label }) => {
|
|
7471
7479
|
const { valueAsHex, onChangeNonDerivedValueAsHsv } = useColorPickerState();
|
|
7472
7480
|
const onValueChange = useCallback((value) => {
|
|
7473
|
-
onChangeNonDerivedValueAsHsv(convertToHsv(value));
|
|
7481
|
+
if (typeof value === "string") onChangeNonDerivedValueAsHsv(convertToHsv(value));
|
|
7474
7482
|
}, [onChangeNonDerivedValueAsHsv]);
|
|
7475
7483
|
return /* @__PURE__ */ jsxs(Container$9, { children: [label != null && /* @__PURE__ */ jsx(LabelContainer$1, { children: /* @__PURE__ */ jsx(Label, { children: label }) }), /* @__PURE__ */ jsx(ItemsContainer$1, {
|
|
7476
7484
|
onValueChange,
|
|
@@ -7568,7 +7576,7 @@ const slideRightAndFade = keyframes`
|
|
|
7568
7576
|
transform: translateX(0);
|
|
7569
7577
|
}
|
|
7570
7578
|
`;
|
|
7571
|
-
const
|
|
7579
|
+
const StyledPopup$5 = styled(Tooltip$1.Popup)`
|
|
7572
7580
|
--tooltip-font-family: var(--wui-typography-family-default);
|
|
7573
7581
|
--tooltip-border-radius: var(--wui-border-radius-05);
|
|
7574
7582
|
--tooltip-bg: var(--wui-color-bg-tooltip);
|
|
@@ -7594,27 +7602,54 @@ const StyledContent$3 = styled(Content)`
|
|
|
7594
7602
|
max-width: 30em;
|
|
7595
7603
|
z-index: var(--wui-zindex-tooltip);
|
|
7596
7604
|
|
|
7597
|
-
&[data-
|
|
7605
|
+
&[data-closed] {
|
|
7598
7606
|
animation-name: ${hide};
|
|
7599
7607
|
}
|
|
7600
7608
|
|
|
7601
|
-
&[data-
|
|
7609
|
+
&[data-open][data-side='top'] {
|
|
7602
7610
|
animation-name: ${slideUpAndFade};
|
|
7603
7611
|
}
|
|
7604
7612
|
|
|
7605
|
-
&[data-
|
|
7613
|
+
&[data-open][data-side='right'] {
|
|
7606
7614
|
animation-name: ${slideRightAndFade};
|
|
7607
7615
|
}
|
|
7608
7616
|
|
|
7609
|
-
&[data-
|
|
7617
|
+
&[data-open][data-side='bottom'] {
|
|
7610
7618
|
animation-name: ${slideDownAndFade};
|
|
7611
7619
|
}
|
|
7612
7620
|
|
|
7613
|
-
&[data-
|
|
7621
|
+
&[data-open][data-side='left'] {
|
|
7614
7622
|
animation-name: ${slideLeftAndFade};
|
|
7615
7623
|
}
|
|
7624
|
+
|
|
7625
|
+
overflow: visible;
|
|
7626
|
+
`;
|
|
7627
|
+
const arrowEdgeCss = css`
|
|
7628
|
+
&[data-side='top'] {
|
|
7629
|
+
bottom: 0;
|
|
7630
|
+
transform: translateY(calc(100% - 2px));
|
|
7631
|
+
}
|
|
7632
|
+
|
|
7633
|
+
&[data-side='bottom'] {
|
|
7634
|
+
top: 0;
|
|
7635
|
+
transform: translateY(calc(-100% + 2px)) rotate(180deg);
|
|
7636
|
+
}
|
|
7637
|
+
|
|
7638
|
+
&[data-side='left'] {
|
|
7639
|
+
right: 0;
|
|
7640
|
+
transform: translateX(calc(100% - 4px)) rotate(-90deg);
|
|
7641
|
+
}
|
|
7642
|
+
|
|
7643
|
+
&[data-side='right'] {
|
|
7644
|
+
left: 0;
|
|
7645
|
+
transform: translateX(calc(-100% + 4px)) rotate(90deg);
|
|
7646
|
+
}
|
|
7647
|
+
`;
|
|
7648
|
+
const StyledTooltipArrow = styled.svg`
|
|
7649
|
+
${arrowEdgeCss}
|
|
7616
7650
|
`;
|
|
7617
7651
|
const VISUAL_OFFSET = 6;
|
|
7652
|
+
const ARROW_EXTENSION = 6;
|
|
7618
7653
|
/**
|
|
7619
7654
|
* Tooltips are a way to provide additional information or context to a user when they hover or focus an element.
|
|
7620
7655
|
* For elements that are not interactive, consider using a [Popover]() instead.
|
|
@@ -7624,29 +7659,27 @@ const Tooltip = ({ delay = 500, direction = "top", content, children, forceOpen,
|
|
|
7624
7659
|
const rootProps = {};
|
|
7625
7660
|
if (content === "" || content === null) rootProps.open = false;
|
|
7626
7661
|
if (forceOpen === true) rootProps.open = true;
|
|
7627
|
-
return /* @__PURE__ */ jsxs(Root, {
|
|
7628
|
-
delayDuration: delay,
|
|
7662
|
+
return /* @__PURE__ */ jsxs(Tooltip$1.Root, {
|
|
7629
7663
|
...rootProps,
|
|
7630
|
-
children: [/* @__PURE__ */ jsx(Trigger, {
|
|
7631
|
-
|
|
7632
|
-
children
|
|
7633
|
-
}), /* @__PURE__ */ jsx(Portal, {
|
|
7634
|
-
container,
|
|
7635
|
-
children: /* @__PURE__ */
|
|
7664
|
+
children: [/* @__PURE__ */ jsx(Tooltip$1.Trigger, {
|
|
7665
|
+
delay,
|
|
7666
|
+
render: isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children })
|
|
7667
|
+
}), /* @__PURE__ */ jsx(Tooltip$1.Portal, {
|
|
7668
|
+
...container != null ? { container } : {},
|
|
7669
|
+
children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
7636
7670
|
side: direction,
|
|
7637
|
-
sideOffset: hideArrow ? VISUAL_OFFSET : VISUAL_OFFSET
|
|
7638
|
-
children:
|
|
7639
|
-
|
|
7640
|
-
children: /* @__PURE__ */ jsx(
|
|
7671
|
+
sideOffset: hideArrow ? VISUAL_OFFSET : VISUAL_OFFSET + ARROW_EXTENSION,
|
|
7672
|
+
children: /* @__PURE__ */ jsxs(StyledPopup$5, {
|
|
7673
|
+
role: "tooltip",
|
|
7674
|
+
children: [content, !hideArrow ? /* @__PURE__ */ jsx(Tooltip$1.Arrow, { render: /* @__PURE__ */ jsx(StyledTooltipArrow, {
|
|
7641
7675
|
fill: "var(--tooltip-bg)",
|
|
7642
7676
|
height: "8",
|
|
7643
|
-
style: { transform: "translateY(-2px)" },
|
|
7644
7677
|
viewBox: "0 0 12 8",
|
|
7645
7678
|
width: "12",
|
|
7646
7679
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7647
7680
|
children: /* @__PURE__ */ jsx("path", { d: "M6.8 6.93333C6.4 7.46667 5.6 7.46667 5.2 6.93333L-2.54292e-07 -1.04907e-06L12 0L6.8 6.93333Z" })
|
|
7648
|
-
})
|
|
7649
|
-
})
|
|
7681
|
+
}) }) : null]
|
|
7682
|
+
})
|
|
7650
7683
|
})
|
|
7651
7684
|
})]
|
|
7652
7685
|
});
|
|
@@ -7654,7 +7687,7 @@ const Tooltip = ({ delay = 500, direction = "top", content, children, forceOpen,
|
|
|
7654
7687
|
Tooltip.displayName = "Tooltip_UI";
|
|
7655
7688
|
//#endregion
|
|
7656
7689
|
//#region src/components/ColorPicker/ColorGridOption.tsx
|
|
7657
|
-
const Container$8 = styled(
|
|
7690
|
+
const Container$8 = styled(Radio$1.Root)`
|
|
7658
7691
|
border: none;
|
|
7659
7692
|
appearance: none;
|
|
7660
7693
|
outline: none;
|
|
@@ -7673,7 +7706,6 @@ const ColorGridOption = ({ value: rawValue, name }) => {
|
|
|
7673
7706
|
const { valueAsHsv, nonDerivedValueAsHex } = useColorPickerState();
|
|
7674
7707
|
const valueAsHex = formatHex(valueAsHsv);
|
|
7675
7708
|
const isSelected = valueAsHex === value;
|
|
7676
|
-
const derivativeIsSelected = !isSelected && nonDerivedValueAsHex === value;
|
|
7677
7709
|
return /* @__PURE__ */ jsx(Tooltip, {
|
|
7678
7710
|
content: name ?? /* @__PURE__ */ jsx("span", {
|
|
7679
7711
|
style: { fontFamily: "var(--wui-typography-family-mono)" },
|
|
@@ -7686,7 +7718,7 @@ const ColorGridOption = ({ value: rawValue, name }) => {
|
|
|
7686
7718
|
tabIndex: -1,
|
|
7687
7719
|
value,
|
|
7688
7720
|
children: /* @__PURE__ */ jsx(ColorSwatch, {
|
|
7689
|
-
derivativeIsSelected,
|
|
7721
|
+
derivativeIsSelected: !isSelected && nonDerivedValueAsHex === value,
|
|
7690
7722
|
isSelected,
|
|
7691
7723
|
value
|
|
7692
7724
|
})
|
|
@@ -7696,7 +7728,7 @@ const ColorGridOption = ({ value: rawValue, name }) => {
|
|
|
7696
7728
|
ColorGridOption.displayName = "ColorGridOption_UI";
|
|
7697
7729
|
//#endregion
|
|
7698
7730
|
//#region src/components/ColorPicker/ColorList.tsx
|
|
7699
|
-
const Container$7 = styled(
|
|
7731
|
+
const Container$7 = styled(ToggleGroup)`
|
|
7700
7732
|
display: grid;
|
|
7701
7733
|
grid-template-columns: minmax(0, 1fr);
|
|
7702
7734
|
`;
|
|
@@ -7708,12 +7740,12 @@ const Container$7 = styled(Root$3)`
|
|
|
7708
7740
|
const ColorList = ({ children }) => {
|
|
7709
7741
|
const { valueAsHex, onChangeNonDerivedValueAsHsv } = useColorPickerState();
|
|
7710
7742
|
return /* @__PURE__ */ jsx(Container$7, {
|
|
7711
|
-
onValueChange: useCallback((
|
|
7712
|
-
|
|
7743
|
+
onValueChange: useCallback((newValue) => {
|
|
7744
|
+
const value = newValue[0];
|
|
7745
|
+
if (value === void 0 || value === "") return;
|
|
7713
7746
|
onChangeNonDerivedValueAsHsv(convertToHsv(value));
|
|
7714
7747
|
}, [onChangeNonDerivedValueAsHsv]),
|
|
7715
|
-
|
|
7716
|
-
value: valueAsHex,
|
|
7748
|
+
value: [valueAsHex],
|
|
7717
7749
|
children
|
|
7718
7750
|
});
|
|
7719
7751
|
};
|
|
@@ -7765,7 +7797,7 @@ const ColorNameOrHexCode = ({ name, hexCode }) => {
|
|
|
7765
7797
|
};
|
|
7766
7798
|
//#endregion
|
|
7767
7799
|
//#region src/components/ColorPicker/ColorListOption.tsx
|
|
7768
|
-
const Container$5 = styled(
|
|
7800
|
+
const Container$5 = styled(Toggle)`
|
|
7769
7801
|
border: none;
|
|
7770
7802
|
appearance: none;
|
|
7771
7803
|
outline: none;
|
|
@@ -7796,7 +7828,6 @@ const ColorListOption = ({ value: rawValue, name }) => {
|
|
|
7796
7828
|
const { valueAsHsv, nonDerivedValueAsHex } = useColorPickerState();
|
|
7797
7829
|
const valueAsHex = formatHex(valueAsHsv);
|
|
7798
7830
|
const isSelected = valueAsHex === value;
|
|
7799
|
-
const derivativeIsSelected = !isSelected && nonDerivedValueAsHex === value;
|
|
7800
7831
|
return /* @__PURE__ */ jsxs(Container$5, {
|
|
7801
7832
|
"aria-label": value,
|
|
7802
7833
|
"aria-selected": valueAsHex === value,
|
|
@@ -7804,7 +7835,7 @@ const ColorListOption = ({ value: rawValue, name }) => {
|
|
|
7804
7835
|
tabIndex: -1,
|
|
7805
7836
|
value,
|
|
7806
7837
|
children: [/* @__PURE__ */ jsx(ColorSwatch, {
|
|
7807
|
-
derivativeIsSelected,
|
|
7838
|
+
derivativeIsSelected: !isSelected && nonDerivedValueAsHex === value,
|
|
7808
7839
|
isSelected,
|
|
7809
7840
|
value
|
|
7810
7841
|
}), /* @__PURE__ */ jsx(ColorNameOrHexCode, {
|
|
@@ -7815,6 +7846,19 @@ const ColorListOption = ({ value: rawValue, name }) => {
|
|
|
7815
7846
|
};
|
|
7816
7847
|
ColorListOption.displayName = "ColorListOption_UI";
|
|
7817
7848
|
//#endregion
|
|
7849
|
+
//#region src/components/ColorPicker/normalizeHexColor.ts
|
|
7850
|
+
/**
|
|
7851
|
+
* A helper to ensure that a given hex code is normalized for all variants (short-hand, missing hex prefix, uppercase)
|
|
7852
|
+
*
|
|
7853
|
+
* @param hexValue
|
|
7854
|
+
* @returns string, a hex code value with a hash prefix followed by 6 hex characters
|
|
7855
|
+
*/
|
|
7856
|
+
const normalizeHexColor = (hexValue) => {
|
|
7857
|
+
const hexValueWithHash = hexValue.startsWith("#") ? hexValue.toLowerCase() : `#${hexValue.toLowerCase()}`;
|
|
7858
|
+
if (hexValueWithHash.length === 4) return `#${hexValueWithHash[1]}${hexValueWithHash[1]}${hexValueWithHash[2]}${hexValueWithHash[2]}${hexValueWithHash[3]}${hexValueWithHash[3]}`;
|
|
7859
|
+
return hexValueWithHash;
|
|
7860
|
+
};
|
|
7861
|
+
//#endregion
|
|
7818
7862
|
//#region src/components/ColorPicker/ColorPicker.tsx
|
|
7819
7863
|
/**
|
|
7820
7864
|
* A composable color picker built from low-level building blocks. Choose the
|
|
@@ -7826,11 +7870,11 @@ ColorListOption.displayName = "ColorListOption_UI";
|
|
|
7826
7870
|
* sensible defaults (brand colors, contrast controls, popover/inline modes).
|
|
7827
7871
|
*/
|
|
7828
7872
|
const ColorPicker = ({ children, colorForComparison = DEFAULT_COLOR_FOR_COMPARISON, minimumContrastRatio = DEFAULT_MIN_CONTRAST, onOpenChange, opacityForContrastCalculation = 1, onValueChange, value }) => {
|
|
7829
|
-
const normalizedValue =
|
|
7873
|
+
const normalizedValue = normalizeHexColor(value);
|
|
7830
7874
|
const handleOpenChange = (isOpen) => {
|
|
7831
7875
|
if (isFunction(onOpenChange)) onOpenChange(isOpen);
|
|
7832
7876
|
};
|
|
7833
|
-
return /* @__PURE__ */ jsx(Root
|
|
7877
|
+
return /* @__PURE__ */ jsx(Popover$1.Root, {
|
|
7834
7878
|
modal: false,
|
|
7835
7879
|
onOpenChange: handleOpenChange,
|
|
7836
7880
|
children: /* @__PURE__ */ jsx(ColorPickerProvider, {
|
|
@@ -7846,7 +7890,7 @@ const ColorPicker = ({ children, colorForComparison = DEFAULT_COLOR_FOR_COMPARIS
|
|
|
7846
7890
|
ColorPicker.displayName = "ColorPicker_UI";
|
|
7847
7891
|
//#endregion
|
|
7848
7892
|
//#region src/components/ColorPicker/ColorPickerPopoverContent.tsx
|
|
7849
|
-
const
|
|
7893
|
+
const StyledPopup$4 = styled(Popover$1.Popup)`
|
|
7850
7894
|
background-color: var(--wui-color-bg-surface);
|
|
7851
7895
|
border-radius: var(--wui-border-radius-02);
|
|
7852
7896
|
border: 1px solid var(--wui-color-border);
|
|
@@ -7863,10 +7907,10 @@ const StyledPopoverContent = styled(Content$2)`
|
|
|
7863
7907
|
* Use `ColorPickerSection` to organize content within it.
|
|
7864
7908
|
*/
|
|
7865
7909
|
const ColorPickerPopoverContent = ({ children }) => {
|
|
7866
|
-
return /* @__PURE__ */ jsx(
|
|
7910
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
7867
7911
|
align: "start",
|
|
7868
7912
|
sideOffset: 4,
|
|
7869
|
-
children
|
|
7913
|
+
children: /* @__PURE__ */ jsx(StyledPopup$4, { children })
|
|
7870
7914
|
}) });
|
|
7871
7915
|
};
|
|
7872
7916
|
ColorPickerPopoverContent.displayName = "ColorPickerPopoverContent_UI";
|
|
@@ -7913,7 +7957,7 @@ const ValueNameOrHexCode = (props) => {
|
|
|
7913
7957
|
ValueNameOrHexCode.displayName = "ValueNameOrHexCode_UI";
|
|
7914
7958
|
//#endregion
|
|
7915
7959
|
//#region src/components/ColorPicker/ColorPickerTrigger.tsx
|
|
7916
|
-
const StyledPopoverTrigger = styled(Trigger
|
|
7960
|
+
const StyledPopoverTrigger = styled(Popover$1.Trigger)`
|
|
7917
7961
|
background-color: var(--wui-color-bg-surface);
|
|
7918
7962
|
border-radius: var(--wui-border-radius-rounded);
|
|
7919
7963
|
border: none;
|
|
@@ -8566,7 +8610,7 @@ const Container$2 = styled.div`
|
|
|
8566
8610
|
padding: 0 var(--wui-space-03);
|
|
8567
8611
|
position: relative;
|
|
8568
8612
|
`;
|
|
8569
|
-
const Root
|
|
8613
|
+
const Root = styled(Slider$1.Root)`
|
|
8570
8614
|
align-items: center;
|
|
8571
8615
|
display: flex;
|
|
8572
8616
|
position: absolute;
|
|
@@ -8575,10 +8619,10 @@ const Root$11 = styled(Root$5)`
|
|
|
8575
8619
|
width: calc(100% - var(--wui-space-05));
|
|
8576
8620
|
height: 16px;
|
|
8577
8621
|
`;
|
|
8578
|
-
const Track
|
|
8622
|
+
const Track = styled(Slider$1.Track)`
|
|
8579
8623
|
width: 100%;
|
|
8580
8624
|
`;
|
|
8581
|
-
const Thumb$
|
|
8625
|
+
const Thumb$1 = styled(Slider$1.Thumb)`
|
|
8582
8626
|
position: relative;
|
|
8583
8627
|
`;
|
|
8584
8628
|
const ThumbInner = styled.div`
|
|
@@ -8593,7 +8637,7 @@ const ThumbInner = styled.div`
|
|
|
8593
8637
|
transform: translate(-50%, -50%);
|
|
8594
8638
|
width: 16px;
|
|
8595
8639
|
|
|
8596
|
-
${Thumb$
|
|
8640
|
+
${Thumb$1}:focus-visible > & {
|
|
8597
8641
|
box-shadow:
|
|
8598
8642
|
inset 0 0 0 2px var(--wui-color-border),
|
|
8599
8643
|
inset 0 0 0 3px black;
|
|
@@ -8618,7 +8662,7 @@ const HueSlider = (props) => {
|
|
|
8618
8662
|
return { backgroundColor: formatHex(valueAsHsv) };
|
|
8619
8663
|
}, [valueAsHsv]);
|
|
8620
8664
|
const onHueChange = useCallback((values) => {
|
|
8621
|
-
const newHue = values[0] ?? 0;
|
|
8665
|
+
const newHue = typeof values === "number" ? values : values[0] ?? 0;
|
|
8622
8666
|
onChangeNonDerivedValueAsHsv({
|
|
8623
8667
|
...nonDerivedValueAsHsv,
|
|
8624
8668
|
h: newHue
|
|
@@ -8627,17 +8671,17 @@ const HueSlider = (props) => {
|
|
|
8627
8671
|
return /* @__PURE__ */ jsxs(Container$2, {
|
|
8628
8672
|
...props,
|
|
8629
8673
|
style: containerStyle,
|
|
8630
|
-
children: [/* @__PURE__ */
|
|
8674
|
+
children: [/* @__PURE__ */ jsx(Root, {
|
|
8631
8675
|
max: 360,
|
|
8632
8676
|
min: 0,
|
|
8633
8677
|
onValueChange: onHueChange,
|
|
8634
8678
|
orientation: "horizontal",
|
|
8635
8679
|
step: 1,
|
|
8636
8680
|
value: [nonDerivedValueAsHsv.h ?? 0],
|
|
8637
|
-
children: [/* @__PURE__ */ jsx(Track
|
|
8681
|
+
children: /* @__PURE__ */ jsxs(Slider$1.Control, { children: [/* @__PURE__ */ jsx(Track, {}), /* @__PURE__ */ jsx(Thumb$1, {
|
|
8638
8682
|
"aria-label": "Hue slider",
|
|
8639
8683
|
children: /* @__PURE__ */ jsx(ThumbInner, { style: thumbInnerStyle })
|
|
8640
|
-
})]
|
|
8684
|
+
})] })
|
|
8641
8685
|
}), /* @__PURE__ */ jsx(HSVHueCanvas, { hsv: valueAsHsv })]
|
|
8642
8686
|
});
|
|
8643
8687
|
};
|
|
@@ -8767,7 +8811,7 @@ const Container$1 = styled.div`
|
|
|
8767
8811
|
overflow: hidden;
|
|
8768
8812
|
position: relative;
|
|
8769
8813
|
`;
|
|
8770
|
-
const Thumb
|
|
8814
|
+
const Thumb = styled.button.attrs({ type: "button" })`
|
|
8771
8815
|
appearance: none;
|
|
8772
8816
|
border-radius: var(--wui-border-radius-rounded);
|
|
8773
8817
|
border: none;
|
|
@@ -8902,7 +8946,7 @@ const SaturationAndValuePicker = ({ dataTestId }) => {
|
|
|
8902
8946
|
"data-testid": dataTestId,
|
|
8903
8947
|
onMouseDown: onContainerMouseDown,
|
|
8904
8948
|
children: [
|
|
8905
|
-
/* @__PURE__ */ jsx(Thumb
|
|
8949
|
+
/* @__PURE__ */ jsx(Thumb, {
|
|
8906
8950
|
ref: thumbRef,
|
|
8907
8951
|
"aria-describedby": instructionsId,
|
|
8908
8952
|
"aria-label": "Saturation and value thumb",
|
|
@@ -9367,18 +9411,18 @@ const menuContentCss = css`
|
|
|
9367
9411
|
font-family: var(--menu-font-family);
|
|
9368
9412
|
background: var(--menu-bg);
|
|
9369
9413
|
border-radius: var(--menu-border-radius);
|
|
9370
|
-
box-shadow: var(--menu-shadow);
|
|
9371
|
-
max-height: var(--
|
|
9414
|
+
box-shadow: var(--menu-shadow);
|
|
9415
|
+
max-height: var(--available-height);
|
|
9372
9416
|
min-width: var(--menu-min-width);
|
|
9373
9417
|
max-width: var(--menu-max-width);
|
|
9374
9418
|
overflow: auto;
|
|
9375
9419
|
padding: var(--menu-padding);
|
|
9376
|
-
transform-origin: var(--
|
|
9420
|
+
transform-origin: var(--transform-origin);
|
|
9377
9421
|
z-index: var(--wui-zindex-menu);
|
|
9378
9422
|
border: 1px solid var(--wui-color-border);
|
|
9379
9423
|
|
|
9380
|
-
&[data-
|
|
9381
|
-
animation: var(--menu-animation-duration) var(--wui-motion-ease-in) ${close};
|
|
9424
|
+
&[data-closed] {
|
|
9425
|
+
animation: var(--menu-animation-duration) var(--wui-motion-ease-in) ${close};
|
|
9382
9426
|
}
|
|
9383
9427
|
|
|
9384
9428
|
${mq.smAndUp} {
|
|
@@ -9393,18 +9437,21 @@ const menuContentCss = css`
|
|
|
9393
9437
|
margin: var(--menu-divider-margin) 0;
|
|
9394
9438
|
}
|
|
9395
9439
|
`;
|
|
9396
|
-
const
|
|
9440
|
+
const MenuPopup = styled(Menu$1.Popup)`
|
|
9397
9441
|
${menuContentCss}
|
|
9398
|
-
min-width: var(--
|
|
9442
|
+
min-width: var(--anchor-width);
|
|
9399
9443
|
`;
|
|
9400
9444
|
/**
|
|
9401
9445
|
* Displays a menu to the users with a set of actions.
|
|
9402
9446
|
*/
|
|
9403
9447
|
const Menu = forwardRef(({ align = "start", children, disabled = false, compact = false, trigger, label, isOpen, side = "bottom", triggerProps = {}, onOpenChange, ...props }, ref) => {
|
|
9404
9448
|
const contextValue = useMemo(() => ({ compact }), [compact]);
|
|
9449
|
+
const handleOpenChange = useCallback((nextOpen) => {
|
|
9450
|
+
if (nextOpen !== isOpen) onOpenChange?.(nextOpen);
|
|
9451
|
+
}, [isOpen, onOpenChange]);
|
|
9405
9452
|
let controlProps = { ...isNotNil(onOpenChange) && isNotNil(isOpen) ? {
|
|
9406
9453
|
open: isOpen,
|
|
9407
|
-
onOpenChange
|
|
9454
|
+
onOpenChange: handleOpenChange
|
|
9408
9455
|
} : {} };
|
|
9409
9456
|
if (disabled) controlProps = {
|
|
9410
9457
|
open: false,
|
|
@@ -9412,50 +9459,43 @@ const Menu = forwardRef(({ align = "start", children, disabled = false, compact
|
|
|
9412
9459
|
};
|
|
9413
9460
|
return /* @__PURE__ */ jsx(MenuContext.Provider, {
|
|
9414
9461
|
value: contextValue,
|
|
9415
|
-
children: /* @__PURE__ */ jsxs(
|
|
9462
|
+
children: /* @__PURE__ */ jsxs(Menu$1.Root, {
|
|
9416
9463
|
modal: false,
|
|
9417
9464
|
...controlProps,
|
|
9418
|
-
children: [/* @__PURE__ */ jsx(
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
...triggerProps,
|
|
9427
|
-
children: label
|
|
9428
|
-
})
|
|
9429
|
-
}), /* @__PURE__ */ jsx(DropdownMenuPortal, { children: /* @__PURE__ */ jsx(MenuContent, {
|
|
9430
|
-
...props,
|
|
9431
|
-
$compact: compact,
|
|
9465
|
+
children: [/* @__PURE__ */ jsx(Menu$1.Trigger, { render: isNotUndefined(trigger) ? trigger : /* @__PURE__ */ jsx(Button, {
|
|
9466
|
+
ref,
|
|
9467
|
+
disabled,
|
|
9468
|
+
forceState: isOpen ? "active" : void 0,
|
|
9469
|
+
rightIcon: /* @__PURE__ */ jsx(Icon, { type: "caret-down" }),
|
|
9470
|
+
...triggerProps,
|
|
9471
|
+
children: label
|
|
9472
|
+
}) }), /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(Menu$1.Positioner, {
|
|
9432
9473
|
align,
|
|
9433
9474
|
collisionPadding: 8,
|
|
9434
|
-
onFocusOutside: (event) => {
|
|
9435
|
-
event.preventDefault();
|
|
9436
|
-
},
|
|
9437
9475
|
side,
|
|
9438
9476
|
sideOffset: 6,
|
|
9439
|
-
children
|
|
9477
|
+
children: /* @__PURE__ */ jsx(MenuPopup, {
|
|
9478
|
+
...props,
|
|
9479
|
+
$compact: compact,
|
|
9480
|
+
children
|
|
9481
|
+
})
|
|
9440
9482
|
}) })]
|
|
9441
9483
|
})
|
|
9442
9484
|
});
|
|
9443
9485
|
});
|
|
9444
9486
|
Menu.displayName = "Menu_UI";
|
|
9445
|
-
Menu.displayName = "Menu_UI";
|
|
9446
9487
|
//#endregion
|
|
9447
9488
|
//#region src/components/Menu/MenuLabel.tsx
|
|
9448
|
-
const StyledMenuLabel = styled
|
|
9489
|
+
const StyledMenuLabel = styled.div`
|
|
9449
9490
|
padding: var(--wui-space-02);
|
|
9450
9491
|
`;
|
|
9451
9492
|
const MenuLabel = ({ children, ...props }) => {
|
|
9452
9493
|
return /* @__PURE__ */ jsx(StyledMenuLabel, {
|
|
9453
|
-
|
|
9494
|
+
role: "group",
|
|
9454
9495
|
...props,
|
|
9455
9496
|
children: /* @__PURE__ */ jsx(Heading, {
|
|
9456
9497
|
renderAs: "span",
|
|
9457
9498
|
variant: "heading6",
|
|
9458
|
-
...props,
|
|
9459
9499
|
children
|
|
9460
9500
|
})
|
|
9461
9501
|
});
|
|
@@ -9586,7 +9626,7 @@ const MenuItemDescription = ({ children }) => {
|
|
|
9586
9626
|
};
|
|
9587
9627
|
//#endregion
|
|
9588
9628
|
//#region src/components/Menu/SubMenu.tsx
|
|
9589
|
-
const
|
|
9629
|
+
const SubMenuPopup = styled(Menu$1.Popup)`
|
|
9590
9630
|
${menuContentCss}
|
|
9591
9631
|
|
|
9592
9632
|
${mq.smAndDown} {
|
|
@@ -9596,19 +9636,19 @@ const SubMenuContent = styled(DropdownMenuSubContent)`
|
|
|
9596
9636
|
const StyledMobileSubMenuItems = styled.div`
|
|
9597
9637
|
margin-left: var(--wui-space-04);
|
|
9598
9638
|
`;
|
|
9599
|
-
const StyledSubTrigger = styled(
|
|
9639
|
+
const StyledSubTrigger = styled(Menu$1.SubmenuTrigger)`
|
|
9600
9640
|
outline: none;
|
|
9601
9641
|
|
|
9602
|
-
&[data-
|
|
9642
|
+
&[data-popup-open],
|
|
9603
9643
|
&[data-highlighted] {
|
|
9604
9644
|
background-color: var(--wui-color-bg-surface-hover);
|
|
9605
9645
|
}
|
|
9606
9646
|
`;
|
|
9607
9647
|
const SubMenuTrigger = ({ icon, ...props }) => {
|
|
9608
9648
|
const { isSmAndUp } = useMq();
|
|
9609
|
-
return /* @__PURE__ */ jsx(isSmAndUp ? StyledSubTrigger :
|
|
9610
|
-
|
|
9611
|
-
|
|
9649
|
+
return /* @__PURE__ */ jsx(isSmAndUp ? StyledSubTrigger : Menu$1.Item, {
|
|
9650
|
+
nativeButton: true,
|
|
9651
|
+
render: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
9612
9652
|
...props,
|
|
9613
9653
|
leftIcon: icon,
|
|
9614
9654
|
rightIcon: /* @__PURE__ */ jsx(Icon, { type: "caret-right" })
|
|
@@ -9619,32 +9659,33 @@ const SubMenu = ({ label, description, children, onOpenChange = () => null, ...p
|
|
|
9619
9659
|
const { isSmAndUp } = useMq();
|
|
9620
9660
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
9621
9661
|
const { compact } = useMenuContext();
|
|
9622
|
-
return isSmAndUp ? /* @__PURE__ */ jsxs(
|
|
9662
|
+
return isSmAndUp ? /* @__PURE__ */ jsxs(Menu$1.SubmenuRoot, {
|
|
9623
9663
|
onOpenChange,
|
|
9624
9664
|
children: [/* @__PURE__ */ jsxs(SubMenuTrigger, {
|
|
9625
9665
|
...props,
|
|
9626
9666
|
children: [/* @__PURE__ */ jsx(MenuItemLabel, { children: label }), isNotNil(description) ? /* @__PURE__ */ jsx(MenuItemDescription, { children: description }) : null]
|
|
9627
|
-
}), /* @__PURE__ */ jsx(
|
|
9667
|
+
}), /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(Menu$1.Positioner, { children: /* @__PURE__ */ jsx(SubMenuPopup, {
|
|
9628
9668
|
$compact: compact,
|
|
9629
9669
|
children
|
|
9630
|
-
}) })]
|
|
9631
|
-
}) : /* @__PURE__ */ jsxs(
|
|
9670
|
+
}) }) })]
|
|
9671
|
+
}) : /* @__PURE__ */ jsxs(Menu$1.Group, { children: [/* @__PURE__ */ jsxs(SubMenuTrigger, {
|
|
9632
9672
|
...props,
|
|
9633
9673
|
onClick: (event) => {
|
|
9634
9674
|
event.preventDefault();
|
|
9635
9675
|
setIsExpanded((prev) => !prev);
|
|
9636
9676
|
},
|
|
9637
|
-
children: [/* @__PURE__ */ jsx(MenuItemLabel, { children: label }), /* @__PURE__ */ jsx(MenuItemDescription, { children: description })]
|
|
9677
|
+
children: [/* @__PURE__ */ jsx(MenuItemLabel, { children: label }), isNotNil(description) ? /* @__PURE__ */ jsx(MenuItemDescription, { children: description }) : null]
|
|
9638
9678
|
}), /* @__PURE__ */ jsx(StyledMobileSubMenuItems, { children: isExpanded ? children : null })] });
|
|
9639
9679
|
};
|
|
9640
9680
|
SubMenu.displayName = "SubMenu_UI";
|
|
9641
9681
|
//#endregion
|
|
9642
9682
|
//#region src/components/Menu/MenuItem.tsx
|
|
9643
|
-
const MenuItem = forwardRef(({ onSelect = () => null, ...props }, ref) => {
|
|
9644
|
-
return /* @__PURE__ */ jsx(
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9683
|
+
const MenuItem = forwardRef(({ onSelect = () => null, closeOnClick = true, ...props }, ref) => {
|
|
9684
|
+
return /* @__PURE__ */ jsx(Menu$1.Item, {
|
|
9685
|
+
closeOnClick,
|
|
9686
|
+
nativeButton: isNil(props.href),
|
|
9687
|
+
onClick: onSelect,
|
|
9688
|
+
render: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
9648
9689
|
...props,
|
|
9649
9690
|
ref,
|
|
9650
9691
|
leftIcon: props.icon
|
|
@@ -9655,7 +9696,7 @@ MenuItem.displayName = "MenuItem_UI";
|
|
|
9655
9696
|
//#endregion
|
|
9656
9697
|
//#region src/components/Menu/MenuRadioGroup.tsx
|
|
9657
9698
|
const MenuRadioGroup = ({ children, ...props }) => {
|
|
9658
|
-
return /* @__PURE__ */ jsx(
|
|
9699
|
+
return /* @__PURE__ */ jsx(Menu$1.RadioGroup, {
|
|
9659
9700
|
...props,
|
|
9660
9701
|
children
|
|
9661
9702
|
});
|
|
@@ -9667,14 +9708,16 @@ const RadioMenuItem = ({ onSelect, value, indicator = /* @__PURE__ */ jsx(Icon,
|
|
|
9667
9708
|
size: "sm",
|
|
9668
9709
|
type: "checkmark"
|
|
9669
9710
|
}), ...props }) => {
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9711
|
+
const extraProps = onSelect ? { onClick: onSelect } : {};
|
|
9712
|
+
return /* @__PURE__ */ jsx(Menu$1.RadioItem, {
|
|
9713
|
+
closeOnClick: false,
|
|
9714
|
+
nativeButton: true,
|
|
9715
|
+
...extraProps,
|
|
9716
|
+
render: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
9675
9717
|
...props,
|
|
9676
|
-
rightIcon: /* @__PURE__ */ jsx(
|
|
9677
|
-
})
|
|
9718
|
+
rightIcon: /* @__PURE__ */ jsx(Menu$1.RadioItemIndicator, { children: indicator })
|
|
9719
|
+
}),
|
|
9720
|
+
value
|
|
9678
9721
|
});
|
|
9679
9722
|
};
|
|
9680
9723
|
RadioMenuItem.displayName = "RadioMenuItem_UI";
|
|
@@ -9712,15 +9755,16 @@ const CheckboxIndicator = ({ checked, ...props }) => {
|
|
|
9712
9755
|
});
|
|
9713
9756
|
};
|
|
9714
9757
|
const CheckboxMenuItem = ({ onSelect = () => null, checked, onCheckedChange, ...props }) => {
|
|
9715
|
-
return /* @__PURE__ */ jsx(
|
|
9716
|
-
asChild: true,
|
|
9758
|
+
return /* @__PURE__ */ jsx(Menu$1.CheckboxItem, {
|
|
9717
9759
|
checked,
|
|
9760
|
+
closeOnClick: false,
|
|
9761
|
+
nativeButton: true,
|
|
9718
9762
|
onCheckedChange,
|
|
9719
|
-
onSelect,
|
|
9720
|
-
|
|
9763
|
+
onClick: onSelect,
|
|
9764
|
+
render: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
9721
9765
|
...props,
|
|
9722
9766
|
leftIcon: isNotNil(props.icon) ? props.icon : /* @__PURE__ */ jsx(CheckboxIndicator, { checked }),
|
|
9723
|
-
rightIcon: isNotNil(props.icon) ? /* @__PURE__ */ jsx(
|
|
9767
|
+
rightIcon: isNotNil(props.icon) ? /* @__PURE__ */ jsx(Menu$1.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(Icon, { type: "checkmark" }) }) : void 0
|
|
9724
9768
|
})
|
|
9725
9769
|
});
|
|
9726
9770
|
};
|
|
@@ -9774,7 +9818,7 @@ const FilterMenu = forwardRef(({ value, onChange, searchValue, onSearchValueChan
|
|
|
9774
9818
|
disabled: true,
|
|
9775
9819
|
children: "No results found"
|
|
9776
9820
|
}),
|
|
9777
|
-
value.length > 0 && /* @__PURE__ */ jsx(
|
|
9821
|
+
value.length > 0 && /* @__PURE__ */ jsx(Menu$1.Item, {
|
|
9778
9822
|
disabled: true,
|
|
9779
9823
|
style: { marginTop: "24px" },
|
|
9780
9824
|
children: /* @__PURE__ */ jsx(Card, {
|
|
@@ -11295,21 +11339,21 @@ const previewCardClose = keyframes`
|
|
|
11295
11339
|
transform: scale(0.96);
|
|
11296
11340
|
}
|
|
11297
11341
|
`;
|
|
11298
|
-
const
|
|
11342
|
+
const StyledPopup$3 = styled(PreviewCard$1.Popup)`
|
|
11299
11343
|
--preview-card-animation-duration: var(--wui-motion-duration-03);
|
|
11300
11344
|
--preview-card-animation-ease: var(--wui-motion-ease-out);
|
|
11301
11345
|
|
|
11302
11346
|
z-index: var(--wui-zindex-popover);
|
|
11303
|
-
transform-origin: var(--
|
|
11347
|
+
transform-origin: var(--transform-origin);
|
|
11304
11348
|
animation-duration: var(--preview-card-animation-duration);
|
|
11305
11349
|
animation-timing-function: var(--preview-card-animation-ease);
|
|
11306
11350
|
will-change: transform, opacity;
|
|
11307
11351
|
|
|
11308
|
-
&[data-
|
|
11352
|
+
&[data-open] {
|
|
11309
11353
|
animation-name: ${previewCardOpen};
|
|
11310
11354
|
}
|
|
11311
11355
|
|
|
11312
|
-
&[data-
|
|
11356
|
+
&[data-closed] {
|
|
11313
11357
|
animation-name: ${previewCardClose};
|
|
11314
11358
|
}
|
|
11315
11359
|
|
|
@@ -11328,28 +11372,31 @@ const StyledContent$2 = styled(Content$3)`
|
|
|
11328
11372
|
/**
|
|
11329
11373
|
* Preview cards reveal content on hover. **Everything in the card must also exist at the destination**—never put information only in the preview. This pattern is for sighted-only, so treat the card as a preview, not a source of truth.
|
|
11330
11374
|
*/
|
|
11331
|
-
const PreviewCard = ({ children, trigger, maxWidth = "320px", maxHeight = "auto", unstyled = false, paddingSize = "space-04", openDelay = 700, closeDelay = 300, colorScheme = "inherit", forceOpen, ...props }) => {
|
|
11375
|
+
const PreviewCard = ({ children, trigger, maxWidth = "320px", maxHeight = "auto", unstyled = false, paddingSize = "space-04", openDelay = 700, closeDelay = 300, colorScheme = "inherit", forceOpen, side, align, ...props }) => {
|
|
11332
11376
|
const style = {
|
|
11333
11377
|
"--wui-preview-card-max-width": maxWidth,
|
|
11334
11378
|
"--wui-preview-card-max-height": maxHeight
|
|
11335
11379
|
};
|
|
11336
11380
|
const rootProps = {};
|
|
11337
11381
|
if (forceOpen === true) rootProps.open = true;
|
|
11338
|
-
return /* @__PURE__ */ jsxs(Root
|
|
11339
|
-
closeDelay,
|
|
11340
|
-
openDelay,
|
|
11382
|
+
return /* @__PURE__ */ jsxs(PreviewCard$1.Root, {
|
|
11341
11383
|
...rootProps,
|
|
11342
|
-
children: [/* @__PURE__ */ jsx(Trigger
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11384
|
+
children: [/* @__PURE__ */ jsx(PreviewCard$1.Trigger, {
|
|
11385
|
+
closeDelay,
|
|
11386
|
+
delay: openDelay,
|
|
11387
|
+
render: trigger
|
|
11388
|
+
}), /* @__PURE__ */ jsx(PreviewCard$1.Portal, { children: /* @__PURE__ */ jsx(PreviewCard$1.Positioner, {
|
|
11389
|
+
align,
|
|
11390
|
+
side,
|
|
11348
11391
|
sideOffset: 8,
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11392
|
+
children: /* @__PURE__ */ jsx(StyledPopup$3, {
|
|
11393
|
+
$colorScheme: colorScheme,
|
|
11394
|
+
$paddingSize: paddingSize,
|
|
11395
|
+
...props,
|
|
11396
|
+
$unstyled: unstyled,
|
|
11397
|
+
style,
|
|
11398
|
+
children: /* @__PURE__ */ jsx("div", { children })
|
|
11399
|
+
})
|
|
11353
11400
|
}) })]
|
|
11354
11401
|
});
|
|
11355
11402
|
};
|
|
@@ -11542,7 +11589,7 @@ const StyledKey = styled.kbd`
|
|
|
11542
11589
|
min-width: 20px;
|
|
11543
11590
|
padding: 0 var(--wui-space-01);
|
|
11544
11591
|
`;
|
|
11545
|
-
const Label$
|
|
11592
|
+
const Label$1 = styled.span`
|
|
11546
11593
|
color: var(--wui-color-text);
|
|
11547
11594
|
font-size: 12px;
|
|
11548
11595
|
`;
|
|
@@ -11578,7 +11625,7 @@ const keyToString = (key) => {
|
|
|
11578
11625
|
const KeyboardShortcut = ({ label, keyboardKeys, fullWidth = false, ...otherProps }) => /* @__PURE__ */ jsxs(StyledKeyboardShortcut, {
|
|
11579
11626
|
$fullWidth: fullWidth,
|
|
11580
11627
|
...otherProps,
|
|
11581
|
-
children: [isNotNil(label) && /* @__PURE__ */ jsx(Label$
|
|
11628
|
+
children: [isNotNil(label) && /* @__PURE__ */ jsx(Label$1, { children: label }), /* @__PURE__ */ jsx(KeysContainer, { children: (Array.isArray(keyboardKeys) ? keyboardKeys : [keyboardKeys]).map((keyboardKey, index) => /* @__PURE__ */ jsx(StyledKey, { children: keyToString(keyboardKey) }, index)) })]
|
|
11582
11629
|
});
|
|
11583
11630
|
KeyboardShortcut.displayName = "KeyboardShortcut_UI";
|
|
11584
11631
|
//#endregion
|
|
@@ -12026,19 +12073,14 @@ const Meter = ({ segments, label, labelMeta, description, hideKey = false, max =
|
|
|
12026
12073
|
Meter.displayName = "Meter_UI";
|
|
12027
12074
|
//#endregion
|
|
12028
12075
|
//#region src/components/Modal/ModalCloseButton.tsx
|
|
12029
|
-
const CloseButton = styled(Close$1)`
|
|
12030
|
-
align-self: start;
|
|
12031
|
-
`;
|
|
12032
12076
|
const ModalCloseButton = () => {
|
|
12033
|
-
return /* @__PURE__ */ jsx(
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
})
|
|
12041
|
-
});
|
|
12077
|
+
return /* @__PURE__ */ jsx(Dialog.Close, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
12078
|
+
label: "Dismiss modal",
|
|
12079
|
+
size: "sm",
|
|
12080
|
+
style: { alignSelf: "start" },
|
|
12081
|
+
variant: "ghost",
|
|
12082
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
12083
|
+
}) });
|
|
12042
12084
|
};
|
|
12043
12085
|
//#endregion
|
|
12044
12086
|
//#region src/components/Modal/ModalHeader.tsx
|
|
@@ -12050,7 +12092,7 @@ const Header = styled.header`
|
|
|
12050
12092
|
gap: var(--wui-space-01);
|
|
12051
12093
|
justify-content: ${({ $hideTitle }) => $hideTitle ? "flex-end" : "space-between"}; /* ensure ModalCloseButton is right-aligned */
|
|
12052
12094
|
|
|
12053
|
-
/*
|
|
12095
|
+
/* Dialog.Title creates an h2 element which inherits some margin */
|
|
12054
12096
|
h2 {
|
|
12055
12097
|
margin: 0;
|
|
12056
12098
|
padding-right: ${({ $hideCloseButon }) => $hideCloseButon ? "0" : "var(--wui-space-03)"};
|
|
@@ -12062,7 +12104,7 @@ const Header = styled.header`
|
|
|
12062
12104
|
top: var(--wui-space-03);
|
|
12063
12105
|
}
|
|
12064
12106
|
`;
|
|
12065
|
-
const Title
|
|
12107
|
+
const Title = styled(Dialog.Title)`
|
|
12066
12108
|
font-family: var(--wui-typography-heading-2-family);
|
|
12067
12109
|
line-height: var(--wui-typography-heading-2-line-height);
|
|
12068
12110
|
font-size: var(--wui-typography-heading-2-size);
|
|
@@ -12073,30 +12115,13 @@ const ModalHeader = ({ title, hideTitle, hideCloseButton }) => {
|
|
|
12073
12115
|
return /* @__PURE__ */ jsxs(Header, {
|
|
12074
12116
|
$hideCloseButon: hideCloseButton,
|
|
12075
12117
|
$hideTitle: hideTitle,
|
|
12076
|
-
children: [hideTitle ? /* @__PURE__ */ jsx(ScreenReaderOnly, { children: /* @__PURE__ */ jsx(Title
|
|
12118
|
+
children: [hideTitle ? /* @__PURE__ */ jsx(ScreenReaderOnly, { children: /* @__PURE__ */ jsx(Title, { children: title }) }) : /* @__PURE__ */ jsx(Title, { children: title }), hideCloseButton ? null : /* @__PURE__ */ jsx(ModalCloseButton, {})]
|
|
12077
12119
|
});
|
|
12078
12120
|
};
|
|
12079
12121
|
//#endregion
|
|
12080
12122
|
//#region src/components/Modal/constants.ts
|
|
12081
12123
|
const DEFAULT_MODAL_WIDTH = "532px";
|
|
12082
12124
|
//#endregion
|
|
12083
|
-
//#region src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
12084
|
-
const useFocusRestore = () => {
|
|
12085
|
-
const previouslyFocusedRef = useRef(null);
|
|
12086
|
-
const timeoutRef = useRef(null);
|
|
12087
|
-
useEffect(() => {
|
|
12088
|
-
previouslyFocusedRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
12089
|
-
}, []);
|
|
12090
|
-
useEffect(() => {
|
|
12091
|
-
return () => {
|
|
12092
|
-
if (isNotNil(timeoutRef.current)) clearTimeout(timeoutRef.current);
|
|
12093
|
-
if (isNotNil(previouslyFocusedRef.current)) timeoutRef.current = setTimeout(() => {
|
|
12094
|
-
previouslyFocusedRef.current?.focus();
|
|
12095
|
-
}, 0);
|
|
12096
|
-
};
|
|
12097
|
-
}, []);
|
|
12098
|
-
};
|
|
12099
|
-
//#endregion
|
|
12100
12125
|
//#region src/components/Modal/ModalContent.tsx
|
|
12101
12126
|
const modalEnter = keyframes`
|
|
12102
12127
|
from {
|
|
@@ -12120,7 +12145,8 @@ const modalExit = keyframes`
|
|
|
12120
12145
|
transform: translateX(-50%) translateY(calc(var(--wui-modal-translate-y) + 24px));
|
|
12121
12146
|
}
|
|
12122
12147
|
`;
|
|
12123
|
-
const
|
|
12148
|
+
const positionStyleMap = {
|
|
12149
|
+
centered: css`
|
|
12124
12150
|
--wui-modal-screen-offset: var(--wui-space-05);
|
|
12125
12151
|
--wui-modal-translate-y: -50%;
|
|
12126
12152
|
|
|
@@ -12132,11 +12158,11 @@ const centeredModalStyles = css`
|
|
|
12132
12158
|
transform-origin: left center;
|
|
12133
12159
|
animation: ${modalEnter} var(--wui-motion-duration-04) var(--wui-motion-ease-out);
|
|
12134
12160
|
|
|
12135
|
-
&[data-
|
|
12161
|
+
&[data-closed] {
|
|
12136
12162
|
animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out);
|
|
12137
12163
|
}
|
|
12138
|
-
|
|
12139
|
-
|
|
12164
|
+
`,
|
|
12165
|
+
"fixed-top": css`
|
|
12140
12166
|
--wui-modal-screen-offset-top: 15vh;
|
|
12141
12167
|
--wui-modal-screen-offset-bottom: 5vh;
|
|
12142
12168
|
--wui-modal-translate-y: 0%;
|
|
@@ -12151,11 +12177,11 @@ const fixedTopModalStyles = css`
|
|
|
12151
12177
|
transform-origin: left center;
|
|
12152
12178
|
animation: ${modalEnter} var(--wui-motion-duration-04) var(--wui-motion-ease-out);
|
|
12153
12179
|
|
|
12154
|
-
&[data-
|
|
12180
|
+
&[data-closed] {
|
|
12155
12181
|
animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out);
|
|
12156
12182
|
}
|
|
12157
|
-
|
|
12158
|
-
|
|
12183
|
+
`,
|
|
12184
|
+
"right-side-panel": css`
|
|
12159
12185
|
--wui-modal-screen-offset: var(--wui-space-05);
|
|
12160
12186
|
|
|
12161
12187
|
height: calc(100vh - var(--wui-modal-screen-offset) * 2);
|
|
@@ -12174,7 +12200,7 @@ const rightSidePanelModalStyles = css`
|
|
|
12174
12200
|
`} var(--wui-motion-duration-05) var(--wui-motion-ease-out);
|
|
12175
12201
|
transform-origin: right center;
|
|
12176
12202
|
|
|
12177
|
-
&[data-
|
|
12203
|
+
&[data-closed] {
|
|
12178
12204
|
animation: ${keyframes`
|
|
12179
12205
|
from {
|
|
12180
12206
|
opacity: 1;
|
|
@@ -12187,13 +12213,9 @@ const rightSidePanelModalStyles = css`
|
|
|
12187
12213
|
}
|
|
12188
12214
|
`} var(--wui-motion-duration-03) var(--wui-motion-ease-in);
|
|
12189
12215
|
}
|
|
12190
|
-
|
|
12191
|
-
const positionStyleMap = {
|
|
12192
|
-
centered: centeredModalStyles,
|
|
12193
|
-
"fixed-top": fixedTopModalStyles,
|
|
12194
|
-
"right-side-panel": rightSidePanelModalStyles
|
|
12216
|
+
`
|
|
12195
12217
|
};
|
|
12196
|
-
const StyledModalContent = styled(
|
|
12218
|
+
const StyledModalContent = styled(Dialog.Popup)`
|
|
12197
12219
|
position: fixed;
|
|
12198
12220
|
display: flex;
|
|
12199
12221
|
flex-direction: column;
|
|
@@ -12220,12 +12242,12 @@ const StyledModalContent = styled(Content$4)`
|
|
|
12220
12242
|
${({ $positionVariant }) => positionStyleMap[$positionVariant]}
|
|
12221
12243
|
}
|
|
12222
12244
|
`;
|
|
12223
|
-
const ModalContent = forwardRef(({ width, positionVariant = "fixed-top", children, ...props }, ref) => {
|
|
12224
|
-
useFocusRestore();
|
|
12245
|
+
const ModalContent = forwardRef(({ width, positionVariant = "fixed-top", initialFocusRef, children, ...props }, ref) => {
|
|
12225
12246
|
return /* @__PURE__ */ jsx(StyledModalContent, {
|
|
12226
12247
|
ref,
|
|
12227
12248
|
$positionVariant: positionVariant,
|
|
12228
12249
|
$width: width,
|
|
12250
|
+
...isNotNil(initialFocusRef) ? { initialFocus: initialFocusRef } : {},
|
|
12229
12251
|
...props,
|
|
12230
12252
|
children
|
|
12231
12253
|
});
|
|
@@ -12251,20 +12273,20 @@ const backdropHide = keyframes`
|
|
|
12251
12273
|
opacity: 0;
|
|
12252
12274
|
}
|
|
12253
12275
|
`;
|
|
12254
|
-
const ModalOverlay = styled(
|
|
12276
|
+
const ModalOverlay = styled(Dialog.Backdrop)`
|
|
12255
12277
|
animation: ${backdropShow} var(--wui-motion-duration-02);
|
|
12256
12278
|
background: var(--wui-color-backdrop);
|
|
12257
12279
|
inset: 0;
|
|
12258
12280
|
position: fixed;
|
|
12259
12281
|
z-index: var(--wui-zindex-backdrop);
|
|
12260
12282
|
|
|
12261
|
-
&[data-
|
|
12283
|
+
&[data-closed] {
|
|
12262
12284
|
animation: ${backdropHide} var(--wui-motion-duration-02);
|
|
12263
12285
|
}
|
|
12264
12286
|
`;
|
|
12265
12287
|
//#endregion
|
|
12266
12288
|
//#region src/components/Modal/Modal.tsx
|
|
12267
|
-
const ModalHiddenDescription = styled(Description)({ ...visuallyHiddenStyle });
|
|
12289
|
+
const ModalHiddenDescription = styled(Dialog.Description)({ ...visuallyHiddenStyle });
|
|
12268
12290
|
const ModalBody = styled.div`
|
|
12269
12291
|
flex-direction: column;
|
|
12270
12292
|
display: flex;
|
|
@@ -12286,21 +12308,14 @@ const ModalFooter = styled.footer`
|
|
|
12286
12308
|
* user interaction or dismissal before returning to the underlying content.
|
|
12287
12309
|
*/
|
|
12288
12310
|
const Modal = forwardRef(({ children, footer, hideCloseButton = false, hideTitle = false, initialFocusRef, isOpen, onRequestClose, positionVariant = "centered", title, width = DEFAULT_MODAL_WIDTH, ...props }, ref) => {
|
|
12289
|
-
return /* @__PURE__ */ jsx(Root
|
|
12311
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
12290
12312
|
onOpenChange: (open) => {
|
|
12291
12313
|
if (!open && isNotNil(onRequestClose)) onRequestClose();
|
|
12292
12314
|
},
|
|
12293
12315
|
open: isOpen,
|
|
12294
|
-
children: /* @__PURE__ */ jsxs(Portal
|
|
12316
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
|
|
12295
12317
|
ref,
|
|
12296
|
-
|
|
12297
|
-
if (isNotNil(initialFocusRef) && initialFocusRef.current) {
|
|
12298
|
-
event.preventDefault();
|
|
12299
|
-
requestAnimationFrame(() => {
|
|
12300
|
-
initialFocusRef.current?.focus();
|
|
12301
|
-
});
|
|
12302
|
-
}
|
|
12303
|
-
},
|
|
12318
|
+
initialFocusRef,
|
|
12304
12319
|
positionVariant,
|
|
12305
12320
|
width,
|
|
12306
12321
|
...props,
|
|
@@ -12343,114 +12358,23 @@ const ModalCallout = ({ title, image, children }) => {
|
|
|
12343
12358
|
};
|
|
12344
12359
|
ModalCallout.displayName = "ModalCallout_UI";
|
|
12345
12360
|
//#endregion
|
|
12346
|
-
//#region src/
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12353
|
-
const PopoverRoot = ({ isOpen, ...props }) => /* @__PURE__ */ jsx(Root$4, {
|
|
12354
|
-
...props,
|
|
12355
|
-
...isOpen !== void 0 ? { open: isOpen } : {}
|
|
12356
|
-
});
|
|
12357
|
-
PopoverRoot.displayName = "PopoverRoot_UI";
|
|
12358
|
-
//#endregion
|
|
12359
|
-
//#region src/components/Popover/PopoverTrigger.tsx
|
|
12360
|
-
/**
|
|
12361
|
-
* The button that toggles the popover open and closed. By default it renders a
|
|
12362
|
-
* `<button>` wrapping its children; pass `asChild` to merge the trigger
|
|
12363
|
-
* behavior onto a single child element (e.g. a `Button` or `IconButton`).
|
|
12364
|
-
*/
|
|
12365
|
-
const PopoverTrigger = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Trigger$2, {
|
|
12366
|
-
ref: forwardedRef,
|
|
12367
|
-
...props
|
|
12368
|
-
}));
|
|
12369
|
-
PopoverTrigger.displayName = "PopoverTrigger_UI";
|
|
12370
|
-
//#endregion
|
|
12371
|
-
//#region src/components/Popover/PopoverPortal.tsx
|
|
12372
|
-
/**
|
|
12373
|
-
* Portals the popover content out of the DOM hierarchy of its trigger so it can
|
|
12374
|
-
* escape clipping ancestors (`overflow: hidden`, transformed containers, etc.).
|
|
12375
|
-
*/
|
|
12376
|
-
const PopoverPortal = (props) => /* @__PURE__ */ jsx(Portal$1, { ...props });
|
|
12377
|
-
PopoverPortal.displayName = "PopoverPortal_UI";
|
|
12378
|
-
//#endregion
|
|
12379
|
-
//#region src/components/Popover/PopoverContent.tsx
|
|
12380
|
-
const StyledContent$1 = styled(Content$2)`
|
|
12381
|
-
z-index: var(--wui-zindex-popover);
|
|
12382
|
-
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
12383
|
-
${({ $unstyled }) => !$unstyled && css`
|
|
12384
|
-
border-radius: var(--wui-border-radius-02);
|
|
12385
|
-
padding: var(--wui-space-04);
|
|
12386
|
-
max-width: var(--wui-popover-max-width);
|
|
12387
|
-
max-height: var(--wui-popover-max-height);
|
|
12388
|
-
background-color: var(--wui-color-bg-surface);
|
|
12389
|
-
box-shadow: var(--wui-elevation-01);
|
|
12390
|
-
border: 1px solid var(--wui-color-border);
|
|
12391
|
-
overflow: auto;
|
|
12392
|
-
`}
|
|
12393
|
-
|
|
12394
|
-
[data-wui-popover-close] {
|
|
12395
|
-
position: absolute;
|
|
12396
|
-
top: var(--wui-space-02);
|
|
12397
|
-
right: var(--wui-space-02);
|
|
12398
|
-
}
|
|
12399
|
-
`;
|
|
12400
|
-
const DEFAULT_SIDE_OFFSET = 8;
|
|
12401
|
-
const DEFAULT_MAX_WIDTH = "320px";
|
|
12402
|
-
const DEFAULT_MAX_HEIGHT = "auto";
|
|
12403
|
-
/**
|
|
12404
|
-
* The styled popover surface. Place inside a `PopoverRoot` (typically wrapped
|
|
12405
|
-
* in a `PopoverPortal`). Forwards all Radix Content props, including
|
|
12406
|
-
* dismissal/focus event handlers such as `onPointerDownOutside`,
|
|
12407
|
-
* `onOpenAutoFocus`, and `onCloseAutoFocus`.
|
|
12408
|
-
*/
|
|
12409
|
-
const PopoverContent = forwardRef(({ colorScheme = "inherit", unstyled = false, maxWidth = DEFAULT_MAX_WIDTH, maxHeight = DEFAULT_MAX_HEIGHT, sideOffset = DEFAULT_SIDE_OFFSET, style, ...props }, forwardedRef) => {
|
|
12410
|
-
return /* @__PURE__ */ jsx(StyledContent$1, {
|
|
12411
|
-
ref: forwardedRef,
|
|
12412
|
-
$colorScheme: colorScheme,
|
|
12413
|
-
$unstyled: unstyled,
|
|
12414
|
-
sideOffset,
|
|
12415
|
-
style: {
|
|
12416
|
-
"--wui-popover-max-width": maxWidth,
|
|
12417
|
-
"--wui-popover-max-height": maxHeight,
|
|
12418
|
-
...style
|
|
12419
|
-
},
|
|
12420
|
-
...props
|
|
12421
|
-
});
|
|
12422
|
-
});
|
|
12423
|
-
PopoverContent.displayName = "PopoverContent_UI";
|
|
12424
|
-
//#endregion
|
|
12425
|
-
//#region src/components/Popover/PopoverClose.tsx
|
|
12426
|
-
/**
|
|
12427
|
-
* An element that closes the popover when activated. Defaults to a `<button>`;
|
|
12428
|
-
* pass `asChild` to merge the close behavior onto a single child element. For
|
|
12429
|
-
* a pre-styled icon close button, use `PopoverCloseButton`.
|
|
12430
|
-
*/
|
|
12431
|
-
const PopoverClose = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Close, {
|
|
12432
|
-
ref: forwardedRef,
|
|
12433
|
-
...props
|
|
12434
|
-
}));
|
|
12435
|
-
PopoverClose.displayName = "PopoverClose_UI";
|
|
12436
|
-
//#endregion
|
|
12437
|
-
//#region src/components/Popover/PopoverCloseButton.tsx
|
|
12438
|
-
/**
|
|
12439
|
-
* A pre-styled close button intended to be placed inside a `PopoverContent`.
|
|
12440
|
-
* For a custom close control, use `PopoverClose` directly.
|
|
12441
|
-
*/
|
|
12442
|
-
const PopoverCloseButton = ({ label = "Close" } = {}) => /* @__PURE__ */ jsx(PopoverClose, {
|
|
12443
|
-
asChild: true,
|
|
12444
|
-
children: /* @__PURE__ */ jsx(IconButton, {
|
|
12445
|
-
"data-wui-popover-close": true,
|
|
12446
|
-
label,
|
|
12447
|
-
variant: "ghost",
|
|
12448
|
-
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
12449
|
-
})
|
|
12450
|
-
});
|
|
12451
|
-
PopoverCloseButton.displayName = "PopoverCloseButton_UI";
|
|
12361
|
+
//#region src/private/helpers/getControls/getControlProps.tsx
|
|
12362
|
+
const getControlProps = (isOpen, onOpenChange) => {
|
|
12363
|
+
return isNotNil(onOpenChange) && isNotNil(isOpen) ? {
|
|
12364
|
+
open: isOpen,
|
|
12365
|
+
onOpenChange
|
|
12366
|
+
} : {};
|
|
12367
|
+
};
|
|
12452
12368
|
//#endregion
|
|
12453
12369
|
//#region src/components/Popover/PopoverArrow.tsx
|
|
12370
|
+
const StyledArrowSvg = styled.svg`
|
|
12371
|
+
/* Override Base UI's inline top positioning and rotate the arrow to match Radix behavior.
|
|
12372
|
+
Radix applied rotate(180deg) so the circle sits near the trigger and the stalk extends
|
|
12373
|
+
down toward the popup. Base UI does not rotate the arrow automatically. */
|
|
12374
|
+
top: 0 !important;
|
|
12375
|
+
transform: rotate(180deg);
|
|
12376
|
+
transform-origin: center 0;
|
|
12377
|
+
`;
|
|
12454
12378
|
const StyledPath = styled.path`
|
|
12455
12379
|
fill: var(--wui-color-border-secondary);
|
|
12456
12380
|
`;
|
|
@@ -12489,39 +12413,60 @@ const StyledCircle = styled.circle`
|
|
|
12489
12413
|
}
|
|
12490
12414
|
`;
|
|
12491
12415
|
const PopoverArrow = ({ isAnimated }) => {
|
|
12492
|
-
return /* @__PURE__ */ jsx(
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
]
|
|
12519
|
-
})
|
|
12520
|
-
});
|
|
12416
|
+
return /* @__PURE__ */ jsx(Popover$1.Arrow, { render: /* @__PURE__ */ jsxs(StyledArrowSvg, {
|
|
12417
|
+
fill: "none",
|
|
12418
|
+
height: "56",
|
|
12419
|
+
viewBox: "0 0 48 56",
|
|
12420
|
+
width: "48",
|
|
12421
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12422
|
+
children: [
|
|
12423
|
+
/* @__PURE__ */ jsx(StyledPath, { d: "M24 26.6667C21.0545 26.6667 18.6667 29.0545 18.6667 32C18.6667 34.9455 21.0545 37.3333 24 37.3333C26.9455 37.3333 29.3333 34.9455 29.3333 32C29.3333 29.0545 26.9455 26.6667 24 26.6667ZM23 0V32H25V0H23Z" }),
|
|
12424
|
+
/* @__PURE__ */ jsx(StyledCircle, {
|
|
12425
|
+
$isAnimated: isAnimated,
|
|
12426
|
+
cx: "24",
|
|
12427
|
+
cy: "32",
|
|
12428
|
+
"data-wui-popover-arrow-inner-circle": true,
|
|
12429
|
+
r: "10",
|
|
12430
|
+
strokeWidth: "4"
|
|
12431
|
+
}),
|
|
12432
|
+
/* @__PURE__ */ jsx(StyledCircle, {
|
|
12433
|
+
$isAnimated: isAnimated,
|
|
12434
|
+
cx: "24",
|
|
12435
|
+
cy: "32",
|
|
12436
|
+
"data-wui-popover-arrow-outer-circle": true,
|
|
12437
|
+
r: "20",
|
|
12438
|
+
strokeWidth: "8"
|
|
12439
|
+
})
|
|
12440
|
+
]
|
|
12441
|
+
}) });
|
|
12521
12442
|
};
|
|
12522
12443
|
PopoverArrow.displayName = "PopoverArrow_UI";
|
|
12523
12444
|
//#endregion
|
|
12524
12445
|
//#region src/components/Popover/Popover.tsx
|
|
12446
|
+
const StyledPopup$2 = styled(Popover$1.Popup)`
|
|
12447
|
+
z-index: var(--wui-zindex-popover);
|
|
12448
|
+
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
12449
|
+
${({ $unstyled }) => !$unstyled && css`
|
|
12450
|
+
border-radius: var(--wui-border-radius-02);
|
|
12451
|
+
padding: var(--wui-space-04);
|
|
12452
|
+
max-width: var(--wui-popover-max-width, 320px);
|
|
12453
|
+
max-height: var(--wui-popover-max-height, auto);
|
|
12454
|
+
background-color: var(--wui-color-bg-surface);
|
|
12455
|
+
box-shadow: var(--wui-elevation-01);
|
|
12456
|
+
border: 1px solid var(--wui-color-border);
|
|
12457
|
+
overflow: auto;
|
|
12458
|
+
`}
|
|
12459
|
+
|
|
12460
|
+
${({ $withArrow }) => $withArrow && css`
|
|
12461
|
+
overflow: visible;
|
|
12462
|
+
`}
|
|
12463
|
+
|
|
12464
|
+
[data-wui-popover-close] {
|
|
12465
|
+
position: absolute;
|
|
12466
|
+
top: var(--wui-space-02);
|
|
12467
|
+
right: var(--wui-space-02);
|
|
12468
|
+
}
|
|
12469
|
+
`;
|
|
12525
12470
|
/**
|
|
12526
12471
|
* Displays rich content in a portal, triggered by a button.
|
|
12527
12472
|
*
|
|
@@ -12530,45 +12475,198 @@ PopoverArrow.displayName = "PopoverArrow_UI";
|
|
|
12530
12475
|
* primitives directly: `PopoverRoot`, `PopoverTrigger`, `PopoverAnchor`,
|
|
12531
12476
|
* `PopoverPortal`, `PopoverContent`, `PopoverClose`.
|
|
12532
12477
|
*/
|
|
12533
|
-
const Popover = ({ children, trigger, isOpen, hideCloseButton = false, maxWidth, maxHeight, onOpenChange, unstyled = false, withArrow = false, isAnimated = false, colorScheme = "inherit", style, ...props }) => {
|
|
12534
|
-
const sideOffset = withArrow ?
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12478
|
+
const Popover = ({ children, trigger, isOpen, hideCloseButton = false, maxWidth, maxHeight, onOpenChange, unstyled = false, withArrow = false, isAnimated = false, colorScheme = "inherit", style, side, align, nativeButton = true, ...props }) => {
|
|
12479
|
+
const sideOffset = withArrow ? 32 : 8;
|
|
12480
|
+
const mergedStyle = {
|
|
12481
|
+
"--wui-popover-max-width": maxWidth,
|
|
12482
|
+
"--wui-popover-max-height": maxHeight,
|
|
12483
|
+
...style
|
|
12484
|
+
};
|
|
12485
|
+
return /* @__PURE__ */ jsxs(Popover$1.Root, {
|
|
12486
|
+
...getControlProps(isOpen, onOpenChange),
|
|
12487
|
+
children: [/* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
12488
|
+
nativeButton,
|
|
12489
|
+
render: trigger
|
|
12490
|
+
}), /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
12491
|
+
align,
|
|
12492
|
+
collisionAvoidance: {
|
|
12493
|
+
side: "flip",
|
|
12494
|
+
align: "shift",
|
|
12495
|
+
fallbackAxisSide: "none"
|
|
12496
|
+
},
|
|
12497
|
+
side,
|
|
12547
12498
|
sideOffset,
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12499
|
+
children: /* @__PURE__ */ jsxs(StyledPopup$2, {
|
|
12500
|
+
$colorScheme: colorScheme,
|
|
12501
|
+
...props,
|
|
12502
|
+
$unstyled: unstyled,
|
|
12503
|
+
$withArrow: withArrow,
|
|
12504
|
+
role: "dialog",
|
|
12505
|
+
style: mergedStyle,
|
|
12506
|
+
children: [
|
|
12507
|
+
!hideCloseButton && /* @__PURE__ */ jsx(Popover$1.Close, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
12508
|
+
"data-wui-popover-close": true,
|
|
12509
|
+
label: "Close",
|
|
12510
|
+
variant: "ghost",
|
|
12511
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
12512
|
+
}) }),
|
|
12513
|
+
withArrow ? /* @__PURE__ */ jsx(PopoverArrow, { isAnimated }) : null,
|
|
12514
|
+
/* @__PURE__ */ jsx("div", { children })
|
|
12515
|
+
]
|
|
12516
|
+
})
|
|
12556
12517
|
}) })]
|
|
12557
12518
|
});
|
|
12558
12519
|
};
|
|
12559
12520
|
Popover.displayName = "Popover_UI";
|
|
12560
12521
|
//#endregion
|
|
12522
|
+
//#region src/components/Popover/PopoverAnchorContext.tsx
|
|
12523
|
+
const PopoverAnchorContext = createContext(null);
|
|
12524
|
+
const PopoverAnchorProvider = PopoverAnchorContext.Provider;
|
|
12525
|
+
const usePopoverAnchor = () => useContext(PopoverAnchorContext);
|
|
12526
|
+
const useCreatePopoverAnchorRef = () => useRef(null);
|
|
12527
|
+
//#endregion
|
|
12561
12528
|
//#region src/components/Popover/PopoverAnchor.tsx
|
|
12562
12529
|
/**
|
|
12563
12530
|
* Positions the popover relative to an element other than the trigger. Useful
|
|
12564
12531
|
* when the element the user interacts with (e.g. a text input) is separate
|
|
12565
12532
|
* from what the popover attaches to.
|
|
12533
|
+
*
|
|
12534
|
+
* Wrap the anchor element and nest `PopoverTrigger` inside it.
|
|
12535
|
+
*/
|
|
12536
|
+
const PopoverAnchor = ({ children }) => {
|
|
12537
|
+
const sharedRef = usePopoverAnchor();
|
|
12538
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12539
|
+
ref: useCallback((node) => {
|
|
12540
|
+
if (sharedRef) sharedRef.current = node;
|
|
12541
|
+
}, [sharedRef]),
|
|
12542
|
+
children
|
|
12543
|
+
});
|
|
12544
|
+
};
|
|
12545
|
+
PopoverAnchor.displayName = "PopoverAnchor_UI";
|
|
12546
|
+
//#endregion
|
|
12547
|
+
//#region src/components/Popover/PopoverClose.tsx
|
|
12548
|
+
/**
|
|
12549
|
+
* An element that closes the popover when activated. Defaults to a `<button>`;
|
|
12550
|
+
* pass `render` to merge the close behavior onto a single child element. For
|
|
12551
|
+
* a pre-styled icon close button, use `PopoverCloseButton`.
|
|
12566
12552
|
*/
|
|
12567
|
-
const
|
|
12553
|
+
const PopoverClose = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Popover$1.Close, {
|
|
12568
12554
|
ref: forwardedRef,
|
|
12569
12555
|
...props
|
|
12570
12556
|
}));
|
|
12571
|
-
|
|
12557
|
+
PopoverClose.displayName = "PopoverClose_UI";
|
|
12558
|
+
//#endregion
|
|
12559
|
+
//#region src/components/Popover/PopoverCloseButton.tsx
|
|
12560
|
+
/**
|
|
12561
|
+
* A pre-styled close button intended to be placed inside a `PopoverContent`.
|
|
12562
|
+
* For a custom close control, use `PopoverClose` directly.
|
|
12563
|
+
*/
|
|
12564
|
+
const PopoverCloseButton = ({ label = "Close" } = {}) => /* @__PURE__ */ jsx(PopoverClose, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
12565
|
+
"data-wui-popover-close": true,
|
|
12566
|
+
label,
|
|
12567
|
+
variant: "ghost",
|
|
12568
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
12569
|
+
}) });
|
|
12570
|
+
PopoverCloseButton.displayName = "PopoverCloseButton_UI";
|
|
12571
|
+
//#endregion
|
|
12572
|
+
//#region src/components/Popover/PopoverContent.tsx
|
|
12573
|
+
const StyledPopup$1 = styled(Popover$1.Popup)`
|
|
12574
|
+
z-index: var(--wui-zindex-popover);
|
|
12575
|
+
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
12576
|
+
${({ $unstyled }) => !$unstyled && css`
|
|
12577
|
+
border-radius: var(--wui-border-radius-02);
|
|
12578
|
+
padding: var(--wui-space-04);
|
|
12579
|
+
max-width: var(--wui-popover-max-width);
|
|
12580
|
+
max-height: var(--wui-popover-max-height);
|
|
12581
|
+
background-color: var(--wui-color-bg-surface);
|
|
12582
|
+
box-shadow: var(--wui-elevation-01);
|
|
12583
|
+
border: 1px solid var(--wui-color-border);
|
|
12584
|
+
overflow: auto;
|
|
12585
|
+
`}
|
|
12586
|
+
|
|
12587
|
+
[data-wui-popover-close] {
|
|
12588
|
+
position: absolute;
|
|
12589
|
+
top: var(--wui-space-02);
|
|
12590
|
+
right: var(--wui-space-02);
|
|
12591
|
+
}
|
|
12592
|
+
`;
|
|
12593
|
+
const DEFAULT_SIDE_OFFSET = 8;
|
|
12594
|
+
const DEFAULT_MAX_WIDTH = "320px";
|
|
12595
|
+
const DEFAULT_MAX_HEIGHT = "auto";
|
|
12596
|
+
/**
|
|
12597
|
+
* The styled popover surface. Place inside a `PopoverRoot` (typically wrapped
|
|
12598
|
+
* in a `PopoverPortal`). Wraps a `Positioner` and `Popup` internally.
|
|
12599
|
+
*/
|
|
12600
|
+
const PopoverContent = forwardRef(({ colorScheme = "inherit", unstyled = false, maxWidth = DEFAULT_MAX_WIDTH, maxHeight = DEFAULT_MAX_HEIGHT, sideOffset = DEFAULT_SIDE_OFFSET, side, align, style, role = "dialog", children, ...props }, forwardedRef) => {
|
|
12601
|
+
const sharedAnchorRef = usePopoverAnchor();
|
|
12602
|
+
const hasAnchor = sharedAnchorRef?.current != null;
|
|
12603
|
+
const mergedStyle = {
|
|
12604
|
+
"--wui-popover-max-width": maxWidth,
|
|
12605
|
+
"--wui-popover-max-height": maxHeight,
|
|
12606
|
+
...style
|
|
12607
|
+
};
|
|
12608
|
+
return /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
12609
|
+
align,
|
|
12610
|
+
collisionAvoidance: {
|
|
12611
|
+
side: "flip",
|
|
12612
|
+
align: "shift",
|
|
12613
|
+
fallbackAxisSide: "none"
|
|
12614
|
+
},
|
|
12615
|
+
side,
|
|
12616
|
+
sideOffset,
|
|
12617
|
+
...hasAnchor ? { anchor: sharedAnchorRef } : {},
|
|
12618
|
+
children: /* @__PURE__ */ jsx(StyledPopup$1, {
|
|
12619
|
+
ref: forwardedRef,
|
|
12620
|
+
$colorScheme: colorScheme,
|
|
12621
|
+
$unstyled: unstyled,
|
|
12622
|
+
role,
|
|
12623
|
+
style: mergedStyle,
|
|
12624
|
+
...props,
|
|
12625
|
+
children
|
|
12626
|
+
})
|
|
12627
|
+
});
|
|
12628
|
+
});
|
|
12629
|
+
PopoverContent.displayName = "PopoverContent_UI";
|
|
12630
|
+
//#endregion
|
|
12631
|
+
//#region src/components/Popover/PopoverPortal.tsx
|
|
12632
|
+
/**
|
|
12633
|
+
* Portals the popover content out of the DOM hierarchy of its trigger so it can
|
|
12634
|
+
* escape clipping ancestors (`overflow: hidden`, transformed containers, etc.).
|
|
12635
|
+
*/
|
|
12636
|
+
const PopoverPortal = ({ children }) => /* @__PURE__ */ jsx(Popover$1.Portal, { children });
|
|
12637
|
+
PopoverPortal.displayName = "PopoverPortal_UI";
|
|
12638
|
+
//#endregion
|
|
12639
|
+
//#region src/components/Popover/PopoverRoot.tsx
|
|
12640
|
+
/**
|
|
12641
|
+
* The root of a composable popover. Wrap `PopoverTrigger` (or `PopoverAnchor`)
|
|
12642
|
+
* and `PopoverContent` inside it.
|
|
12643
|
+
*
|
|
12644
|
+
* For the common "button opens a panel" case, prefer the bundled `Popover`.
|
|
12645
|
+
*/
|
|
12646
|
+
const PopoverRoot = ({ isOpen, onOpenChange, children }) => {
|
|
12647
|
+
const anchorRef = useCreatePopoverAnchorRef();
|
|
12648
|
+
return /* @__PURE__ */ jsx(Popover$1.Root, {
|
|
12649
|
+
...getControlProps(isOpen, onOpenChange),
|
|
12650
|
+
children: /* @__PURE__ */ jsx(PopoverAnchorProvider, {
|
|
12651
|
+
value: anchorRef,
|
|
12652
|
+
children
|
|
12653
|
+
})
|
|
12654
|
+
});
|
|
12655
|
+
};
|
|
12656
|
+
PopoverRoot.displayName = "PopoverRoot_UI";
|
|
12657
|
+
//#endregion
|
|
12658
|
+
//#region src/components/Popover/PopoverTrigger.tsx
|
|
12659
|
+
/**
|
|
12660
|
+
* The button that toggles the popover open and closed. By default it renders a
|
|
12661
|
+
* `<button>` wrapping its children; pass `render` to merge the trigger
|
|
12662
|
+
* behavior onto a single child element (e.g. a `Button` or `IconButton`).
|
|
12663
|
+
*/
|
|
12664
|
+
const PopoverTrigger = forwardRef(({ nativeButton = true, ...props }, forwardedRef) => /* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
12665
|
+
ref: forwardedRef,
|
|
12666
|
+
nativeButton,
|
|
12667
|
+
...props
|
|
12668
|
+
}));
|
|
12669
|
+
PopoverTrigger.displayName = "PopoverTrigger_UI";
|
|
12572
12670
|
//#endregion
|
|
12573
12671
|
//#region src/components/ProgressBar/ProgressBar.tsx
|
|
12574
12672
|
const ProgressBarWrapper = styled.div`
|
|
@@ -12578,10 +12676,10 @@ const ProgressBarWrapper = styled.div`
|
|
|
12578
12676
|
align-items: center;
|
|
12579
12677
|
gap: var(--wui-space-02);
|
|
12580
12678
|
`;
|
|
12581
|
-
const
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
|
|
12679
|
+
const StyledTrack = styled(Progress.Track)`
|
|
12680
|
+
height: 100%;
|
|
12681
|
+
overflow: hidden;
|
|
12682
|
+
`;
|
|
12585
12683
|
const ProgressBarLabel = styled.div`
|
|
12586
12684
|
display: flex;
|
|
12587
12685
|
line-height: var(--wui-typography-label-3-line-height);
|
|
@@ -12590,17 +12688,15 @@ const ProgressBarLabel = styled.div`
|
|
|
12590
12688
|
color: var(--wui-color-text-secondary);
|
|
12591
12689
|
flex-shrink: 0;
|
|
12592
12690
|
`;
|
|
12593
|
-
const StyledProgressIndicator = styled(Indicator)`
|
|
12691
|
+
const StyledProgressIndicator = styled(Progress.Indicator)`
|
|
12594
12692
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
12595
12693
|
background-color: var(--wui-color-bg-fill);
|
|
12596
|
-
|
|
12597
|
-
height: 100%;
|
|
12694
|
+
display: block;
|
|
12598
12695
|
border-top-right-radius: var(--wui-border-radius-rounded);
|
|
12599
12696
|
border-bottom-right-radius: var(--wui-border-radius-rounded);
|
|
12600
|
-
transition:
|
|
12601
|
-
transform: ${({ $progress, $max }) => getTranslateValue($progress, $max)};
|
|
12697
|
+
transition: width 660ms cubic-bezier(0.65, 0, 0.35, 1);
|
|
12602
12698
|
`;
|
|
12603
|
-
const StyledProgressBar = styled(Root
|
|
12699
|
+
const StyledProgressBar = styled(Progress.Root)`
|
|
12604
12700
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
12605
12701
|
position: relative;
|
|
12606
12702
|
overflow: hidden;
|
|
@@ -12620,14 +12716,11 @@ const ProgressBar = ({ progress, max = 100, children, labelLeft, labelRight, col
|
|
|
12620
12716
|
isNotNil(labelLeft) ? /* @__PURE__ */ jsx(ProgressBarLabel, { children: labelLeft }) : null,
|
|
12621
12717
|
/* @__PURE__ */ jsx(StyledProgressBar, {
|
|
12622
12718
|
$colorScheme: colorScheme,
|
|
12719
|
+
getAriaValueText: (_formattedValue, value) => value != null ? `${Math.round(value / max * 100)}%` : "indeterminate progress",
|
|
12623
12720
|
max,
|
|
12624
12721
|
value: progress,
|
|
12625
12722
|
...props,
|
|
12626
|
-
children: /* @__PURE__ */ jsx(StyledProgressIndicator, {
|
|
12627
|
-
$colorScheme: colorScheme,
|
|
12628
|
-
$max: max,
|
|
12629
|
-
$progress: progress
|
|
12630
|
-
})
|
|
12723
|
+
children: /* @__PURE__ */ jsx(StyledTrack, { children: /* @__PURE__ */ jsx(StyledProgressIndicator, { $colorScheme: colorScheme }) })
|
|
12631
12724
|
}),
|
|
12632
12725
|
isNotNil(labelRight) ? /* @__PURE__ */ jsx(ProgressBarLabel, { children: labelRight }) : null
|
|
12633
12726
|
] });
|
|
@@ -13209,7 +13302,7 @@ const segmentedControlStyles = css`
|
|
|
13209
13302
|
position: relative;
|
|
13210
13303
|
width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
|
|
13211
13304
|
`;
|
|
13212
|
-
const StyledSegmentedControl = styled(
|
|
13305
|
+
const StyledSegmentedControl = styled(ToggleGroup)`
|
|
13213
13306
|
${segmentedControlStyles}
|
|
13214
13307
|
`;
|
|
13215
13308
|
/**
|
|
@@ -13222,11 +13315,11 @@ const SegmentedControl = forwardRef(({ children, colorScheme = "inherit", disabl
|
|
|
13222
13315
|
$colorScheme: colorScheme,
|
|
13223
13316
|
$fullWidth: fullWidth,
|
|
13224
13317
|
disabled,
|
|
13225
|
-
|
|
13226
|
-
onValueChange:
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
value: selectedValue,
|
|
13318
|
+
loopFocus: true,
|
|
13319
|
+
onValueChange: (newValue) => {
|
|
13320
|
+
if (newValue.length > 0 && newValue[0] !== void 0) onSelectedValueChange(newValue[0]);
|
|
13321
|
+
},
|
|
13322
|
+
value: [selectedValue],
|
|
13230
13323
|
...props,
|
|
13231
13324
|
children: /* @__PURE__ */ jsx(SegmentedControlValueProvider, {
|
|
13232
13325
|
value: selectedValue,
|
|
@@ -13238,7 +13331,7 @@ SegmentedControl.displayName = "SegmentedControl_UI";
|
|
|
13238
13331
|
//#endregion
|
|
13239
13332
|
//#region src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
13240
13333
|
const segmentedControlItemStyles = css`
|
|
13241
|
-
all: unset;
|
|
13334
|
+
all: unset;
|
|
13242
13335
|
align-items: center;
|
|
13243
13336
|
border-radius: var(--wui-border-radius-rounded);
|
|
13244
13337
|
color: var(--wui-color-text-secondary);
|
|
@@ -13272,10 +13365,11 @@ const segmentedControlItemStyles = css`
|
|
|
13272
13365
|
/* note: react-toggle-group uses 'aria-selected' and react-tabs uses "active" */
|
|
13273
13366
|
|
|
13274
13367
|
/* we can't style off of 'data-state' since that gets overridden when wrapped in a Tooltip */
|
|
13275
|
-
&:hover:not([aria-checked='true'], [aria-selected='true']) {
|
|
13368
|
+
&:hover:not([aria-pressed='true'], [aria-checked='true'], [aria-selected='true']) {
|
|
13276
13369
|
background-color: var(--wui-color-bg-surface-secondary-hover);
|
|
13277
13370
|
}
|
|
13278
13371
|
|
|
13372
|
+
&[aria-pressed='true'],
|
|
13279
13373
|
&[aria-checked='true'],
|
|
13280
13374
|
&[aria-selected='true'] {
|
|
13281
13375
|
color: var(--wui-color-segmented-color-text-override, var(--wui-color-text-selected));
|
|
@@ -13305,7 +13399,7 @@ const segmentedControlItemStyles = css`
|
|
|
13305
13399
|
}
|
|
13306
13400
|
}
|
|
13307
13401
|
`;
|
|
13308
|
-
const StyledSegmentedControlItem = styled(
|
|
13402
|
+
const StyledSegmentedControlItem = styled(Toggle)`
|
|
13309
13403
|
${segmentedControlItemStyles}
|
|
13310
13404
|
`;
|
|
13311
13405
|
const SegmentedControlItem = forwardRef(({ disabled, icon, label, "aria-label": ariaLabel, value, ...otherProps }, forwardedRef) => {
|
|
@@ -13314,8 +13408,7 @@ const SegmentedControlItem = forwardRef(({ disabled, icon, label, "aria-label":
|
|
|
13314
13408
|
const buttonRef = useRef(null);
|
|
13315
13409
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
13316
13410
|
const handleClick = (event) => {
|
|
13317
|
-
|
|
13318
|
-
if (state === "on") event.preventDefault();
|
|
13411
|
+
if (event.currentTarget.getAttribute("aria-pressed") === "true") event.preventDefault();
|
|
13319
13412
|
};
|
|
13320
13413
|
useEffect(() => {
|
|
13321
13414
|
const buttonElem = buttonRef.current;
|
|
@@ -13356,7 +13449,7 @@ const SegmentedControlItem = forwardRef(({ disabled, icon, label, "aria-label":
|
|
|
13356
13449
|
SegmentedControlItem.displayName = "SegmentedControlItem_UI";
|
|
13357
13450
|
//#endregion
|
|
13358
13451
|
//#region src/components/Select/Select.tsx
|
|
13359
|
-
const StyledTrigger = styled(Trigger
|
|
13452
|
+
const StyledTrigger = styled(Select$1.Trigger)`
|
|
13360
13453
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
13361
13454
|
${inputCss};
|
|
13362
13455
|
padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
|
|
@@ -13402,7 +13495,7 @@ const StyledTrigger = styled(Trigger$4)`
|
|
|
13402
13495
|
color: var(--wui-input-placeholder);
|
|
13403
13496
|
}
|
|
13404
13497
|
`;
|
|
13405
|
-
const
|
|
13498
|
+
const StyledPopup = styled(Select$1.Popup)`
|
|
13406
13499
|
--wui-select-content-border: var(--wui-color-border);
|
|
13407
13500
|
--wui-select-content-bg: var(--wui-color-bg-surface);
|
|
13408
13501
|
--wui-select-content-border-radius: var(--wui-border-radius-02);
|
|
@@ -13416,8 +13509,8 @@ const StyledContent = styled(Content$5)`
|
|
|
13416
13509
|
border-radius: var(--wui-select-content-border-radius);
|
|
13417
13510
|
box-shadow: var(--wui-elevation-01);
|
|
13418
13511
|
padding: var(--wui-select-option-padding);
|
|
13419
|
-
min-width: var(--
|
|
13420
|
-
max-height: var(--
|
|
13512
|
+
min-width: var(--anchor-width);
|
|
13513
|
+
max-height: var(--available-height);
|
|
13421
13514
|
z-index: var(--wui-zindex-select);
|
|
13422
13515
|
|
|
13423
13516
|
[role='separator'] {
|
|
@@ -13429,55 +13522,87 @@ const scrollButtonStyles = css`
|
|
|
13429
13522
|
display: flex;
|
|
13430
13523
|
justify-content: center;
|
|
13431
13524
|
`;
|
|
13432
|
-
const
|
|
13525
|
+
const StyledScrollDownArrow = styled(Select$1.ScrollDownArrow)`
|
|
13433
13526
|
${scrollButtonStyles}
|
|
13434
13527
|
`;
|
|
13435
|
-
const
|
|
13528
|
+
const StyledScrollUpArrow = styled(Select$1.ScrollUpArrow)`
|
|
13436
13529
|
${scrollButtonStyles}
|
|
13437
13530
|
`;
|
|
13438
13531
|
/**
|
|
13532
|
+
* Walks the React children tree to build a value→label mapping for Base UI's `items` prop.
|
|
13533
|
+
* This ensures `Select.Value` displays the label text instead of the raw value.
|
|
13534
|
+
*/
|
|
13535
|
+
const collectItemLabels = (children) => {
|
|
13536
|
+
const items = [];
|
|
13537
|
+
Children.forEach(children, (child) => {
|
|
13538
|
+
if (!isValidElement(child)) return;
|
|
13539
|
+
const { value, selectedDisplayValue, children: childChildren, textValue } = child.props;
|
|
13540
|
+
if (typeof value === "string") {
|
|
13541
|
+
if (selectedDisplayValue !== void 0 && selectedDisplayValue !== null) items.push({
|
|
13542
|
+
value,
|
|
13543
|
+
label: selectedDisplayValue
|
|
13544
|
+
});
|
|
13545
|
+
else if (typeof childChildren === "string") items.push({
|
|
13546
|
+
value,
|
|
13547
|
+
label: childChildren
|
|
13548
|
+
});
|
|
13549
|
+
else if (typeof textValue === "string") items.push({
|
|
13550
|
+
value,
|
|
13551
|
+
label: textValue
|
|
13552
|
+
});
|
|
13553
|
+
return;
|
|
13554
|
+
}
|
|
13555
|
+
if (childChildren !== void 0 && childChildren !== null) items.push(...collectItemLabels(childChildren));
|
|
13556
|
+
});
|
|
13557
|
+
return items;
|
|
13558
|
+
};
|
|
13559
|
+
/**
|
|
13439
13560
|
* Display a list of options and choose one of them. Replacement for the native Select HTML element.
|
|
13440
13561
|
*/
|
|
13441
|
-
const Select = forwardRef(({ colorScheme = "inherit", children, onOpenChange = () => null, onChange = () => null, placeholder = "Select...", fullWidth = false, forceOpen = false, ...props }, forwardedRef) => {
|
|
13562
|
+
const Select = forwardRef(({ colorScheme = "inherit", children, onOpenChange = () => null, onChange = () => null, placeholder = "Select...", fullWidth = false, forceOpen = false, disabled, value, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
|
|
13442
13563
|
const responsiveFullWidth = useResponsiveProp(fullWidth);
|
|
13443
13564
|
const rootProps = {
|
|
13444
|
-
|
|
13565
|
+
disabled,
|
|
13566
|
+
items: useMemo(() => collectItemLabels(children), [children]),
|
|
13445
13567
|
onOpenChange,
|
|
13446
|
-
onValueChange: onChange
|
|
13568
|
+
onValueChange: onChange,
|
|
13569
|
+
value
|
|
13447
13570
|
};
|
|
13448
13571
|
if (forceOpen) rootProps["open"] = true;
|
|
13449
|
-
return /* @__PURE__ */ jsxs(Root
|
|
13572
|
+
return /* @__PURE__ */ jsxs(Select$1.Root, {
|
|
13450
13573
|
...rootProps,
|
|
13451
13574
|
children: [/* @__PURE__ */ jsxs(StyledTrigger, {
|
|
13452
13575
|
ref: forwardedRef,
|
|
13453
13576
|
$colorScheme: colorScheme,
|
|
13454
13577
|
$fullWidth: responsiveFullWidth,
|
|
13578
|
+
"aria-invalid": ariaInvalid,
|
|
13455
13579
|
...props,
|
|
13456
|
-
children: [/* @__PURE__ */ jsx(Value, { placeholder }), /* @__PURE__ */ jsx(Icon, {
|
|
13580
|
+
children: [/* @__PURE__ */ jsx(Select$1.Value, { placeholder }), /* @__PURE__ */ jsx(Icon, {
|
|
13457
13581
|
size: "md",
|
|
13458
13582
|
type: "caret-down"
|
|
13459
13583
|
})]
|
|
13460
|
-
}), /* @__PURE__ */ jsx(Portal
|
|
13461
|
-
|
|
13584
|
+
}), /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
|
|
13585
|
+
align: "start",
|
|
13586
|
+
alignItemWithTrigger: false,
|
|
13462
13587
|
sideOffset: 8,
|
|
13463
|
-
children: [
|
|
13464
|
-
/* @__PURE__ */ jsx(
|
|
13588
|
+
children: /* @__PURE__ */ jsxs(StyledPopup, { children: [
|
|
13589
|
+
/* @__PURE__ */ jsx(StyledScrollUpArrow, { children: /* @__PURE__ */ jsx(Icon, {
|
|
13465
13590
|
size: "sm",
|
|
13466
13591
|
type: "caret-up"
|
|
13467
13592
|
}) }),
|
|
13468
|
-
|
|
13469
|
-
/* @__PURE__ */ jsx(
|
|
13593
|
+
children,
|
|
13594
|
+
/* @__PURE__ */ jsx(StyledScrollDownArrow, { children: /* @__PURE__ */ jsx(Icon, {
|
|
13470
13595
|
size: "sm",
|
|
13471
13596
|
type: "caret-down"
|
|
13472
13597
|
}) })
|
|
13473
|
-
]
|
|
13598
|
+
] })
|
|
13474
13599
|
}) })]
|
|
13475
13600
|
});
|
|
13476
13601
|
});
|
|
13477
13602
|
Select.displayName = "Select_UI";
|
|
13478
13603
|
//#endregion
|
|
13479
13604
|
//#region src/components/Select/SelectOption.tsx
|
|
13480
|
-
const StyledItem = styled(Item
|
|
13605
|
+
const StyledItem = styled(Select$1.Item)`
|
|
13481
13606
|
${getTypographicStyles("label3")}
|
|
13482
13607
|
align-items: ${({ $checkmarkVerticalAlign }) => $checkmarkVerticalAlign === "center" ? "center" : "flex-start"};
|
|
13483
13608
|
background-color: transparent;
|
|
@@ -13503,15 +13628,17 @@ const StyledItem = styled(Item$2)`
|
|
|
13503
13628
|
background-color: transparent;
|
|
13504
13629
|
}
|
|
13505
13630
|
`;
|
|
13506
|
-
const SelectOption = forwardRef(({ children, selectedDisplayValue, checkmarkVerticalAlign = "center", ...props }, forwardedRef) => {
|
|
13631
|
+
const SelectOption = forwardRef(({ children, selectedDisplayValue, checkmarkVerticalAlign = "center", textValue, ...props }, forwardedRef) => {
|
|
13632
|
+
const label = typeof children === "string" ? children : textValue;
|
|
13507
13633
|
return /* @__PURE__ */ jsxs(StyledItem, {
|
|
13508
13634
|
...props,
|
|
13509
13635
|
ref: forwardedRef,
|
|
13510
13636
|
$checkmarkVerticalAlign: checkmarkVerticalAlign,
|
|
13637
|
+
...label != null ? { label } : {},
|
|
13511
13638
|
children: [isNotNil(selectedDisplayValue) ? /* @__PURE__ */ jsxs("div", { children: [children, /* @__PURE__ */ jsx("div", {
|
|
13512
13639
|
style: { display: "none" },
|
|
13513
|
-
children: /* @__PURE__ */ jsx(ItemText, { children: selectedDisplayValue })
|
|
13514
|
-
})] }) : /* @__PURE__ */ jsx(ItemText, { children }), /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(Icon, {
|
|
13640
|
+
children: /* @__PURE__ */ jsx(Select$1.ItemText, { children: selectedDisplayValue })
|
|
13641
|
+
})] }) : /* @__PURE__ */ jsx(Select$1.ItemText, { children }), /* @__PURE__ */ jsx(Select$1.ItemIndicator, { children: /* @__PURE__ */ jsx(Icon, {
|
|
13515
13642
|
size: "md",
|
|
13516
13643
|
type: "checkmark"
|
|
13517
13644
|
}) })]
|
|
@@ -13520,11 +13647,11 @@ const SelectOption = forwardRef(({ children, selectedDisplayValue, checkmarkVert
|
|
|
13520
13647
|
SelectOption.displayName = "SelectOption_UI";
|
|
13521
13648
|
//#endregion
|
|
13522
13649
|
//#region src/components/Select/SelectOptionGroup.tsx
|
|
13523
|
-
const StyledLabel = styled(
|
|
13650
|
+
const StyledLabel = styled(Select$1.GroupLabel)`
|
|
13524
13651
|
padding: var(--wui-select-option-padding);
|
|
13525
13652
|
`;
|
|
13526
13653
|
const SelectOptionGroup = ({ children, label, ...props }) => {
|
|
13527
|
-
return /* @__PURE__ */ jsxs(Group, {
|
|
13654
|
+
return /* @__PURE__ */ jsxs(Select$1.Group, {
|
|
13528
13655
|
...props,
|
|
13529
13656
|
children: [/* @__PURE__ */ jsx(StyledLabel, { children: /* @__PURE__ */ jsx(Heading, {
|
|
13530
13657
|
renderAs: "span",
|
|
@@ -13551,28 +13678,28 @@ const SliderContainer = styled.div`
|
|
|
13551
13678
|
pointer-events: none;
|
|
13552
13679
|
}
|
|
13553
13680
|
`;
|
|
13554
|
-
const StyledSliderRoot = styled(Root
|
|
13555
|
-
|
|
13681
|
+
const StyledSliderRoot = styled(Slider$1.Root)`
|
|
13682
|
+
width: 100%;
|
|
13683
|
+
`;
|
|
13684
|
+
const StyledSliderControl = styled(Slider$1.Control)`
|
|
13556
13685
|
display: flex;
|
|
13557
13686
|
align-items: center;
|
|
13558
13687
|
user-select: none;
|
|
13559
13688
|
touch-action: none;
|
|
13560
13689
|
width: 100%;
|
|
13561
13690
|
`;
|
|
13562
|
-
const StyledSliderTrack = styled(Track)`
|
|
13691
|
+
const StyledSliderTrack = styled(Slider$1.Track)`
|
|
13563
13692
|
background-color: var(--wui-slider-track-color);
|
|
13564
13693
|
border-radius: var(--wui-slider-track-border-radius);
|
|
13565
|
-
|
|
13694
|
+
width: 100%;
|
|
13566
13695
|
height: 6px;
|
|
13567
13696
|
position: relative;
|
|
13568
13697
|
`;
|
|
13569
|
-
const
|
|
13698
|
+
const StyledSliderIndicator = styled(Slider$1.Indicator)`
|
|
13570
13699
|
background-color: var(--wui-slider-range-color);
|
|
13571
13700
|
border-radius: var(--wui-slider-track-border-radius);
|
|
13572
|
-
height: 100%;
|
|
13573
|
-
position: absolute;
|
|
13574
13701
|
`;
|
|
13575
|
-
const StyledSliderThumb = styled(Thumb)`
|
|
13702
|
+
const StyledSliderThumb = styled(Slider$1.Thumb)`
|
|
13576
13703
|
background-color: var(--wui-slider-thumb-color);
|
|
13577
13704
|
border-radius: var(--wui-border-radius-rounded);
|
|
13578
13705
|
cursor: grab;
|
|
@@ -13599,16 +13726,19 @@ const StyledSliderThumb = styled(Thumb)`
|
|
|
13599
13726
|
outline-width: 2px;
|
|
13600
13727
|
}
|
|
13601
13728
|
`;
|
|
13602
|
-
const Slider = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, disabled = false, initialValue = [0], max = 100, min = 0, onChange,
|
|
13729
|
+
const Slider = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, disabled = false, initialValue = [0], max = 100, min = 0, onChange, onValueCommitted, step = 1, value, "data-testid": dataTestId = "ui-slider", ...otherProps }) => {
|
|
13603
13730
|
if (!(isNonEmptyString(ariaLabel) || isNonEmptyString(ariaLabelledby))) throw new Error("UI Slider: Sliders should have an accessible name. Add a label using the aria-label or aria-labelledby prop.");
|
|
13604
13731
|
const values = value ?? initialValue;
|
|
13605
13732
|
const handleValueChange = (newValue) => {
|
|
13606
|
-
if (onChange) onChange(newValue);
|
|
13733
|
+
if (onChange) onChange(typeof newValue === "number" ? [newValue] : [...newValue]);
|
|
13734
|
+
};
|
|
13735
|
+
const handleValueCommitted = (newValue) => {
|
|
13736
|
+
if (onValueCommitted) onValueCommitted(typeof newValue === "number" ? [newValue] : [...newValue]);
|
|
13607
13737
|
};
|
|
13608
13738
|
return /* @__PURE__ */ jsx(SliderContainer, {
|
|
13609
13739
|
...otherProps,
|
|
13610
13740
|
"data-testid": dataTestId,
|
|
13611
|
-
children: /* @__PURE__ */
|
|
13741
|
+
children: /* @__PURE__ */ jsx(StyledSliderRoot, {
|
|
13612
13742
|
"aria-label": ariaLabel,
|
|
13613
13743
|
"aria-labelledby": ariaLabelledby,
|
|
13614
13744
|
defaultValue: initialValue,
|
|
@@ -13616,13 +13746,13 @@ const Slider = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, di
|
|
|
13616
13746
|
max,
|
|
13617
13747
|
min,
|
|
13618
13748
|
onValueChange: handleValueChange,
|
|
13749
|
+
onValueCommitted: handleValueCommitted,
|
|
13619
13750
|
step,
|
|
13620
|
-
...onValueCommit ? { onValueCommit } : {},
|
|
13621
13751
|
...value ? { value } : {},
|
|
13622
|
-
children:
|
|
13752
|
+
children: /* @__PURE__ */ jsx(StyledSliderControl, { children: /* @__PURE__ */ jsxs(StyledSliderTrack, {
|
|
13623
13753
|
"data-testid": `${dataTestId}-track`,
|
|
13624
|
-
children: /* @__PURE__ */ jsx(
|
|
13625
|
-
})
|
|
13754
|
+
children: [/* @__PURE__ */ jsx(StyledSliderIndicator, { "data-testid": `${dataTestId}-range` }), values.map((_, index) => /* @__PURE__ */ jsx(StyledSliderThumb, { "data-testid": `${dataTestId}-thumb-${index}` }, `thumb-${index}`))]
|
|
13755
|
+
}) })
|
|
13626
13756
|
})
|
|
13627
13757
|
});
|
|
13628
13758
|
};
|
|
@@ -13640,7 +13770,7 @@ const StyledSplitButton = styled.span`
|
|
|
13640
13770
|
padding-right: 0;
|
|
13641
13771
|
}
|
|
13642
13772
|
|
|
13643
|
-
> [data-wui-button='true']:
|
|
13773
|
+
> [data-wui-button='true']:not(:first-child) {
|
|
13644
13774
|
border-top-left-radius: 0;
|
|
13645
13775
|
border-bottom-left-radius: 0;
|
|
13646
13776
|
display: inline-flex;
|
|
@@ -13822,18 +13952,22 @@ const useTabsValue = () => {
|
|
|
13822
13952
|
//#endregion
|
|
13823
13953
|
//#region src/components/Tabs/Tabs.tsx
|
|
13824
13954
|
const Tabs = ({ children, value: valueProp, onValueChange: onValueChangeProp, defaultValue, ...props }) => {
|
|
13825
|
-
const [
|
|
13955
|
+
const [internalValue, setInternalValue] = useState(valueProp ?? defaultValue);
|
|
13956
|
+
const isControlled = isNotNil(valueProp);
|
|
13957
|
+
const value = isControlled ? valueProp : internalValue;
|
|
13826
13958
|
const onValueChange = useCallback((newValue) => {
|
|
13827
|
-
|
|
13828
|
-
|
|
13959
|
+
if (newValue !== null) {
|
|
13960
|
+
setInternalValue(newValue);
|
|
13961
|
+
if (onValueChangeProp) onValueChangeProp(newValue);
|
|
13962
|
+
}
|
|
13829
13963
|
}, [onValueChangeProp]);
|
|
13830
13964
|
const rootProps = {
|
|
13831
13965
|
...props,
|
|
13832
13966
|
onValueChange
|
|
13833
13967
|
};
|
|
13834
13968
|
if (isNotNil(value)) rootProps.value = value;
|
|
13835
|
-
if (isNotNil(defaultValue)) rootProps.defaultValue = defaultValue;
|
|
13836
|
-
return /* @__PURE__ */ jsx(Root
|
|
13969
|
+
if (!isControlled && isNotNil(defaultValue)) rootProps.defaultValue = defaultValue;
|
|
13970
|
+
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
13837
13971
|
...rootProps,
|
|
13838
13972
|
children: /* @__PURE__ */ jsx(TabsValueProvider, {
|
|
13839
13973
|
value: value ?? defaultValue,
|
|
@@ -13845,7 +13979,7 @@ Tabs.displayName = "Tabs_UI";
|
|
|
13845
13979
|
//#endregion
|
|
13846
13980
|
//#region src/components/Tabs/TabsContent.tsx
|
|
13847
13981
|
const TabsContent = ({ children, value }) => {
|
|
13848
|
-
return /* @__PURE__ */ jsx(
|
|
13982
|
+
return /* @__PURE__ */ jsx(Tabs$1.Panel, {
|
|
13849
13983
|
value,
|
|
13850
13984
|
children
|
|
13851
13985
|
});
|
|
@@ -13870,7 +14004,7 @@ const SelectedTabIndicator = () => {
|
|
|
13870
14004
|
};
|
|
13871
14005
|
//#endregion
|
|
13872
14006
|
//#region src/components/Tabs/TabsList.tsx
|
|
13873
|
-
const StyledTabsList = styled(
|
|
14007
|
+
const StyledTabsList = styled(Tabs$1.List)`
|
|
13874
14008
|
${segmentedControlStyles}
|
|
13875
14009
|
`;
|
|
13876
14010
|
const TabsList = ({ children, fullWidth = true, ...props }) => {
|
|
@@ -13883,7 +14017,7 @@ const TabsList = ({ children, fullWidth = true, ...props }) => {
|
|
|
13883
14017
|
TabsList.displayName = "TabsList_UI";
|
|
13884
14018
|
//#endregion
|
|
13885
14019
|
//#region src/components/Tabs/StyledTabsTrigger.tsx
|
|
13886
|
-
const StyledTabsTrigger = styled(
|
|
14020
|
+
const StyledTabsTrigger = styled(Tabs$1.Tab)`
|
|
13887
14021
|
${segmentedControlItemStyles}
|
|
13888
14022
|
|
|
13889
14023
|
&:focus-visible {
|