@wistia/ui 0.23.0 → 0.24.0-beta.69711dfb.bc58919
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 +192 -79
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1140 -999
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.
|
|
3
|
+
* @license @wistia/ui v0.24.0-beta.69711dfb.bc58919
|
|
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";
|
|
@@ -24,23 +24,26 @@ import { useFilePicker as useFilePicker$1, useImperativeFilePicker as useImperat
|
|
|
24
24
|
import { FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, ImageDimensionsValidator, PersistentFileAmountLimitValidator } from "use-file-picker/validators";
|
|
25
25
|
import { debounce, throttle } from "throttle-debounce";
|
|
26
26
|
import { Link as Link$1, useInRouterContext } from "react-router";
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
27
|
+
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
28
|
+
import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
|
|
29
29
|
import { differenceEuclidean, easingSmootherstep, formatHex, interpolate, modeHsv, modeLrgb, modeRgb, parseHex, useMode, wcagContrast } from "culori/fn";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
30
|
+
import { Radio as Radio$1 } from "@base-ui/react/radio";
|
|
31
|
+
import { ToggleGroup } from "@base-ui/react/toggle-group";
|
|
32
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
33
|
+
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
34
|
+
import { Slider as Slider$1 } from "@base-ui/react/slider";
|
|
33
35
|
import * as Ariakit from "@ariakit/react";
|
|
34
36
|
import { matchSorter } from "match-sorter";
|
|
35
37
|
import { createPortal } from "react-dom";
|
|
36
|
-
import {
|
|
38
|
+
import { ContextMenu as ContextMenu$1 } from "@base-ui/react/context-menu";
|
|
39
|
+
import { Menu as Menu$1 } from "@base-ui/react/menu";
|
|
37
40
|
import { ValidationError } from "yup";
|
|
38
|
-
import {
|
|
41
|
+
import { PreviewCard as PreviewCard$1 } from "@base-ui/react/preview-card";
|
|
39
42
|
import ReactMarkdown from "react-markdown";
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
43
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
44
|
+
import { Progress } from "@base-ui/react/progress";
|
|
45
|
+
import { Select as Select$1 } from "@base-ui/react/select";
|
|
46
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
44
47
|
//#region src/css/globalStyleAdjustmentsCss.tsx
|
|
45
48
|
const globalStyleAdjustmentsCss = css`
|
|
46
49
|
/**
|
|
@@ -450,7 +453,7 @@ const UIProvider = ({ children }) => {
|
|
|
450
453
|
if (useContext(UIProviderNestingContext)) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
451
454
|
return /* @__PURE__ */ jsx(UIProviderNestingContext.Provider, {
|
|
452
455
|
value: true,
|
|
453
|
-
children: /* @__PURE__ */ jsx(AriaLiveProvider, { children: /* @__PURE__ */ jsxs(Provider, { children: [
|
|
456
|
+
children: /* @__PURE__ */ jsx(AriaLiveProvider, { children: /* @__PURE__ */ jsxs(Tooltip$1.Provider, { children: [
|
|
454
457
|
/* @__PURE__ */ jsx(GlobalStyle, {}),
|
|
455
458
|
children,
|
|
456
459
|
/* @__PURE__ */ jsx(ToastProvider, {})
|
|
@@ -7228,30 +7231,39 @@ const ClickRegion = ({ children, targetRef }) => {
|
|
|
7228
7231
|
ClickRegion.displayName = "ClickRegion_UI";
|
|
7229
7232
|
//#endregion
|
|
7230
7233
|
//#region src/components/Collapsible/Collapsible.tsx
|
|
7231
|
-
const StyledRoot = styled(
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7234
|
+
const StyledRoot = styled(Collapsible$1.Root)`
|
|
7235
|
+
${({ $isOpen }) => !$isOpen && css`
|
|
7236
|
+
[data-wui-collapsible-content] {
|
|
7237
|
+
display: -webkit-box;
|
|
7238
|
+
-webkit-box-orient: vertical;
|
|
7239
|
+
-webkit-line-clamp: var(--wui-collapsible-content-clamp-lines);
|
|
7240
|
+
overflow: hidden;
|
|
7241
|
+
}
|
|
7242
|
+
`}
|
|
7238
7243
|
`;
|
|
7239
7244
|
/**
|
|
7240
7245
|
* Toggle the visibility of content with a trigger.
|
|
7241
7246
|
*/
|
|
7242
|
-
const Collapsible = ({ children, isOpen
|
|
7247
|
+
const Collapsible = ({ children, isOpen, onOpenChange }) => {
|
|
7248
|
+
const isControlled = isNotNil(isOpen);
|
|
7249
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
7250
|
+
const handleOpenChange = (open) => {
|
|
7251
|
+
if (!isControlled) setInternalOpen(open);
|
|
7252
|
+
onOpenChange?.(open);
|
|
7253
|
+
};
|
|
7243
7254
|
return /* @__PURE__ */ jsx(StyledRoot, {
|
|
7244
|
-
|
|
7255
|
+
$isOpen: isControlled ? isOpen : internalOpen,
|
|
7256
|
+
...isControlled ? {
|
|
7245
7257
|
open: isOpen,
|
|
7246
|
-
onOpenChange
|
|
7247
|
-
} : {},
|
|
7258
|
+
onOpenChange: handleOpenChange
|
|
7259
|
+
} : { onOpenChange: handleOpenChange },
|
|
7248
7260
|
children
|
|
7249
7261
|
});
|
|
7250
7262
|
};
|
|
7251
7263
|
Collapsible.displayName = "Collapsible_UI";
|
|
7252
7264
|
//#endregion
|
|
7253
7265
|
//#region src/components/Collapsible/CollapsibleTrigger.tsx
|
|
7254
|
-
const StyledTrigger$1 = styled(
|
|
7266
|
+
const StyledTrigger$1 = styled(Collapsible$1.Trigger)`
|
|
7255
7267
|
[data-wui-collapsible-icon] {
|
|
7256
7268
|
transition: transform var(--wui-motion-duration-03) ease-in-out;
|
|
7257
7269
|
}
|
|
@@ -7274,10 +7286,7 @@ const StyledTrigger$1 = styled(Trigger$1)`
|
|
|
7274
7286
|
`;
|
|
7275
7287
|
const CollapsibleTrigger = ({ children }) => {
|
|
7276
7288
|
Children.only(children);
|
|
7277
|
-
return /* @__PURE__ */ jsx(StyledTrigger$1, {
|
|
7278
|
-
asChild: true,
|
|
7279
|
-
children
|
|
7280
|
-
});
|
|
7289
|
+
return /* @__PURE__ */ jsx(StyledTrigger$1, { render: children });
|
|
7281
7290
|
};
|
|
7282
7291
|
//#endregion
|
|
7283
7292
|
//#region src/components/Collapsible/CollapsibleTriggerIcon.tsx
|
|
@@ -7308,7 +7317,7 @@ const CollapsibleContent = ({ clamp, children }) => {
|
|
|
7308
7317
|
"data-wui-collapsible-content": "true",
|
|
7309
7318
|
children
|
|
7310
7319
|
});
|
|
7311
|
-
return /* @__PURE__ */ jsx(
|
|
7320
|
+
return /* @__PURE__ */ jsx(Collapsible$1.Panel, { children: /* @__PURE__ */ jsxs(Fragment, { children: [children, " "] }) });
|
|
7312
7321
|
};
|
|
7313
7322
|
//#endregion
|
|
7314
7323
|
//#region src/components/ColorPicker/color-conversion-utils.ts
|
|
@@ -7783,7 +7792,7 @@ const Container$9 = styled.div`
|
|
|
7783
7792
|
const LabelContainer$1 = styled.div`
|
|
7784
7793
|
padding-top: var(--wui-space-01);
|
|
7785
7794
|
`;
|
|
7786
|
-
const ItemsContainer$1 = styled(
|
|
7795
|
+
const ItemsContainer$1 = styled(RadioGroup$1)`
|
|
7787
7796
|
display: flex;
|
|
7788
7797
|
flex-wrap: wrap;
|
|
7789
7798
|
align-items: center;
|
|
@@ -7798,7 +7807,7 @@ const ItemsContainer$1 = styled(Root$2)`
|
|
|
7798
7807
|
const ColorGrid = ({ children, label }) => {
|
|
7799
7808
|
const { valueAsHex, onChangeNonDerivedValueAsHsv } = useColorPickerState();
|
|
7800
7809
|
const onValueChange = useCallback((value) => {
|
|
7801
|
-
onChangeNonDerivedValueAsHsv(convertToHsv(value));
|
|
7810
|
+
if (typeof value === "string") onChangeNonDerivedValueAsHsv(convertToHsv(value));
|
|
7802
7811
|
}, [onChangeNonDerivedValueAsHsv]);
|
|
7803
7812
|
return /* @__PURE__ */ jsxs(Container$9, { children: [label != null && /* @__PURE__ */ jsx(LabelContainer$1, { children: /* @__PURE__ */ jsx(Label, { children: label }) }), /* @__PURE__ */ jsx(ItemsContainer$1, {
|
|
7804
7813
|
onValueChange,
|
|
@@ -7896,7 +7905,7 @@ const slideRightAndFade = keyframes`
|
|
|
7896
7905
|
transform: translateX(0);
|
|
7897
7906
|
}
|
|
7898
7907
|
`;
|
|
7899
|
-
const
|
|
7908
|
+
const StyledPopup$5 = styled(Tooltip$1.Popup)`
|
|
7900
7909
|
--tooltip-font-family: var(--wui-typography-family-default);
|
|
7901
7910
|
--tooltip-border-radius: var(--wui-border-radius-05);
|
|
7902
7911
|
--tooltip-bg: var(--wui-color-bg-tooltip);
|
|
@@ -7922,27 +7931,54 @@ const StyledContent$3 = styled(Content)`
|
|
|
7922
7931
|
max-width: 30em;
|
|
7923
7932
|
z-index: var(--wui-zindex-tooltip);
|
|
7924
7933
|
|
|
7925
|
-
&[data-
|
|
7934
|
+
&[data-closed] {
|
|
7926
7935
|
animation-name: ${hide};
|
|
7927
7936
|
}
|
|
7928
7937
|
|
|
7929
|
-
&[data-
|
|
7938
|
+
&[data-open][data-side='top'] {
|
|
7930
7939
|
animation-name: ${slideUpAndFade};
|
|
7931
7940
|
}
|
|
7932
7941
|
|
|
7933
|
-
&[data-
|
|
7942
|
+
&[data-open][data-side='right'] {
|
|
7934
7943
|
animation-name: ${slideRightAndFade};
|
|
7935
7944
|
}
|
|
7936
7945
|
|
|
7937
|
-
&[data-
|
|
7946
|
+
&[data-open][data-side='bottom'] {
|
|
7938
7947
|
animation-name: ${slideDownAndFade};
|
|
7939
7948
|
}
|
|
7940
7949
|
|
|
7941
|
-
&[data-
|
|
7950
|
+
&[data-open][data-side='left'] {
|
|
7942
7951
|
animation-name: ${slideLeftAndFade};
|
|
7943
7952
|
}
|
|
7953
|
+
|
|
7954
|
+
overflow: visible;
|
|
7955
|
+
`;
|
|
7956
|
+
const arrowEdgeCss = css`
|
|
7957
|
+
&[data-side='top'] {
|
|
7958
|
+
bottom: 0;
|
|
7959
|
+
transform: translateY(calc(100% - 2px));
|
|
7960
|
+
}
|
|
7961
|
+
|
|
7962
|
+
&[data-side='bottom'] {
|
|
7963
|
+
top: 0;
|
|
7964
|
+
transform: translateY(calc(-100% + 2px)) rotate(180deg);
|
|
7965
|
+
}
|
|
7966
|
+
|
|
7967
|
+
&[data-side='left'] {
|
|
7968
|
+
right: 0;
|
|
7969
|
+
transform: translateX(calc(100% - 4px)) rotate(-90deg);
|
|
7970
|
+
}
|
|
7971
|
+
|
|
7972
|
+
&[data-side='right'] {
|
|
7973
|
+
left: 0;
|
|
7974
|
+
transform: translateX(calc(-100% + 4px)) rotate(90deg);
|
|
7975
|
+
}
|
|
7976
|
+
`;
|
|
7977
|
+
const StyledTooltipArrow = styled.svg`
|
|
7978
|
+
${arrowEdgeCss}
|
|
7944
7979
|
`;
|
|
7945
7980
|
const VISUAL_OFFSET = 6;
|
|
7981
|
+
const ARROW_EXTENSION = 6;
|
|
7946
7982
|
/**
|
|
7947
7983
|
* Tooltips are a way to provide additional information or context to a user when they hover or focus an element.
|
|
7948
7984
|
* For elements that are not interactive, consider using a [Popover]() instead.
|
|
@@ -7952,29 +7988,27 @@ const Tooltip = ({ delay = 500, direction = "top", content, children, forceOpen,
|
|
|
7952
7988
|
const rootProps = {};
|
|
7953
7989
|
if (content === "" || content === null) rootProps.open = false;
|
|
7954
7990
|
if (forceOpen === true) rootProps.open = true;
|
|
7955
|
-
return /* @__PURE__ */ jsxs(Root, {
|
|
7956
|
-
delayDuration: delay,
|
|
7991
|
+
return /* @__PURE__ */ jsxs(Tooltip$1.Root, {
|
|
7957
7992
|
...rootProps,
|
|
7958
|
-
children: [/* @__PURE__ */ jsx(Trigger, {
|
|
7959
|
-
|
|
7960
|
-
children
|
|
7961
|
-
}), /* @__PURE__ */ jsx(Portal, {
|
|
7962
|
-
container,
|
|
7963
|
-
children: /* @__PURE__ */
|
|
7993
|
+
children: [/* @__PURE__ */ jsx(Tooltip$1.Trigger, {
|
|
7994
|
+
delay,
|
|
7995
|
+
render: isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children })
|
|
7996
|
+
}), /* @__PURE__ */ jsx(Tooltip$1.Portal, {
|
|
7997
|
+
...container != null ? { container } : {},
|
|
7998
|
+
children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
7964
7999
|
side: direction,
|
|
7965
|
-
sideOffset: hideArrow ? VISUAL_OFFSET : VISUAL_OFFSET
|
|
7966
|
-
children:
|
|
7967
|
-
|
|
7968
|
-
children: /* @__PURE__ */ jsx(
|
|
8000
|
+
sideOffset: hideArrow ? VISUAL_OFFSET : VISUAL_OFFSET + ARROW_EXTENSION,
|
|
8001
|
+
children: /* @__PURE__ */ jsxs(StyledPopup$5, {
|
|
8002
|
+
role: "tooltip",
|
|
8003
|
+
children: [content, !hideArrow ? /* @__PURE__ */ jsx(Tooltip$1.Arrow, { render: /* @__PURE__ */ jsx(StyledTooltipArrow, {
|
|
7969
8004
|
fill: "var(--tooltip-bg)",
|
|
7970
8005
|
height: "8",
|
|
7971
|
-
style: { transform: "translateY(-2px)" },
|
|
7972
8006
|
viewBox: "0 0 12 8",
|
|
7973
8007
|
width: "12",
|
|
7974
8008
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7975
8009
|
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" })
|
|
7976
|
-
})
|
|
7977
|
-
})
|
|
8010
|
+
}) }) : null]
|
|
8011
|
+
})
|
|
7978
8012
|
})
|
|
7979
8013
|
})]
|
|
7980
8014
|
});
|
|
@@ -7982,7 +8016,7 @@ const Tooltip = ({ delay = 500, direction = "top", content, children, forceOpen,
|
|
|
7982
8016
|
Tooltip.displayName = "Tooltip_UI";
|
|
7983
8017
|
//#endregion
|
|
7984
8018
|
//#region src/components/ColorPicker/ColorGridOption.tsx
|
|
7985
|
-
const Container$8 = styled(
|
|
8019
|
+
const Container$8 = styled(Radio$1.Root)`
|
|
7986
8020
|
border: none;
|
|
7987
8021
|
appearance: none;
|
|
7988
8022
|
outline: none;
|
|
@@ -8023,7 +8057,7 @@ const ColorGridOption = ({ value: rawValue, name }) => {
|
|
|
8023
8057
|
ColorGridOption.displayName = "ColorGridOption_UI";
|
|
8024
8058
|
//#endregion
|
|
8025
8059
|
//#region src/components/ColorPicker/ColorList.tsx
|
|
8026
|
-
const Container$7 = styled(
|
|
8060
|
+
const Container$7 = styled(ToggleGroup)`
|
|
8027
8061
|
display: grid;
|
|
8028
8062
|
grid-template-columns: minmax(0, 1fr);
|
|
8029
8063
|
`;
|
|
@@ -8035,12 +8069,12 @@ const Container$7 = styled(Root$3)`
|
|
|
8035
8069
|
const ColorList = ({ children }) => {
|
|
8036
8070
|
const { valueAsHex, onChangeNonDerivedValueAsHsv } = useColorPickerState();
|
|
8037
8071
|
return /* @__PURE__ */ jsx(Container$7, {
|
|
8038
|
-
onValueChange: useCallback((
|
|
8039
|
-
|
|
8072
|
+
onValueChange: useCallback((newValue) => {
|
|
8073
|
+
const value = newValue[0];
|
|
8074
|
+
if (value === void 0 || value === "") return;
|
|
8040
8075
|
onChangeNonDerivedValueAsHsv(convertToHsv(value));
|
|
8041
8076
|
}, [onChangeNonDerivedValueAsHsv]),
|
|
8042
|
-
|
|
8043
|
-
value: valueAsHex,
|
|
8077
|
+
value: [valueAsHex],
|
|
8044
8078
|
children
|
|
8045
8079
|
});
|
|
8046
8080
|
};
|
|
@@ -8092,7 +8126,7 @@ const ColorNameOrHexCode = ({ name, hexCode }) => {
|
|
|
8092
8126
|
};
|
|
8093
8127
|
//#endregion
|
|
8094
8128
|
//#region src/components/ColorPicker/ColorListOption.tsx
|
|
8095
|
-
const Container$5 = styled(
|
|
8129
|
+
const Container$5 = styled(Toggle)`
|
|
8096
8130
|
border: none;
|
|
8097
8131
|
appearance: none;
|
|
8098
8132
|
outline: none;
|
|
@@ -8169,7 +8203,7 @@ const ColorPicker = ({ children, colorForComparison = DEFAULT_COLOR_FOR_COMPARIS
|
|
|
8169
8203
|
const handleOpenChange = (isOpen) => {
|
|
8170
8204
|
if (isFunction(onOpenChange)) onOpenChange(isOpen);
|
|
8171
8205
|
};
|
|
8172
|
-
return /* @__PURE__ */ jsx(Root
|
|
8206
|
+
return /* @__PURE__ */ jsx(Popover$1.Root, {
|
|
8173
8207
|
modal: false,
|
|
8174
8208
|
onOpenChange: handleOpenChange,
|
|
8175
8209
|
children: /* @__PURE__ */ jsx(ColorPickerProvider, {
|
|
@@ -8185,7 +8219,7 @@ const ColorPicker = ({ children, colorForComparison = DEFAULT_COLOR_FOR_COMPARIS
|
|
|
8185
8219
|
ColorPicker.displayName = "ColorPicker_UI";
|
|
8186
8220
|
//#endregion
|
|
8187
8221
|
//#region src/components/ColorPicker/ColorPickerPopoverContent.tsx
|
|
8188
|
-
const
|
|
8222
|
+
const StyledPopup$4 = styled(Popover$1.Popup)`
|
|
8189
8223
|
background-color: var(--wui-color-bg-surface);
|
|
8190
8224
|
border-radius: var(--wui-border-radius-02);
|
|
8191
8225
|
border: 1px solid var(--wui-color-border);
|
|
@@ -8202,10 +8236,10 @@ const StyledPopoverContent = styled(Content$2)`
|
|
|
8202
8236
|
* Use `ColorPickerSection` to organize content within it.
|
|
8203
8237
|
*/
|
|
8204
8238
|
const ColorPickerPopoverContent = ({ children }) => {
|
|
8205
|
-
return /* @__PURE__ */ jsx(
|
|
8239
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
8206
8240
|
align: "start",
|
|
8207
8241
|
sideOffset: 4,
|
|
8208
|
-
children
|
|
8242
|
+
children: /* @__PURE__ */ jsx(StyledPopup$4, { children })
|
|
8209
8243
|
}) });
|
|
8210
8244
|
};
|
|
8211
8245
|
ColorPickerPopoverContent.displayName = "ColorPickerPopoverContent_UI";
|
|
@@ -8252,7 +8286,7 @@ const ValueNameOrHexCode = (props) => {
|
|
|
8252
8286
|
ValueNameOrHexCode.displayName = "ValueNameOrHexCode_UI";
|
|
8253
8287
|
//#endregion
|
|
8254
8288
|
//#region src/components/ColorPicker/ColorPickerTrigger.tsx
|
|
8255
|
-
const StyledPopoverTrigger = styled(Trigger
|
|
8289
|
+
const StyledPopoverTrigger = styled(Popover$1.Trigger)`
|
|
8256
8290
|
background-color: var(--wui-color-bg-surface);
|
|
8257
8291
|
border-radius: var(--wui-border-radius-rounded);
|
|
8258
8292
|
border: none;
|
|
@@ -8905,7 +8939,7 @@ const Container$2 = styled.div`
|
|
|
8905
8939
|
padding: 0 var(--wui-space-03);
|
|
8906
8940
|
position: relative;
|
|
8907
8941
|
`;
|
|
8908
|
-
const Root
|
|
8942
|
+
const Root = styled(Slider$1.Root)`
|
|
8909
8943
|
align-items: center;
|
|
8910
8944
|
display: flex;
|
|
8911
8945
|
position: absolute;
|
|
@@ -8914,10 +8948,10 @@ const Root$11 = styled(Root$5)`
|
|
|
8914
8948
|
width: calc(100% - var(--wui-space-05));
|
|
8915
8949
|
height: 16px;
|
|
8916
8950
|
`;
|
|
8917
|
-
const Track
|
|
8951
|
+
const Track = styled(Slider$1.Track)`
|
|
8918
8952
|
width: 100%;
|
|
8919
8953
|
`;
|
|
8920
|
-
const Thumb$
|
|
8954
|
+
const Thumb$1 = styled(Slider$1.Thumb)`
|
|
8921
8955
|
position: relative;
|
|
8922
8956
|
`;
|
|
8923
8957
|
const ThumbInner = styled.div`
|
|
@@ -8932,7 +8966,7 @@ const ThumbInner = styled.div`
|
|
|
8932
8966
|
transform: translate(-50%, -50%);
|
|
8933
8967
|
width: 16px;
|
|
8934
8968
|
|
|
8935
|
-
${Thumb$
|
|
8969
|
+
${Thumb$1}:focus-visible > & {
|
|
8936
8970
|
box-shadow:
|
|
8937
8971
|
inset 0 0 0 2px var(--wui-color-border),
|
|
8938
8972
|
inset 0 0 0 3px black;
|
|
@@ -8957,7 +8991,7 @@ const HueSlider = (props) => {
|
|
|
8957
8991
|
return { backgroundColor: formatHex(valueAsHsv) };
|
|
8958
8992
|
}, [valueAsHsv]);
|
|
8959
8993
|
const onHueChange = useCallback((values) => {
|
|
8960
|
-
const newHue = values[0] ?? 0;
|
|
8994
|
+
const newHue = typeof values === "number" ? values : values[0] ?? 0;
|
|
8961
8995
|
onChangeNonDerivedValueAsHsv({
|
|
8962
8996
|
...nonDerivedValueAsHsv,
|
|
8963
8997
|
h: newHue
|
|
@@ -8966,17 +9000,17 @@ const HueSlider = (props) => {
|
|
|
8966
9000
|
return /* @__PURE__ */ jsxs(Container$2, {
|
|
8967
9001
|
...props,
|
|
8968
9002
|
style: containerStyle,
|
|
8969
|
-
children: [/* @__PURE__ */
|
|
9003
|
+
children: [/* @__PURE__ */ jsx(Root, {
|
|
8970
9004
|
max: 360,
|
|
8971
9005
|
min: 0,
|
|
8972
9006
|
onValueChange: onHueChange,
|
|
8973
9007
|
orientation: "horizontal",
|
|
8974
9008
|
step: 1,
|
|
8975
9009
|
value: [nonDerivedValueAsHsv.h ?? 0],
|
|
8976
|
-
children: [/* @__PURE__ */ jsx(Track
|
|
9010
|
+
children: /* @__PURE__ */ jsxs(Slider$1.Control, { children: [/* @__PURE__ */ jsx(Track, {}), /* @__PURE__ */ jsx(Thumb$1, {
|
|
8977
9011
|
"aria-label": "Hue slider",
|
|
8978
9012
|
children: /* @__PURE__ */ jsx(ThumbInner, { style: thumbInnerStyle })
|
|
8979
|
-
})]
|
|
9013
|
+
})] })
|
|
8980
9014
|
}), /* @__PURE__ */ jsx(HSVHueCanvas, { hsv: valueAsHsv })]
|
|
8981
9015
|
});
|
|
8982
9016
|
};
|
|
@@ -9106,7 +9140,7 @@ const Container$1 = styled.div`
|
|
|
9106
9140
|
overflow: hidden;
|
|
9107
9141
|
position: relative;
|
|
9108
9142
|
`;
|
|
9109
|
-
const Thumb
|
|
9143
|
+
const Thumb = styled.button.attrs({ type: "button" })`
|
|
9110
9144
|
appearance: none;
|
|
9111
9145
|
border-radius: var(--wui-border-radius-rounded);
|
|
9112
9146
|
border: none;
|
|
@@ -9241,7 +9275,7 @@ const SaturationAndValuePicker = ({ dataTestId }) => {
|
|
|
9241
9275
|
"data-testid": dataTestId,
|
|
9242
9276
|
onMouseDown: onContainerMouseDown,
|
|
9243
9277
|
children: [
|
|
9244
|
-
/* @__PURE__ */ jsx(Thumb
|
|
9278
|
+
/* @__PURE__ */ jsx(Thumb, {
|
|
9245
9279
|
ref: thumbRef,
|
|
9246
9280
|
"aria-describedby": instructionsId,
|
|
9247
9281
|
"aria-label": "Saturation and value thumb",
|
|
@@ -9706,18 +9740,18 @@ const menuContentCss = css`
|
|
|
9706
9740
|
font-family: var(--menu-font-family);
|
|
9707
9741
|
background: var(--menu-bg);
|
|
9708
9742
|
border-radius: var(--menu-border-radius);
|
|
9709
|
-
box-shadow: var(--menu-shadow);
|
|
9710
|
-
max-height: var(--
|
|
9743
|
+
box-shadow: var(--menu-shadow);
|
|
9744
|
+
max-height: var(--available-height);
|
|
9711
9745
|
min-width: var(--menu-min-width);
|
|
9712
9746
|
max-width: var(--menu-max-width);
|
|
9713
9747
|
overflow: auto;
|
|
9714
9748
|
padding: var(--menu-padding);
|
|
9715
|
-
transform-origin: var(--
|
|
9749
|
+
transform-origin: var(--transform-origin);
|
|
9716
9750
|
z-index: var(--wui-zindex-menu);
|
|
9717
9751
|
border: 1px solid var(--wui-color-border);
|
|
9718
9752
|
|
|
9719
|
-
&[data-
|
|
9720
|
-
animation: var(--menu-animation-duration) var(--wui-motion-ease-in) ${close};
|
|
9753
|
+
&[data-closed] {
|
|
9754
|
+
animation: var(--menu-animation-duration) var(--wui-motion-ease-in) ${close};
|
|
9721
9755
|
}
|
|
9722
9756
|
|
|
9723
9757
|
${mq.smAndUp} {
|
|
@@ -9732,18 +9766,21 @@ const menuContentCss = css`
|
|
|
9732
9766
|
margin: var(--menu-divider-margin) 0;
|
|
9733
9767
|
}
|
|
9734
9768
|
`;
|
|
9735
|
-
const
|
|
9769
|
+
const MenuPopup = styled(Menu$1.Popup)`
|
|
9736
9770
|
${menuContentCss}
|
|
9737
|
-
min-width: var(--
|
|
9771
|
+
min-width: var(--anchor-width);
|
|
9738
9772
|
`;
|
|
9739
9773
|
/**
|
|
9740
9774
|
* Displays a menu to the users with a set of actions.
|
|
9741
9775
|
*/
|
|
9742
9776
|
const Menu = forwardRef(({ align = "start", children, disabled = false, compact = false, trigger, label, isOpen, side = "bottom", triggerProps = {}, onOpenChange, ...props }, ref) => {
|
|
9743
9777
|
const contextValue = useMemo(() => ({ compact }), [compact]);
|
|
9778
|
+
const handleOpenChange = useCallback((nextOpen) => {
|
|
9779
|
+
if (nextOpen !== isOpen) onOpenChange?.(nextOpen);
|
|
9780
|
+
}, [isOpen, onOpenChange]);
|
|
9744
9781
|
let controlProps = isNotNil(onOpenChange) && isNotNil(isOpen) ? {
|
|
9745
9782
|
open: isOpen,
|
|
9746
|
-
onOpenChange
|
|
9783
|
+
onOpenChange: handleOpenChange
|
|
9747
9784
|
} : {};
|
|
9748
9785
|
if (disabled) controlProps = {
|
|
9749
9786
|
open: false,
|
|
@@ -9751,584 +9788,233 @@ const Menu = forwardRef(({ align = "start", children, disabled = false, compact
|
|
|
9751
9788
|
};
|
|
9752
9789
|
return /* @__PURE__ */ jsx(MenuContext.Provider, {
|
|
9753
9790
|
value: contextValue,
|
|
9754
|
-
children: /* @__PURE__ */ jsxs(
|
|
9791
|
+
children: /* @__PURE__ */ jsxs(Menu$1.Root, {
|
|
9755
9792
|
modal: false,
|
|
9756
9793
|
...controlProps,
|
|
9757
|
-
children: [/* @__PURE__ */ jsx(
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
...triggerProps,
|
|
9766
|
-
children: label
|
|
9767
|
-
})
|
|
9768
|
-
}), /* @__PURE__ */ jsx(DropdownMenuPortal, { children: /* @__PURE__ */ jsx(MenuContent, {
|
|
9769
|
-
...props,
|
|
9770
|
-
$compact: compact,
|
|
9794
|
+
children: [/* @__PURE__ */ jsx(Menu$1.Trigger, { render: isNotUndefined(trigger) ? trigger : /* @__PURE__ */ jsx(Button, {
|
|
9795
|
+
ref,
|
|
9796
|
+
disabled,
|
|
9797
|
+
forceState: isOpen ? "active" : void 0,
|
|
9798
|
+
rightIcon: /* @__PURE__ */ jsx(Icon, { type: "caret-down" }),
|
|
9799
|
+
...triggerProps,
|
|
9800
|
+
children: label
|
|
9801
|
+
}) }), /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(Menu$1.Positioner, {
|
|
9771
9802
|
align,
|
|
9772
9803
|
collisionPadding: 8,
|
|
9773
|
-
onFocusOutside: (event) => {
|
|
9774
|
-
event.preventDefault();
|
|
9775
|
-
},
|
|
9776
9804
|
side,
|
|
9777
9805
|
sideOffset: 6,
|
|
9778
|
-
children
|
|
9806
|
+
children: /* @__PURE__ */ jsx(MenuPopup, {
|
|
9807
|
+
...props,
|
|
9808
|
+
$compact: compact,
|
|
9809
|
+
children
|
|
9810
|
+
})
|
|
9779
9811
|
}) })]
|
|
9780
9812
|
})
|
|
9781
9813
|
});
|
|
9782
9814
|
});
|
|
9783
9815
|
Menu.displayName = "Menu_UI";
|
|
9784
|
-
Menu.displayName = "Menu_UI";
|
|
9785
9816
|
//#endregion
|
|
9786
|
-
//#region src/components/
|
|
9787
|
-
const
|
|
9788
|
-
|
|
9817
|
+
//#region src/components/ContextMenu/ContextMenu.tsx
|
|
9818
|
+
const ContextMenuPopup = styled(Menu$1.Popup)`
|
|
9819
|
+
${menuContentCss}
|
|
9820
|
+
outline: none;
|
|
9789
9821
|
`;
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9822
|
+
/**
|
|
9823
|
+
* The ContextMenu is an extended implementation of the [Menu]() component that allows for right-click context menus.
|
|
9824
|
+
* It can be used in two ways:
|
|
9825
|
+
* 1. By providing a `triggerRef`, which will render the menu when the referenced element is right-clicked.
|
|
9826
|
+
* 2. By providing a `position` prop, which will render the menu at the specified coordinates.
|
|
9827
|
+
*/
|
|
9828
|
+
const ContextMenu = ({ position, triggerRef, children, side = "bottom", onRequestClose = () => null, compact = false }) => {
|
|
9829
|
+
const [isRightClicked, setIsRightClicked] = useState(false);
|
|
9830
|
+
const [menuPosition, setMenuPosition] = useState(position ?? {
|
|
9831
|
+
x: 0,
|
|
9832
|
+
y: 0
|
|
9833
|
+
});
|
|
9834
|
+
const contextValue = useMemo(() => ({ compact }), [compact]);
|
|
9835
|
+
useEffect(() => {
|
|
9836
|
+
if (isNil(position)) {
|
|
9837
|
+
const onContextMenu = (event) => {
|
|
9838
|
+
event.preventDefault();
|
|
9839
|
+
setMenuPosition({
|
|
9840
|
+
x: event.clientX,
|
|
9841
|
+
y: event.clientY
|
|
9842
|
+
});
|
|
9843
|
+
setIsRightClicked(true);
|
|
9844
|
+
};
|
|
9845
|
+
const triggerEl = triggerRef?.current;
|
|
9846
|
+
triggerEl?.addEventListener("contextmenu", onContextMenu);
|
|
9847
|
+
return () => {
|
|
9848
|
+
triggerEl?.removeEventListener("contextmenu", onContextMenu);
|
|
9849
|
+
};
|
|
9850
|
+
}
|
|
9851
|
+
return () => null;
|
|
9852
|
+
}, [position, triggerRef]);
|
|
9853
|
+
const isOpen = isNotNil(position) || isRightClicked;
|
|
9854
|
+
const anchor = useMemo(() => ({ getBoundingClientRect: () => ({
|
|
9855
|
+
x: menuPosition.x,
|
|
9856
|
+
y: menuPosition.y,
|
|
9857
|
+
width: 0,
|
|
9858
|
+
height: 0,
|
|
9859
|
+
top: menuPosition.y,
|
|
9860
|
+
right: menuPosition.x,
|
|
9861
|
+
bottom: menuPosition.y,
|
|
9862
|
+
left: menuPosition.x
|
|
9863
|
+
}) }), [menuPosition.x, menuPosition.y]);
|
|
9864
|
+
const handleOpenChange = (next) => {
|
|
9865
|
+
setIsRightClicked(next);
|
|
9866
|
+
if (!next) onRequestClose();
|
|
9867
|
+
};
|
|
9868
|
+
const menu = /* @__PURE__ */ jsx(MenuContext.Provider, {
|
|
9869
|
+
value: contextValue,
|
|
9870
|
+
children: /* @__PURE__ */ jsx(ContextMenu$1.Root, {
|
|
9871
|
+
onOpenChange: handleOpenChange,
|
|
9872
|
+
open: isOpen,
|
|
9873
|
+
children: /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(Menu$1.Positioner, {
|
|
9874
|
+
anchor,
|
|
9875
|
+
collisionPadding: 8,
|
|
9876
|
+
side,
|
|
9877
|
+
sideOffset: 6,
|
|
9878
|
+
children: /* @__PURE__ */ jsx(ContextMenuPopup, {
|
|
9879
|
+
$compact: compact,
|
|
9880
|
+
children
|
|
9881
|
+
})
|
|
9882
|
+
}) })
|
|
9799
9883
|
})
|
|
9800
9884
|
});
|
|
9885
|
+
if (isNotNil(triggerRef)) return createPortal(menu, document.body);
|
|
9886
|
+
return menu;
|
|
9801
9887
|
};
|
|
9802
|
-
MenuLabel.displayName = "MenuLabel_UI";
|
|
9803
9888
|
//#endregion
|
|
9804
|
-
//#region src/components/
|
|
9805
|
-
const
|
|
9806
|
-
|
|
9889
|
+
//#region src/components/CustomizableThemeWrapper/CustomizableThemeWrapper.tsx
|
|
9890
|
+
const StyledCustomizableThemeWrapper = styled.div((props) => props.$overrides);
|
|
9891
|
+
/**
|
|
9892
|
+
* Used for overriding the default theme tokens with custom values.
|
|
9893
|
+
* This should only be used when the ui systems team has been consulted first.
|
|
9894
|
+
*/
|
|
9895
|
+
const CustomizableThemeWrapper = ({ children, overrides, ...props }) => /* @__PURE__ */ jsx(StyledCustomizableThemeWrapper, {
|
|
9896
|
+
...props,
|
|
9897
|
+
$overrides: overrides,
|
|
9898
|
+
"data-wui-theme": "true",
|
|
9899
|
+
children
|
|
9900
|
+
});
|
|
9901
|
+
CustomizableThemeWrapper.displayName = "CustomizableThemeWrapper_UI";
|
|
9902
|
+
//#endregion
|
|
9903
|
+
//#region src/components/DataCards/DataCard.tsx
|
|
9904
|
+
const pulse = keyframes`
|
|
9905
|
+
0%,
|
|
9906
|
+
100% {
|
|
9907
|
+
opacity: 1;
|
|
9908
|
+
}
|
|
9909
|
+
50% {
|
|
9910
|
+
opacity: 0.5;
|
|
9911
|
+
}
|
|
9912
|
+
`;
|
|
9913
|
+
const StyledDataCard = styled.div`
|
|
9914
|
+
--wui-data-card-text: var(--wui-color-text-button);
|
|
9915
|
+
--wui-color-text: var(--wui-data-card-text);
|
|
9916
|
+
--wui-data-card-background: var(--wui-color-bg-surface-secondary);
|
|
9917
|
+
--wui-data-card-background-hover: var(--wui-color-bg-surface-secondary-hover);
|
|
9918
|
+
--wui-data-card-background-active: var(--wui-color-bg-surface-secondary-active);
|
|
9919
|
+
--wui-data-card-skeleton-color: var(--wui-color-bg-surface-tertiary);
|
|
9807
9920
|
|
|
9808
|
-
display:
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
transition:
|
|
9921
|
+
display: grid;
|
|
9922
|
+
grid-template-areas: 'label slot' 'value value';
|
|
9923
|
+
grid-template-rows: auto auto;
|
|
9924
|
+
grid-template-columns: auto auto;
|
|
9925
|
+
gap: var(--wui-space-01);
|
|
9926
|
+
padding: var(--wui-space-03);
|
|
9927
|
+
background: var(--wui-data-card-background);
|
|
9928
|
+
flex: 1;
|
|
9929
|
+
border-radius: var(--wui-border-radius-02);
|
|
9930
|
+
position: relative;
|
|
9931
|
+
transition:
|
|
9932
|
+
background var(--wui-motion-duration-01) var(--wui-motion-ease),
|
|
9933
|
+
box-shadow var(--wui-motion-duration-01) var(--wui-motion-ease),
|
|
9934
|
+
color var(--wui-motion-duration-01) var(--wui-motion-ease);
|
|
9819
9935
|
|
|
9820
|
-
|
|
9821
|
-
|
|
9936
|
+
[data-wui-data-card-hover-icon] {
|
|
9937
|
+
opacity: 0;
|
|
9938
|
+
transform: translateX(-16px);
|
|
9939
|
+
transition: all var(--wui-motion-duration-02) var(--wui-motion-ease-out);
|
|
9822
9940
|
}
|
|
9823
9941
|
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
background-color: var(--wui-color-bg-surface-hover);
|
|
9942
|
+
&:has([data-wui-data-card-subtitle]) {
|
|
9943
|
+
grid-template-areas: 'label slot' 'value value' 'subtitle subtitle';
|
|
9944
|
+
grid-template-rows: auto auto auto;
|
|
9828
9945
|
}
|
|
9829
9946
|
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9947
|
+
[data-wui-data-card-skeleton='true'] {
|
|
9948
|
+
pointer-events: none;
|
|
9949
|
+
background-color: var(--wui-data-card-skeleton-color);
|
|
9950
|
+
animation: ${pulse} 1.5s var(--wui-motion-ease-in-out) 0.5s infinite;
|
|
9951
|
+
color: transparent;
|
|
9952
|
+
user-select: none;
|
|
9953
|
+
border-radius: var(--wui-border-radius-01);
|
|
9954
|
+
width: fit-content;
|
|
9955
|
+
}
|
|
9834
9956
|
|
|
9835
|
-
|
|
9836
|
-
|
|
9957
|
+
&[data-click-region] {
|
|
9958
|
+
&:not([disabled]) {
|
|
9959
|
+
cursor: pointer;
|
|
9960
|
+
|
|
9961
|
+
&:hover {
|
|
9962
|
+
--wui-data-card-text: var(--wui-color-text-button);
|
|
9963
|
+
--wui-data-card-background: var(--wui-color-bg-surface-secondary-hover);
|
|
9964
|
+
|
|
9965
|
+
[data-wui-data-card-hover-icon] {
|
|
9966
|
+
opacity: 1;
|
|
9967
|
+
transform: translateX(0);
|
|
9968
|
+
}
|
|
9969
|
+
}
|
|
9970
|
+
|
|
9971
|
+
&:active {
|
|
9972
|
+
--wui-data-card-background: var(--wui-color-bg-surface-secondary-active);
|
|
9973
|
+
}
|
|
9974
|
+
|
|
9975
|
+
&:has([data-click-region-target-button]:focus-visible),
|
|
9976
|
+
&:has([data-click-region-target-link]:focus-visible) {
|
|
9977
|
+
--wui-data-card-focus-ring: var(--wui-color-border);
|
|
9978
|
+
|
|
9979
|
+
box-shadow: inset 0 0 0 2px var(--wui-data-card-focus-ring);
|
|
9980
|
+
}
|
|
9981
|
+
|
|
9982
|
+
&:has([data-click-region-target-button][aria-pressed='true']) {
|
|
9983
|
+
--wui-data-card-text: var(--wui-color-text-selected);
|
|
9984
|
+
--wui-data-card-background: var(--wui-color-bg-surface-selected);
|
|
9985
|
+
--wui-data-card-background-hover: var(--wui-color-bg-surface-selected-hover);
|
|
9986
|
+
--wui-data-card-background-active: var(--wui-color-bg-surface-selected-active);
|
|
9987
|
+
--wui-data-card-focus-ring: var(--wui-color-border-selected);
|
|
9988
|
+
--wui-data-card-skeleton-color: var(--wui-color-bg-surface-selected-active);
|
|
9989
|
+
}
|
|
9990
|
+
}
|
|
9991
|
+
|
|
9992
|
+
&[disabled] {
|
|
9993
|
+
pointer-events: none;
|
|
9837
9994
|
}
|
|
9995
|
+
|
|
9996
|
+
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
9838
9997
|
}
|
|
9839
9998
|
`;
|
|
9840
|
-
const
|
|
9841
|
-
|
|
9842
|
-
width: var(--menu-item-left-icon-size);
|
|
9999
|
+
const StyledLabel$1 = styled(Heading)`
|
|
10000
|
+
grid-area: label;
|
|
9843
10001
|
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
10002
|
+
&[data-wui-data-card-skeleton='true'] {
|
|
10003
|
+
width: 80px;
|
|
10004
|
+
}
|
|
10005
|
+
|
|
10006
|
+
button {
|
|
10007
|
+
text-align: left;
|
|
9850
10008
|
}
|
|
9851
10009
|
`;
|
|
9852
|
-
const
|
|
9853
|
-
|
|
9854
|
-
width: var(--menu-item-right-icon-size);
|
|
10010
|
+
const StyledValue = styled(Heading)`
|
|
10011
|
+
grid-area: value;
|
|
9855
10012
|
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
height: var(--menu-item-right-icon-size);
|
|
9859
|
-
width: var(--menu-item-right-icon-size);
|
|
9860
|
-
flex: 0 0 var(--menu-item-right-icon-size);
|
|
9861
|
-
}
|
|
10013
|
+
&[data-wui-data-card-skeleton='true'] {
|
|
10014
|
+
width: min(90%, 156px);
|
|
9862
10015
|
}
|
|
9863
10016
|
`;
|
|
9864
|
-
const
|
|
9865
|
-
display: flex;
|
|
9866
|
-
flex-direction: column;
|
|
9867
|
-
gap: var(--menu-label-description-gap);
|
|
9868
|
-
flex-basis: 100%;
|
|
9869
|
-
`;
|
|
9870
|
-
const StyledBadgeContainer = styled.div`
|
|
9871
|
-
align-self: start;
|
|
9872
|
-
justify-self: end;
|
|
9873
|
-
font-size: var(--wui-typography-label-4-size);
|
|
9874
|
-
color: var(--wui-color-text-secondary);
|
|
9875
|
-
`;
|
|
9876
|
-
const MenuItemButton = forwardRef(({ children, appearance, command, icon, ...props }, ref) => {
|
|
9877
|
-
let { colorScheme, badge } = props;
|
|
9878
|
-
if (appearance === "dangerous") {
|
|
9879
|
-
if (isNotUndefined(colorScheme)) console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
9880
|
-
colorScheme = "error";
|
|
9881
|
-
}
|
|
9882
|
-
if (appearance === "gated") badge = /* @__PURE__ */ jsx(Icon, {
|
|
9883
|
-
colorScheme: "purple",
|
|
9884
|
-
style: {
|
|
9885
|
-
height: "16px",
|
|
9886
|
-
width: "16px"
|
|
9887
|
-
},
|
|
9888
|
-
type: "sparkle"
|
|
9889
|
-
});
|
|
9890
|
-
return /* @__PURE__ */ jsxs(StyledButton, {
|
|
9891
|
-
...props,
|
|
9892
|
-
ref,
|
|
9893
|
-
$isGated: appearance === "gated",
|
|
9894
|
-
colorScheme: colorScheme ?? "inherit",
|
|
9895
|
-
fullWidth: true,
|
|
9896
|
-
unstyled: true,
|
|
9897
|
-
children: [
|
|
9898
|
-
isNotNil(props.leftIcon) ? /* @__PURE__ */ jsx(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
9899
|
-
/* @__PURE__ */ jsx(StyledLabelAndDescriptionContainer, { children }),
|
|
9900
|
-
isNotNil(badge) || isNotNil(command) ? /* @__PURE__ */ jsx(StyledBadgeContainer, { children: badge ?? command }) : null,
|
|
9901
|
-
isNotNil(props.rightIcon) ? /* @__PURE__ */ jsx(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
9902
|
-
]
|
|
9903
|
-
});
|
|
9904
|
-
});
|
|
9905
|
-
MenuItemButton.displayName = "MenuItemButton_UI";
|
|
9906
|
-
//#endregion
|
|
9907
|
-
//#region src/components/Menu/MenuItemLabel.tsx
|
|
9908
|
-
const StyledMenuItemLabel = styled.span`
|
|
9909
|
-
/* avoid no-empty-source rule */
|
|
9910
|
-
`;
|
|
9911
|
-
const MenuItemLabel = ({ children }) => {
|
|
9912
|
-
return /* @__PURE__ */ jsx(StyledMenuItemLabel, { children });
|
|
9913
|
-
};
|
|
9914
|
-
//#endregion
|
|
9915
|
-
//#region src/components/Menu/MenuItemDescription.tsx
|
|
9916
|
-
const StyledMenuItemDescription = styled(Text)`
|
|
9917
|
-
/* avoid no-empty-source rule */
|
|
9918
|
-
`;
|
|
9919
|
-
const MenuItemDescription = ({ children }) => {
|
|
9920
|
-
return /* @__PURE__ */ jsx(StyledMenuItemDescription, {
|
|
9921
|
-
prominence: "secondary",
|
|
9922
|
-
variant: "body4",
|
|
9923
|
-
children
|
|
9924
|
-
});
|
|
9925
|
-
};
|
|
9926
|
-
//#endregion
|
|
9927
|
-
//#region src/components/Menu/SubMenu.tsx
|
|
9928
|
-
const SubMenuContent = styled(DropdownMenuSubContent)`
|
|
9929
|
-
${menuContentCss}
|
|
9930
|
-
|
|
9931
|
-
${mq.smAndDown} {
|
|
9932
|
-
transform: translateX(-100%) !important;
|
|
9933
|
-
}
|
|
9934
|
-
`;
|
|
9935
|
-
const StyledMobileSubMenuItems = styled.div`
|
|
9936
|
-
margin-left: var(--wui-space-04);
|
|
9937
|
-
`;
|
|
9938
|
-
const StyledSubTrigger = styled(DropdownMenuSubTrigger)`
|
|
9939
|
-
outline: none;
|
|
9940
|
-
|
|
9941
|
-
&[data-state='open'],
|
|
9942
|
-
&[data-highlighted] {
|
|
9943
|
-
background-color: var(--wui-color-bg-surface-hover);
|
|
9944
|
-
}
|
|
9945
|
-
`;
|
|
9946
|
-
const SubMenuTrigger = ({ icon, ...props }) => {
|
|
9947
|
-
const { isSmAndUp } = useMq();
|
|
9948
|
-
return /* @__PURE__ */ jsx(isSmAndUp ? StyledSubTrigger : DropdownMenuItem, {
|
|
9949
|
-
asChild: true,
|
|
9950
|
-
children: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
9951
|
-
...props,
|
|
9952
|
-
leftIcon: icon,
|
|
9953
|
-
rightIcon: /* @__PURE__ */ jsx(Icon, { type: "caret-right" })
|
|
9954
|
-
})
|
|
9955
|
-
});
|
|
9956
|
-
};
|
|
9957
|
-
const SubMenu = ({ label, description, children, onOpenChange = () => null, ...props }) => {
|
|
9958
|
-
const { isSmAndUp } = useMq();
|
|
9959
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
9960
|
-
const { compact } = useMenuContext();
|
|
9961
|
-
return isSmAndUp ? /* @__PURE__ */ jsxs(DropdownMenuSub, {
|
|
9962
|
-
onOpenChange,
|
|
9963
|
-
children: [/* @__PURE__ */ jsxs(SubMenuTrigger, {
|
|
9964
|
-
...props,
|
|
9965
|
-
children: [/* @__PURE__ */ jsx(MenuItemLabel, { children: label }), isNotNil(description) ? /* @__PURE__ */ jsx(MenuItemDescription, { children: description }) : null]
|
|
9966
|
-
}), /* @__PURE__ */ jsx(DropdownMenuPortal, { children: /* @__PURE__ */ jsx(SubMenuContent, {
|
|
9967
|
-
$compact: compact,
|
|
9968
|
-
children
|
|
9969
|
-
}) })]
|
|
9970
|
-
}) : /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [/* @__PURE__ */ jsxs(SubMenuTrigger, {
|
|
9971
|
-
...props,
|
|
9972
|
-
onClick: (event) => {
|
|
9973
|
-
event.preventDefault();
|
|
9974
|
-
setIsExpanded((prev) => !prev);
|
|
9975
|
-
},
|
|
9976
|
-
children: [/* @__PURE__ */ jsx(MenuItemLabel, { children: label }), /* @__PURE__ */ jsx(MenuItemDescription, { children: description })]
|
|
9977
|
-
}), /* @__PURE__ */ jsx(StyledMobileSubMenuItems, { children: isExpanded ? children : null })] });
|
|
9978
|
-
};
|
|
9979
|
-
SubMenu.displayName = "SubMenu_UI";
|
|
9980
|
-
//#endregion
|
|
9981
|
-
//#region src/components/Menu/MenuItem.tsx
|
|
9982
|
-
const MenuItem = forwardRef(({ onSelect = () => null, ...props }, ref) => {
|
|
9983
|
-
return /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
9984
|
-
asChild: true,
|
|
9985
|
-
onSelect,
|
|
9986
|
-
children: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
9987
|
-
...props,
|
|
9988
|
-
ref,
|
|
9989
|
-
leftIcon: props.icon
|
|
9990
|
-
})
|
|
9991
|
-
});
|
|
9992
|
-
});
|
|
9993
|
-
MenuItem.displayName = "MenuItem_UI";
|
|
9994
|
-
//#endregion
|
|
9995
|
-
//#region src/components/Menu/MenuRadioGroup.tsx
|
|
9996
|
-
const MenuRadioGroup = ({ children, ...props }) => {
|
|
9997
|
-
return /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
|
|
9998
|
-
...props,
|
|
9999
|
-
children
|
|
10000
|
-
});
|
|
10001
|
-
};
|
|
10002
|
-
MenuRadioGroup.displayName = "MenuRadioGroup_UI";
|
|
10003
|
-
//#endregion
|
|
10004
|
-
//#region src/components/Menu/RadioMenuItem.tsx
|
|
10005
|
-
const RadioMenuItem = ({ onSelect, value, indicator = /* @__PURE__ */ jsx(Icon, {
|
|
10006
|
-
size: "sm",
|
|
10007
|
-
type: "checkmark"
|
|
10008
|
-
}), ...props }) => {
|
|
10009
|
-
return /* @__PURE__ */ jsx(DropdownMenuRadioItem, {
|
|
10010
|
-
...onSelect ? { onSelect } : {},
|
|
10011
|
-
asChild: true,
|
|
10012
|
-
value,
|
|
10013
|
-
children: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
10014
|
-
...props,
|
|
10015
|
-
rightIcon: /* @__PURE__ */ jsx(DropdownMenuItemIndicator, { children: indicator })
|
|
10016
|
-
})
|
|
10017
|
-
});
|
|
10018
|
-
};
|
|
10019
|
-
RadioMenuItem.displayName = "RadioMenuItem_UI";
|
|
10020
|
-
//#endregion
|
|
10021
|
-
//#region src/components/Menu/CheckboxMenuItem.tsx
|
|
10022
|
-
const CheckboxIndicator = ({ checked, ...props }) => {
|
|
10023
|
-
return checked ? /* @__PURE__ */ jsxs("svg", {
|
|
10024
|
-
...props,
|
|
10025
|
-
fill: "none",
|
|
10026
|
-
height: "24",
|
|
10027
|
-
viewBox: "0 0 24 24",
|
|
10028
|
-
width: "24",
|
|
10029
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10030
|
-
children: [/* @__PURE__ */ jsx("path", {
|
|
10031
|
-
d: "m4 8c0-2.20914 1.79086-4 4-4h8c2.2091 0 4 1.79086 4 4v8c0 2.2091-1.7909 4-4 4h-8c-2.20914 0-4-1.7909-4-4z",
|
|
10032
|
-
fill: "#2949e5"
|
|
10033
|
-
}), /* @__PURE__ */ jsx("path", {
|
|
10034
|
-
d: "m10.4728 15.1931-3.09523-3.1131c-.18596-.187-.18596-.4902 0-.6773l.67341-.6773c.18596-.187.48749-.187.67344 0l2.08508 2.0971 4.4661-4.49174c.1859-.18703.4875-.18703.6734 0l.6734.67731c.186.18703.186.49027 0 .67731l-5.4762 5.50772c-.1859.187-.4874.187-.6734 0z",
|
|
10035
|
-
fill: "#fff"
|
|
10036
|
-
})]
|
|
10037
|
-
}) : /* @__PURE__ */ jsxs("svg", {
|
|
10038
|
-
...props,
|
|
10039
|
-
fill: "none",
|
|
10040
|
-
height: "24",
|
|
10041
|
-
viewBox: "0 0 24 24",
|
|
10042
|
-
width: "24",
|
|
10043
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10044
|
-
children: [/* @__PURE__ */ jsx("path", {
|
|
10045
|
-
d: "m8 4.5h8c1.933 0 3.5 1.567 3.5 3.5v8c0 1.933-1.567 3.5-3.5 3.5h-8c-1.933 0-3.5-1.567-3.5-3.5v-8c0-1.933 1.567-3.5 3.5-3.5z",
|
|
10046
|
-
fill: "#fcfcfd"
|
|
10047
|
-
}), /* @__PURE__ */ jsx("path", {
|
|
10048
|
-
d: "m8 4.5h8c1.933 0 3.5 1.567 3.5 3.5v8c0 1.933-1.567 3.5-3.5 3.5h-8c-1.933 0-3.5-1.567-3.5-3.5v-8c0-1.933 1.567-3.5 3.5-3.5z",
|
|
10049
|
-
stroke: "#bbbbc4"
|
|
10050
|
-
})]
|
|
10051
|
-
});
|
|
10052
|
-
};
|
|
10053
|
-
const CheckboxMenuItem = ({ onSelect = () => null, checked, onCheckedChange, ...props }) => {
|
|
10054
|
-
return /* @__PURE__ */ jsx(DropdownMenuCheckboxItem, {
|
|
10055
|
-
asChild: true,
|
|
10056
|
-
checked,
|
|
10057
|
-
onCheckedChange,
|
|
10058
|
-
onSelect,
|
|
10059
|
-
children: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
10060
|
-
...props,
|
|
10061
|
-
leftIcon: isNotNil(props.icon) ? props.icon : /* @__PURE__ */ jsx(CheckboxIndicator, { checked }),
|
|
10062
|
-
rightIcon: isNotNil(props.icon) ? /* @__PURE__ */ jsx(DropdownMenuItemIndicator, { children: /* @__PURE__ */ jsx(Icon, { type: "checkmark" }) }) : void 0
|
|
10063
|
-
})
|
|
10064
|
-
});
|
|
10065
|
-
};
|
|
10066
|
-
CheckboxMenuItem.displayName = "CheckboxMenuItem_UI";
|
|
10067
|
-
//#endregion
|
|
10068
|
-
//#region src/components/Menu/FilterMenu.tsx
|
|
10069
|
-
const FilterMenuItem = CheckboxMenuItem;
|
|
10070
|
-
const FilterMenu = forwardRef(({ value, onChange, searchValue, onSearchValueChange, children, ...props }, ref) => {
|
|
10071
|
-
return /* @__PURE__ */ jsxs(Menu, {
|
|
10072
|
-
...props,
|
|
10073
|
-
ref,
|
|
10074
|
-
children: [
|
|
10075
|
-
/* @__PURE__ */ jsx(Card, {
|
|
10076
|
-
alignItems: "flex-end",
|
|
10077
|
-
border: false,
|
|
10078
|
-
borderRadius: "border-radius-02",
|
|
10079
|
-
paddingSize: "space-01",
|
|
10080
|
-
prominence: "primary",
|
|
10081
|
-
style: {
|
|
10082
|
-
position: "absolute",
|
|
10083
|
-
top: 0,
|
|
10084
|
-
left: 0,
|
|
10085
|
-
right: 0,
|
|
10086
|
-
margin: "1px"
|
|
10087
|
-
},
|
|
10088
|
-
children: /* @__PURE__ */ jsx(Input, {
|
|
10089
|
-
autoFocus: true,
|
|
10090
|
-
onChange: (event) => {
|
|
10091
|
-
onSearchValueChange(event.target.value);
|
|
10092
|
-
},
|
|
10093
|
-
onKeyDown: (event) => {
|
|
10094
|
-
if (event.key === "ArrowDown") {
|
|
10095
|
-
event.preventDefault();
|
|
10096
|
-
const firstMenuItem = document.querySelector("[role=\"menu\"]")?.querySelector("[role=\"menuitemcheckbox\"]");
|
|
10097
|
-
if (firstMenuItem) firstMenuItem.focus();
|
|
10098
|
-
}
|
|
10099
|
-
event.stopPropagation();
|
|
10100
|
-
},
|
|
10101
|
-
placeholder: "Search...",
|
|
10102
|
-
tabIndex: 0,
|
|
10103
|
-
type: "search",
|
|
10104
|
-
value: searchValue
|
|
10105
|
-
})
|
|
10106
|
-
}),
|
|
10107
|
-
/* @__PURE__ */ jsx(MenuItem, {
|
|
10108
|
-
disabled: true,
|
|
10109
|
-
style: { padding: "16px" },
|
|
10110
|
-
children: " "
|
|
10111
|
-
}),
|
|
10112
|
-
Children.toArray(children).length > 0 ? children : /* @__PURE__ */ jsx(MenuItem, {
|
|
10113
|
-
disabled: true,
|
|
10114
|
-
children: "No results found"
|
|
10115
|
-
}),
|
|
10116
|
-
value.length > 0 && /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
10117
|
-
disabled: true,
|
|
10118
|
-
style: { marginTop: "24px" },
|
|
10119
|
-
children: /* @__PURE__ */ jsx(Card, {
|
|
10120
|
-
alignItems: "flex-end",
|
|
10121
|
-
border: false,
|
|
10122
|
-
borderRadius: "border-radius-02",
|
|
10123
|
-
paddingSize: "space-01",
|
|
10124
|
-
prominence: "primary",
|
|
10125
|
-
style: {
|
|
10126
|
-
position: "absolute",
|
|
10127
|
-
bottom: 0,
|
|
10128
|
-
left: 0,
|
|
10129
|
-
right: 0,
|
|
10130
|
-
margin: "1px"
|
|
10131
|
-
},
|
|
10132
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
10133
|
-
onClick: () => onChange([]),
|
|
10134
|
-
size: "sm",
|
|
10135
|
-
children: "Clear"
|
|
10136
|
-
})
|
|
10137
|
-
})
|
|
10138
|
-
})
|
|
10139
|
-
]
|
|
10140
|
-
});
|
|
10141
|
-
});
|
|
10142
|
-
FilterMenu.displayName = "FilterMenu_UI";
|
|
10143
|
-
//#endregion
|
|
10144
|
-
//#region src/components/ContextMenu/ContextMenu.tsx
|
|
10145
|
-
/**
|
|
10146
|
-
* The ContextMenu is an extended implementation of the [Menu]() component that allows for right-click context menus.
|
|
10147
|
-
* It can be used in two ways:
|
|
10148
|
-
* 1. By providing a `triggerRef`, which will render the menu when the referenced element is right-clicked.
|
|
10149
|
-
* 2. By providing a `position` prop, which will render the menu at the specified coordinates.
|
|
10150
|
-
*/
|
|
10151
|
-
const ContextMenu = ({ position, triggerRef, children, side = "bottom", onRequestClose = () => null, compact = false }) => {
|
|
10152
|
-
const [isRightClicked, setIsRightClicked] = useState(false);
|
|
10153
|
-
const [menuPosition, setMenuPosition] = useState(position ?? {
|
|
10154
|
-
x: 0,
|
|
10155
|
-
y: 0
|
|
10156
|
-
});
|
|
10157
|
-
useEffect(() => {
|
|
10158
|
-
if (isNil(position)) {
|
|
10159
|
-
const onContextMenu = (event) => {
|
|
10160
|
-
event.preventDefault();
|
|
10161
|
-
setMenuPosition({
|
|
10162
|
-
x: event.clientX,
|
|
10163
|
-
y: event.clientY
|
|
10164
|
-
});
|
|
10165
|
-
setIsRightClicked(true);
|
|
10166
|
-
};
|
|
10167
|
-
const triggerEl = triggerRef?.current;
|
|
10168
|
-
triggerEl?.addEventListener("contextmenu", onContextMenu);
|
|
10169
|
-
return () => {
|
|
10170
|
-
triggerEl?.removeEventListener("contextmenu", onContextMenu);
|
|
10171
|
-
};
|
|
10172
|
-
}
|
|
10173
|
-
return () => null;
|
|
10174
|
-
}, [position, triggerRef]);
|
|
10175
|
-
const isOpen = isNotNil(position) || isRightClicked;
|
|
10176
|
-
if (!isOpen) return null;
|
|
10177
|
-
const menu = /* @__PURE__ */ jsx(Menu, {
|
|
10178
|
-
compact,
|
|
10179
|
-
isOpen,
|
|
10180
|
-
onOpenChange: (next) => {
|
|
10181
|
-
setIsRightClicked(next);
|
|
10182
|
-
if (!next) onRequestClose();
|
|
10183
|
-
},
|
|
10184
|
-
side,
|
|
10185
|
-
trigger: /* @__PURE__ */ jsx("button", {
|
|
10186
|
-
"aria-label": "context menu",
|
|
10187
|
-
style: {
|
|
10188
|
-
width: "1px",
|
|
10189
|
-
height: "1px",
|
|
10190
|
-
all: "unset",
|
|
10191
|
-
position: "fixed",
|
|
10192
|
-
top: menuPosition.y,
|
|
10193
|
-
left: menuPosition.x
|
|
10194
|
-
},
|
|
10195
|
-
type: "button"
|
|
10196
|
-
}),
|
|
10197
|
-
children
|
|
10198
|
-
});
|
|
10199
|
-
if (isNotNil(triggerRef)) return createPortal(menu, document.body);
|
|
10200
|
-
return menu;
|
|
10201
|
-
};
|
|
10202
|
-
//#endregion
|
|
10203
|
-
//#region src/components/CustomizableThemeWrapper/CustomizableThemeWrapper.tsx
|
|
10204
|
-
const StyledCustomizableThemeWrapper = styled.div((props) => props.$overrides);
|
|
10205
|
-
/**
|
|
10206
|
-
* Used for overriding the default theme tokens with custom values.
|
|
10207
|
-
* This should only be used when the ui systems team has been consulted first.
|
|
10208
|
-
*/
|
|
10209
|
-
const CustomizableThemeWrapper = ({ children, overrides, ...props }) => /* @__PURE__ */ jsx(StyledCustomizableThemeWrapper, {
|
|
10210
|
-
...props,
|
|
10211
|
-
$overrides: overrides,
|
|
10212
|
-
"data-wui-theme": "true",
|
|
10213
|
-
children
|
|
10214
|
-
});
|
|
10215
|
-
CustomizableThemeWrapper.displayName = "CustomizableThemeWrapper_UI";
|
|
10216
|
-
//#endregion
|
|
10217
|
-
//#region src/components/DataCards/DataCard.tsx
|
|
10218
|
-
const pulse = keyframes`
|
|
10219
|
-
0%,
|
|
10220
|
-
100% {
|
|
10221
|
-
opacity: 1;
|
|
10222
|
-
}
|
|
10223
|
-
50% {
|
|
10224
|
-
opacity: 0.5;
|
|
10225
|
-
}
|
|
10226
|
-
`;
|
|
10227
|
-
const StyledDataCard = styled.div`
|
|
10228
|
-
--wui-data-card-text: var(--wui-color-text-button);
|
|
10229
|
-
--wui-color-text: var(--wui-data-card-text);
|
|
10230
|
-
--wui-data-card-background: var(--wui-color-bg-surface-secondary);
|
|
10231
|
-
--wui-data-card-background-hover: var(--wui-color-bg-surface-secondary-hover);
|
|
10232
|
-
--wui-data-card-background-active: var(--wui-color-bg-surface-secondary-active);
|
|
10233
|
-
--wui-data-card-skeleton-color: var(--wui-color-bg-surface-tertiary);
|
|
10234
|
-
|
|
10235
|
-
display: grid;
|
|
10236
|
-
grid-template-areas: 'label slot' 'value value';
|
|
10237
|
-
grid-template-rows: auto auto;
|
|
10238
|
-
grid-template-columns: auto auto;
|
|
10239
|
-
gap: var(--wui-space-01);
|
|
10240
|
-
padding: var(--wui-space-03);
|
|
10241
|
-
background: var(--wui-data-card-background);
|
|
10242
|
-
flex: 1;
|
|
10243
|
-
border-radius: var(--wui-border-radius-02);
|
|
10244
|
-
position: relative;
|
|
10245
|
-
transition:
|
|
10246
|
-
background var(--wui-motion-duration-01) var(--wui-motion-ease),
|
|
10247
|
-
box-shadow var(--wui-motion-duration-01) var(--wui-motion-ease),
|
|
10248
|
-
color var(--wui-motion-duration-01) var(--wui-motion-ease);
|
|
10249
|
-
|
|
10250
|
-
[data-wui-data-card-hover-icon] {
|
|
10251
|
-
opacity: 0;
|
|
10252
|
-
transform: translateX(-16px);
|
|
10253
|
-
transition: all var(--wui-motion-duration-02) var(--wui-motion-ease-out);
|
|
10254
|
-
}
|
|
10255
|
-
|
|
10256
|
-
&:has([data-wui-data-card-subtitle]) {
|
|
10257
|
-
grid-template-areas: 'label slot' 'value value' 'subtitle subtitle';
|
|
10258
|
-
grid-template-rows: auto auto auto;
|
|
10259
|
-
}
|
|
10260
|
-
|
|
10261
|
-
[data-wui-data-card-skeleton='true'] {
|
|
10262
|
-
pointer-events: none;
|
|
10263
|
-
background-color: var(--wui-data-card-skeleton-color);
|
|
10264
|
-
animation: ${pulse} 1.5s var(--wui-motion-ease-in-out) 0.5s infinite;
|
|
10265
|
-
color: transparent;
|
|
10266
|
-
user-select: none;
|
|
10267
|
-
border-radius: var(--wui-border-radius-01);
|
|
10268
|
-
width: fit-content;
|
|
10269
|
-
}
|
|
10270
|
-
|
|
10271
|
-
&[data-click-region] {
|
|
10272
|
-
&:not([disabled]) {
|
|
10273
|
-
cursor: pointer;
|
|
10274
|
-
|
|
10275
|
-
&:hover {
|
|
10276
|
-
--wui-data-card-text: var(--wui-color-text-button);
|
|
10277
|
-
--wui-data-card-background: var(--wui-color-bg-surface-secondary-hover);
|
|
10278
|
-
|
|
10279
|
-
[data-wui-data-card-hover-icon] {
|
|
10280
|
-
opacity: 1;
|
|
10281
|
-
transform: translateX(0);
|
|
10282
|
-
}
|
|
10283
|
-
}
|
|
10284
|
-
|
|
10285
|
-
&:active {
|
|
10286
|
-
--wui-data-card-background: var(--wui-color-bg-surface-secondary-active);
|
|
10287
|
-
}
|
|
10288
|
-
|
|
10289
|
-
&:has([data-click-region-target-button]:focus-visible),
|
|
10290
|
-
&:has([data-click-region-target-link]:focus-visible) {
|
|
10291
|
-
--wui-data-card-focus-ring: var(--wui-color-border);
|
|
10292
|
-
|
|
10293
|
-
box-shadow: inset 0 0 0 2px var(--wui-data-card-focus-ring);
|
|
10294
|
-
}
|
|
10295
|
-
|
|
10296
|
-
&:has([data-click-region-target-button][aria-pressed='true']) {
|
|
10297
|
-
--wui-data-card-text: var(--wui-color-text-selected);
|
|
10298
|
-
--wui-data-card-background: var(--wui-color-bg-surface-selected);
|
|
10299
|
-
--wui-data-card-background-hover: var(--wui-color-bg-surface-selected-hover);
|
|
10300
|
-
--wui-data-card-background-active: var(--wui-color-bg-surface-selected-active);
|
|
10301
|
-
--wui-data-card-focus-ring: var(--wui-color-border-selected);
|
|
10302
|
-
--wui-data-card-skeleton-color: var(--wui-color-bg-surface-selected-active);
|
|
10303
|
-
}
|
|
10304
|
-
}
|
|
10305
|
-
|
|
10306
|
-
&[disabled] {
|
|
10307
|
-
pointer-events: none;
|
|
10308
|
-
}
|
|
10309
|
-
|
|
10310
|
-
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
10311
|
-
}
|
|
10312
|
-
`;
|
|
10313
|
-
const StyledLabel$1 = styled(Heading)`
|
|
10314
|
-
grid-area: label;
|
|
10315
|
-
|
|
10316
|
-
&[data-wui-data-card-skeleton='true'] {
|
|
10317
|
-
width: 80px;
|
|
10318
|
-
}
|
|
10319
|
-
|
|
10320
|
-
button {
|
|
10321
|
-
text-align: left;
|
|
10322
|
-
}
|
|
10323
|
-
`;
|
|
10324
|
-
const StyledValue = styled(Heading)`
|
|
10325
|
-
grid-area: value;
|
|
10326
|
-
|
|
10327
|
-
&[data-wui-data-card-skeleton='true'] {
|
|
10328
|
-
width: min(90%, 156px);
|
|
10329
|
-
}
|
|
10330
|
-
`;
|
|
10331
|
-
const StyledSlot = styled.div`
|
|
10017
|
+
const StyledSlot = styled.div`
|
|
10332
10018
|
display: flex;
|
|
10333
10019
|
justify-content: flex-end;
|
|
10334
10020
|
grid-area: slot;
|
|
@@ -11634,21 +11320,21 @@ const previewCardClose = keyframes`
|
|
|
11634
11320
|
transform: scale(0.96);
|
|
11635
11321
|
}
|
|
11636
11322
|
`;
|
|
11637
|
-
const
|
|
11323
|
+
const StyledPopup$3 = styled(PreviewCard$1.Popup)`
|
|
11638
11324
|
--preview-card-animation-duration: var(--wui-motion-duration-03);
|
|
11639
11325
|
--preview-card-animation-ease: var(--wui-motion-ease-out);
|
|
11640
11326
|
|
|
11641
11327
|
z-index: var(--wui-zindex-popover);
|
|
11642
|
-
transform-origin: var(--
|
|
11328
|
+
transform-origin: var(--transform-origin);
|
|
11643
11329
|
animation-duration: var(--preview-card-animation-duration);
|
|
11644
11330
|
animation-timing-function: var(--preview-card-animation-ease);
|
|
11645
11331
|
will-change: transform, opacity;
|
|
11646
11332
|
|
|
11647
|
-
&[data-
|
|
11333
|
+
&[data-open] {
|
|
11648
11334
|
animation-name: ${previewCardOpen};
|
|
11649
11335
|
}
|
|
11650
11336
|
|
|
11651
|
-
&[data-
|
|
11337
|
+
&[data-closed] {
|
|
11652
11338
|
animation-name: ${previewCardClose};
|
|
11653
11339
|
}
|
|
11654
11340
|
|
|
@@ -11667,28 +11353,31 @@ const StyledContent$2 = styled(Content$3)`
|
|
|
11667
11353
|
/**
|
|
11668
11354
|
* 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.
|
|
11669
11355
|
*/
|
|
11670
|
-
const PreviewCard = ({ children, trigger, maxWidth = "320px", maxHeight = "auto", unstyled = false, paddingSize = "space-04", openDelay = 700, closeDelay = 300, colorScheme = "inherit", forceOpen, ...props }) => {
|
|
11356
|
+
const PreviewCard = ({ children, trigger, maxWidth = "320px", maxHeight = "auto", unstyled = false, paddingSize = "space-04", openDelay = 700, closeDelay = 300, colorScheme = "inherit", forceOpen, side, align, ...props }) => {
|
|
11671
11357
|
const style = {
|
|
11672
11358
|
"--wui-preview-card-max-width": maxWidth,
|
|
11673
11359
|
"--wui-preview-card-max-height": maxHeight
|
|
11674
11360
|
};
|
|
11675
11361
|
const rootProps = {};
|
|
11676
11362
|
if (forceOpen === true) rootProps.open = true;
|
|
11677
|
-
return /* @__PURE__ */ jsxs(Root
|
|
11678
|
-
closeDelay,
|
|
11679
|
-
openDelay,
|
|
11363
|
+
return /* @__PURE__ */ jsxs(PreviewCard$1.Root, {
|
|
11680
11364
|
...rootProps,
|
|
11681
|
-
children: [/* @__PURE__ */ jsx(Trigger
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11365
|
+
children: [/* @__PURE__ */ jsx(PreviewCard$1.Trigger, {
|
|
11366
|
+
closeDelay,
|
|
11367
|
+
delay: openDelay,
|
|
11368
|
+
render: trigger
|
|
11369
|
+
}), /* @__PURE__ */ jsx(PreviewCard$1.Portal, { children: /* @__PURE__ */ jsx(PreviewCard$1.Positioner, {
|
|
11370
|
+
align,
|
|
11371
|
+
side,
|
|
11687
11372
|
sideOffset: 8,
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11373
|
+
children: /* @__PURE__ */ jsx(StyledPopup$3, {
|
|
11374
|
+
$colorScheme: colorScheme,
|
|
11375
|
+
$paddingSize: paddingSize,
|
|
11376
|
+
...props,
|
|
11377
|
+
$unstyled: unstyled,
|
|
11378
|
+
style,
|
|
11379
|
+
children: /* @__PURE__ */ jsx("div", { children })
|
|
11380
|
+
})
|
|
11692
11381
|
}) })]
|
|
11693
11382
|
});
|
|
11694
11383
|
};
|
|
@@ -11881,7 +11570,7 @@ const StyledKey = styled.kbd`
|
|
|
11881
11570
|
min-width: 20px;
|
|
11882
11571
|
padding: 0 var(--wui-space-01);
|
|
11883
11572
|
`;
|
|
11884
|
-
const Label$
|
|
11573
|
+
const Label$1 = styled.span`
|
|
11885
11574
|
color: var(--wui-color-text);
|
|
11886
11575
|
font-size: 12px;
|
|
11887
11576
|
`;
|
|
@@ -11917,7 +11606,7 @@ const keyToString = (key) => {
|
|
|
11917
11606
|
const KeyboardShortcut = ({ label, keyboardKeys, fullWidth = false, ...otherProps }) => /* @__PURE__ */ jsxs(StyledKeyboardShortcut, {
|
|
11918
11607
|
$fullWidth: fullWidth,
|
|
11919
11608
|
...otherProps,
|
|
11920
|
-
children: [isNotNil(label) && /* @__PURE__ */ jsx(Label$
|
|
11609
|
+
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)) })]
|
|
11921
11610
|
});
|
|
11922
11611
|
KeyboardShortcut.displayName = "KeyboardShortcut_UI";
|
|
11923
11612
|
//#endregion
|
|
@@ -12190,21 +11879,382 @@ const baseMarkdownCss = (textSize = "body2") => css`
|
|
|
12190
11879
|
}
|
|
12191
11880
|
`;
|
|
12192
11881
|
//#endregion
|
|
12193
|
-
//#region src/components/Markdown/Markdown.tsx
|
|
12194
|
-
const StyledMarkdownWrapper = styled.div`
|
|
12195
|
-
${({ $textSize }) => baseMarkdownCss($textSize)}
|
|
12196
|
-
`;
|
|
12197
|
-
/**
|
|
12198
|
-
* This is a simple wrapper around `react-markdown` that applies some basic styles.
|
|
12199
|
-
*/
|
|
12200
|
-
const Markdown = ({ children, textSize = "body2", ...otherProps }) => {
|
|
12201
|
-
return /* @__PURE__ */ jsx(StyledMarkdownWrapper, {
|
|
12202
|
-
$textSize: useResponsiveProp(textSize),
|
|
12203
|
-
...otherProps,
|
|
12204
|
-
children: /* @__PURE__ */ jsx(ReactMarkdown, { children })
|
|
11882
|
+
//#region src/components/Markdown/Markdown.tsx
|
|
11883
|
+
const StyledMarkdownWrapper = styled.div`
|
|
11884
|
+
${({ $textSize }) => baseMarkdownCss($textSize)}
|
|
11885
|
+
`;
|
|
11886
|
+
/**
|
|
11887
|
+
* This is a simple wrapper around `react-markdown` that applies some basic styles.
|
|
11888
|
+
*/
|
|
11889
|
+
const Markdown = ({ children, textSize = "body2", ...otherProps }) => {
|
|
11890
|
+
return /* @__PURE__ */ jsx(StyledMarkdownWrapper, {
|
|
11891
|
+
$textSize: useResponsiveProp(textSize),
|
|
11892
|
+
...otherProps,
|
|
11893
|
+
children: /* @__PURE__ */ jsx(ReactMarkdown, { children })
|
|
11894
|
+
});
|
|
11895
|
+
};
|
|
11896
|
+
Markdown.displayName = "Markdown_UI";
|
|
11897
|
+
//#endregion
|
|
11898
|
+
//#region src/components/Menu/MenuLabel.tsx
|
|
11899
|
+
const StyledMenuLabel = styled.div`
|
|
11900
|
+
padding: var(--wui-space-02);
|
|
11901
|
+
`;
|
|
11902
|
+
const MenuLabel = ({ children, ...props }) => {
|
|
11903
|
+
return /* @__PURE__ */ jsx(StyledMenuLabel, {
|
|
11904
|
+
role: "group",
|
|
11905
|
+
...props,
|
|
11906
|
+
children: /* @__PURE__ */ jsx(Heading, {
|
|
11907
|
+
renderAs: "span",
|
|
11908
|
+
variant: "heading6",
|
|
11909
|
+
children
|
|
11910
|
+
})
|
|
11911
|
+
});
|
|
11912
|
+
};
|
|
11913
|
+
MenuLabel.displayName = "MenuLabel_UI";
|
|
11914
|
+
//#endregion
|
|
11915
|
+
//#region src/components/Menu/MenuItemButton.tsx
|
|
11916
|
+
const StyledButton = styled(Button)`
|
|
11917
|
+
${({ colorScheme }) => getColorScheme(colorScheme)};
|
|
11918
|
+
|
|
11919
|
+
display: flex;
|
|
11920
|
+
flex-direction: row;
|
|
11921
|
+
gap: var(--menu-item-inner-gap);
|
|
11922
|
+
padding: var(--menu-item-padding);
|
|
11923
|
+
border-radius: var(--wui-border-radius-01);
|
|
11924
|
+
text-align: left;
|
|
11925
|
+
color: var(--wui-color-text-button);
|
|
11926
|
+
font-size: var(--menu-label-font-size);
|
|
11927
|
+
font-weight: var(--menu-label-font-weight);
|
|
11928
|
+
line-height: var(--menu-label-line-height);
|
|
11929
|
+
transition: background-color var(--wui-motion-duration-01) var(--wui-motion-ease);
|
|
11930
|
+
|
|
11931
|
+
&:active {
|
|
11932
|
+
background-color: var(--wui-color-bg-surface-active);
|
|
11933
|
+
}
|
|
11934
|
+
|
|
11935
|
+
&[data-highlighted] {
|
|
11936
|
+
outline: none;
|
|
11937
|
+
${({ $isGated }) => $isGated && getColorScheme("purple")};
|
|
11938
|
+
background-color: var(--wui-color-bg-surface-hover);
|
|
11939
|
+
}
|
|
11940
|
+
|
|
11941
|
+
&[aria-disabled='true'] {
|
|
11942
|
+
--wui-color-text-button: var(--wui-color-text-disabled);
|
|
11943
|
+
--wui-color-text-secondary: var(--wui-color-text-disabled);
|
|
11944
|
+
--wui-color-icon: var(--wui-color-icon-disabled);
|
|
11945
|
+
|
|
11946
|
+
&[data-highlighted] {
|
|
11947
|
+
background-color: transparent;
|
|
11948
|
+
}
|
|
11949
|
+
}
|
|
11950
|
+
`;
|
|
11951
|
+
const StyledLeftIconContainer = styled.div`
|
|
11952
|
+
height: var(--menu-item-left-icon-size);
|
|
11953
|
+
width: var(--menu-item-left-icon-size);
|
|
11954
|
+
|
|
11955
|
+
&& {
|
|
11956
|
+
svg {
|
|
11957
|
+
height: var(--menu-item-left-icon-size);
|
|
11958
|
+
width: var(--menu-item-left-icon-size);
|
|
11959
|
+
flex: 0 0 var(--menu-item-left-icon-size);
|
|
11960
|
+
}
|
|
11961
|
+
}
|
|
11962
|
+
`;
|
|
11963
|
+
const StyledRightIconContainer = styled.div`
|
|
11964
|
+
height: var(--menu-item-right-icon-size);
|
|
11965
|
+
width: var(--menu-item-right-icon-size);
|
|
11966
|
+
|
|
11967
|
+
&& {
|
|
11968
|
+
svg {
|
|
11969
|
+
height: var(--menu-item-right-icon-size);
|
|
11970
|
+
width: var(--menu-item-right-icon-size);
|
|
11971
|
+
flex: 0 0 var(--menu-item-right-icon-size);
|
|
11972
|
+
}
|
|
11973
|
+
}
|
|
11974
|
+
`;
|
|
11975
|
+
const StyledLabelAndDescriptionContainer = styled.div`
|
|
11976
|
+
display: flex;
|
|
11977
|
+
flex-direction: column;
|
|
11978
|
+
gap: var(--menu-label-description-gap);
|
|
11979
|
+
flex-basis: 100%;
|
|
11980
|
+
`;
|
|
11981
|
+
const StyledBadgeContainer = styled.div`
|
|
11982
|
+
align-self: start;
|
|
11983
|
+
justify-self: end;
|
|
11984
|
+
font-size: var(--wui-typography-label-4-size);
|
|
11985
|
+
color: var(--wui-color-text-secondary);
|
|
11986
|
+
`;
|
|
11987
|
+
const MenuItemButton = forwardRef(({ children, appearance, command, icon, ...props }, ref) => {
|
|
11988
|
+
let { colorScheme, badge } = props;
|
|
11989
|
+
if (appearance === "dangerous") {
|
|
11990
|
+
if (isNotUndefined(colorScheme)) console.warn("colorScheme prop is ignored when appearance is dangerous");
|
|
11991
|
+
colorScheme = "error";
|
|
11992
|
+
}
|
|
11993
|
+
if (appearance === "gated") badge = /* @__PURE__ */ jsx(Icon, {
|
|
11994
|
+
colorScheme: "purple",
|
|
11995
|
+
style: {
|
|
11996
|
+
height: "16px",
|
|
11997
|
+
width: "16px"
|
|
11998
|
+
},
|
|
11999
|
+
type: "sparkle"
|
|
12000
|
+
});
|
|
12001
|
+
return /* @__PURE__ */ jsxs(StyledButton, {
|
|
12002
|
+
...props,
|
|
12003
|
+
ref,
|
|
12004
|
+
$isGated: appearance === "gated",
|
|
12005
|
+
colorScheme: colorScheme ?? "inherit",
|
|
12006
|
+
fullWidth: true,
|
|
12007
|
+
unstyled: true,
|
|
12008
|
+
children: [
|
|
12009
|
+
isNotNil(props.leftIcon) ? /* @__PURE__ */ jsx(StyledLeftIconContainer, { children: props.leftIcon }) : null,
|
|
12010
|
+
/* @__PURE__ */ jsx(StyledLabelAndDescriptionContainer, { children }),
|
|
12011
|
+
isNotNil(badge) || isNotNil(command) ? /* @__PURE__ */ jsx(StyledBadgeContainer, { children: badge ?? command }) : null,
|
|
12012
|
+
isNotNil(props.rightIcon) ? /* @__PURE__ */ jsx(StyledRightIconContainer, { children: props.rightIcon }) : null
|
|
12013
|
+
]
|
|
12014
|
+
});
|
|
12015
|
+
});
|
|
12016
|
+
MenuItemButton.displayName = "MenuItemButton_UI";
|
|
12017
|
+
//#endregion
|
|
12018
|
+
//#region src/components/Menu/MenuItemLabel.tsx
|
|
12019
|
+
const StyledMenuItemLabel = styled.span`
|
|
12020
|
+
/* avoid no-empty-source rule */
|
|
12021
|
+
`;
|
|
12022
|
+
const MenuItemLabel = ({ children }) => {
|
|
12023
|
+
return /* @__PURE__ */ jsx(StyledMenuItemLabel, { children });
|
|
12024
|
+
};
|
|
12025
|
+
//#endregion
|
|
12026
|
+
//#region src/components/Menu/MenuItemDescription.tsx
|
|
12027
|
+
const StyledMenuItemDescription = styled(Text)`
|
|
12028
|
+
/* avoid no-empty-source rule */
|
|
12029
|
+
`;
|
|
12030
|
+
const MenuItemDescription = ({ children }) => {
|
|
12031
|
+
return /* @__PURE__ */ jsx(StyledMenuItemDescription, {
|
|
12032
|
+
prominence: "secondary",
|
|
12033
|
+
variant: "body4",
|
|
12034
|
+
children
|
|
12035
|
+
});
|
|
12036
|
+
};
|
|
12037
|
+
//#endregion
|
|
12038
|
+
//#region src/components/Menu/SubMenu.tsx
|
|
12039
|
+
const SubMenuPopup = styled(Menu$1.Popup)`
|
|
12040
|
+
${menuContentCss}
|
|
12041
|
+
|
|
12042
|
+
${mq.smAndDown} {
|
|
12043
|
+
transform: translateX(-100%) !important;
|
|
12044
|
+
}
|
|
12045
|
+
`;
|
|
12046
|
+
const StyledMobileSubMenuItems = styled.div`
|
|
12047
|
+
margin-left: var(--wui-space-04);
|
|
12048
|
+
`;
|
|
12049
|
+
const StyledSubTrigger = styled(Menu$1.SubmenuTrigger)`
|
|
12050
|
+
outline: none;
|
|
12051
|
+
|
|
12052
|
+
&[data-popup-open],
|
|
12053
|
+
&[data-highlighted] {
|
|
12054
|
+
background-color: var(--wui-color-bg-surface-hover);
|
|
12055
|
+
}
|
|
12056
|
+
`;
|
|
12057
|
+
const SubMenuTrigger = ({ icon, ...props }) => {
|
|
12058
|
+
const { isSmAndUp } = useMq();
|
|
12059
|
+
return /* @__PURE__ */ jsx(isSmAndUp ? StyledSubTrigger : Menu$1.Item, {
|
|
12060
|
+
nativeButton: true,
|
|
12061
|
+
render: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
12062
|
+
...props,
|
|
12063
|
+
leftIcon: icon,
|
|
12064
|
+
rightIcon: /* @__PURE__ */ jsx(Icon, { type: "caret-right" })
|
|
12065
|
+
})
|
|
12066
|
+
});
|
|
12067
|
+
};
|
|
12068
|
+
const SubMenu = ({ label, description, children, onOpenChange = () => null, ...props }) => {
|
|
12069
|
+
const { isSmAndUp } = useMq();
|
|
12070
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
12071
|
+
const { compact } = useMenuContext();
|
|
12072
|
+
return isSmAndUp ? /* @__PURE__ */ jsxs(Menu$1.SubmenuRoot, {
|
|
12073
|
+
onOpenChange,
|
|
12074
|
+
children: [/* @__PURE__ */ jsxs(SubMenuTrigger, {
|
|
12075
|
+
...props,
|
|
12076
|
+
children: [/* @__PURE__ */ jsx(MenuItemLabel, { children: label }), isNotNil(description) ? /* @__PURE__ */ jsx(MenuItemDescription, { children: description }) : null]
|
|
12077
|
+
}), /* @__PURE__ */ jsx(Menu$1.Portal, { children: /* @__PURE__ */ jsx(Menu$1.Positioner, { children: /* @__PURE__ */ jsx(SubMenuPopup, {
|
|
12078
|
+
$compact: compact,
|
|
12079
|
+
children
|
|
12080
|
+
}) }) })]
|
|
12081
|
+
}) : /* @__PURE__ */ jsxs(Menu$1.Group, { children: [/* @__PURE__ */ jsxs(SubMenuTrigger, {
|
|
12082
|
+
...props,
|
|
12083
|
+
onClick: (event) => {
|
|
12084
|
+
event.preventDefault();
|
|
12085
|
+
setIsExpanded((prev) => !prev);
|
|
12086
|
+
},
|
|
12087
|
+
children: [/* @__PURE__ */ jsx(MenuItemLabel, { children: label }), isNotNil(description) ? /* @__PURE__ */ jsx(MenuItemDescription, { children: description }) : null]
|
|
12088
|
+
}), /* @__PURE__ */ jsx(StyledMobileSubMenuItems, { children: isExpanded ? children : null })] });
|
|
12089
|
+
};
|
|
12090
|
+
SubMenu.displayName = "SubMenu_UI";
|
|
12091
|
+
//#endregion
|
|
12092
|
+
//#region src/components/Menu/MenuItem.tsx
|
|
12093
|
+
const MenuItem = forwardRef(({ onSelect = () => null, closeOnClick = true, ...props }, ref) => {
|
|
12094
|
+
return /* @__PURE__ */ jsx(Menu$1.Item, {
|
|
12095
|
+
closeOnClick,
|
|
12096
|
+
nativeButton: isNil(props.href),
|
|
12097
|
+
onClick: onSelect,
|
|
12098
|
+
render: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
12099
|
+
...props,
|
|
12100
|
+
ref,
|
|
12101
|
+
leftIcon: props.icon
|
|
12102
|
+
})
|
|
12103
|
+
});
|
|
12104
|
+
});
|
|
12105
|
+
MenuItem.displayName = "MenuItem_UI";
|
|
12106
|
+
//#endregion
|
|
12107
|
+
//#region src/components/Menu/MenuRadioGroup.tsx
|
|
12108
|
+
const MenuRadioGroup = ({ children, ...props }) => {
|
|
12109
|
+
return /* @__PURE__ */ jsx(Menu$1.RadioGroup, {
|
|
12110
|
+
...props,
|
|
12111
|
+
children
|
|
12112
|
+
});
|
|
12113
|
+
};
|
|
12114
|
+
MenuRadioGroup.displayName = "MenuRadioGroup_UI";
|
|
12115
|
+
//#endregion
|
|
12116
|
+
//#region src/components/Menu/RadioMenuItem.tsx
|
|
12117
|
+
const RadioMenuItem = ({ onSelect, value, indicator = /* @__PURE__ */ jsx(Icon, {
|
|
12118
|
+
size: "sm",
|
|
12119
|
+
type: "checkmark"
|
|
12120
|
+
}), ...props }) => {
|
|
12121
|
+
const extraProps = onSelect ? { onClick: onSelect } : {};
|
|
12122
|
+
return /* @__PURE__ */ jsx(Menu$1.RadioItem, {
|
|
12123
|
+
closeOnClick: true,
|
|
12124
|
+
nativeButton: true,
|
|
12125
|
+
...extraProps,
|
|
12126
|
+
render: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
12127
|
+
...props,
|
|
12128
|
+
rightIcon: /* @__PURE__ */ jsx(Menu$1.RadioItemIndicator, { children: indicator })
|
|
12129
|
+
}),
|
|
12130
|
+
value
|
|
12131
|
+
});
|
|
12132
|
+
};
|
|
12133
|
+
RadioMenuItem.displayName = "RadioMenuItem_UI";
|
|
12134
|
+
//#endregion
|
|
12135
|
+
//#region src/components/Menu/CheckboxMenuItem.tsx
|
|
12136
|
+
const CheckboxIndicator = ({ checked, ...props }) => {
|
|
12137
|
+
return checked ? /* @__PURE__ */ jsxs("svg", {
|
|
12138
|
+
...props,
|
|
12139
|
+
fill: "none",
|
|
12140
|
+
height: "24",
|
|
12141
|
+
viewBox: "0 0 24 24",
|
|
12142
|
+
width: "24",
|
|
12143
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12144
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
12145
|
+
d: "m4 8c0-2.20914 1.79086-4 4-4h8c2.2091 0 4 1.79086 4 4v8c0 2.2091-1.7909 4-4 4h-8c-2.20914 0-4-1.7909-4-4z",
|
|
12146
|
+
fill: "#2949e5"
|
|
12147
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
12148
|
+
d: "m10.4728 15.1931-3.09523-3.1131c-.18596-.187-.18596-.4902 0-.6773l.67341-.6773c.18596-.187.48749-.187.67344 0l2.08508 2.0971 4.4661-4.49174c.1859-.18703.4875-.18703.6734 0l.6734.67731c.186.18703.186.49027 0 .67731l-5.4762 5.50772c-.1859.187-.4874.187-.6734 0z",
|
|
12149
|
+
fill: "#fff"
|
|
12150
|
+
})]
|
|
12151
|
+
}) : /* @__PURE__ */ jsxs("svg", {
|
|
12152
|
+
...props,
|
|
12153
|
+
fill: "none",
|
|
12154
|
+
height: "24",
|
|
12155
|
+
viewBox: "0 0 24 24",
|
|
12156
|
+
width: "24",
|
|
12157
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12158
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
12159
|
+
d: "m8 4.5h8c1.933 0 3.5 1.567 3.5 3.5v8c0 1.933-1.567 3.5-3.5 3.5h-8c-1.933 0-3.5-1.567-3.5-3.5v-8c0-1.933 1.567-3.5 3.5-3.5z",
|
|
12160
|
+
fill: "#fcfcfd"
|
|
12161
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
12162
|
+
d: "m8 4.5h8c1.933 0 3.5 1.567 3.5 3.5v8c0 1.933-1.567 3.5-3.5 3.5h-8c-1.933 0-3.5-1.567-3.5-3.5v-8c0-1.933 1.567-3.5 3.5-3.5z",
|
|
12163
|
+
stroke: "#bbbbc4"
|
|
12164
|
+
})]
|
|
12205
12165
|
});
|
|
12206
12166
|
};
|
|
12207
|
-
|
|
12167
|
+
const CheckboxMenuItem = ({ onSelect = () => null, checked, onCheckedChange, ...props }) => {
|
|
12168
|
+
return /* @__PURE__ */ jsx(Menu$1.CheckboxItem, {
|
|
12169
|
+
checked,
|
|
12170
|
+
closeOnClick: false,
|
|
12171
|
+
nativeButton: true,
|
|
12172
|
+
onCheckedChange,
|
|
12173
|
+
onClick: onSelect,
|
|
12174
|
+
render: /* @__PURE__ */ jsx(MenuItemButton, {
|
|
12175
|
+
...props,
|
|
12176
|
+
leftIcon: isNotNil(props.icon) ? props.icon : /* @__PURE__ */ jsx(CheckboxIndicator, { checked }),
|
|
12177
|
+
rightIcon: isNotNil(props.icon) ? /* @__PURE__ */ jsx(Menu$1.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(Icon, { type: "checkmark" }) }) : void 0
|
|
12178
|
+
})
|
|
12179
|
+
});
|
|
12180
|
+
};
|
|
12181
|
+
CheckboxMenuItem.displayName = "CheckboxMenuItem_UI";
|
|
12182
|
+
//#endregion
|
|
12183
|
+
//#region src/components/Menu/FilterMenu.tsx
|
|
12184
|
+
const FilterMenuItem = CheckboxMenuItem;
|
|
12185
|
+
const FilterMenu = forwardRef(({ value, onChange, searchValue, onSearchValueChange, children, ...props }, ref) => {
|
|
12186
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
12187
|
+
...props,
|
|
12188
|
+
ref,
|
|
12189
|
+
children: [
|
|
12190
|
+
/* @__PURE__ */ jsx(Card, {
|
|
12191
|
+
alignItems: "flex-end",
|
|
12192
|
+
border: false,
|
|
12193
|
+
borderRadius: "border-radius-02",
|
|
12194
|
+
paddingSize: "space-01",
|
|
12195
|
+
prominence: "primary",
|
|
12196
|
+
style: {
|
|
12197
|
+
position: "absolute",
|
|
12198
|
+
top: 0,
|
|
12199
|
+
left: 0,
|
|
12200
|
+
right: 0,
|
|
12201
|
+
margin: "1px"
|
|
12202
|
+
},
|
|
12203
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
12204
|
+
autoFocus: true,
|
|
12205
|
+
onChange: (event) => {
|
|
12206
|
+
onSearchValueChange(event.target.value);
|
|
12207
|
+
},
|
|
12208
|
+
onKeyDown: (event) => {
|
|
12209
|
+
if (event.key === "ArrowDown") {
|
|
12210
|
+
event.preventDefault();
|
|
12211
|
+
const firstMenuItem = document.querySelector("[role=\"menu\"]")?.querySelector("[role=\"menuitemcheckbox\"]");
|
|
12212
|
+
if (firstMenuItem) firstMenuItem.focus();
|
|
12213
|
+
}
|
|
12214
|
+
event.stopPropagation();
|
|
12215
|
+
},
|
|
12216
|
+
placeholder: "Search...",
|
|
12217
|
+
tabIndex: 0,
|
|
12218
|
+
type: "search",
|
|
12219
|
+
value: searchValue
|
|
12220
|
+
})
|
|
12221
|
+
}),
|
|
12222
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
12223
|
+
disabled: true,
|
|
12224
|
+
style: { padding: "16px" },
|
|
12225
|
+
children: " "
|
|
12226
|
+
}),
|
|
12227
|
+
Children.toArray(children).length > 0 ? children : /* @__PURE__ */ jsx(MenuItem, {
|
|
12228
|
+
disabled: true,
|
|
12229
|
+
children: "No results found"
|
|
12230
|
+
}),
|
|
12231
|
+
value.length > 0 && /* @__PURE__ */ jsx(Menu$1.Item, {
|
|
12232
|
+
disabled: true,
|
|
12233
|
+
style: { marginTop: "24px" },
|
|
12234
|
+
children: /* @__PURE__ */ jsx(Card, {
|
|
12235
|
+
alignItems: "flex-end",
|
|
12236
|
+
border: false,
|
|
12237
|
+
borderRadius: "border-radius-02",
|
|
12238
|
+
paddingSize: "space-01",
|
|
12239
|
+
prominence: "primary",
|
|
12240
|
+
style: {
|
|
12241
|
+
position: "absolute",
|
|
12242
|
+
bottom: 0,
|
|
12243
|
+
left: 0,
|
|
12244
|
+
right: 0,
|
|
12245
|
+
margin: "1px"
|
|
12246
|
+
},
|
|
12247
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
12248
|
+
onClick: () => onChange([]),
|
|
12249
|
+
size: "sm",
|
|
12250
|
+
children: "Clear"
|
|
12251
|
+
})
|
|
12252
|
+
})
|
|
12253
|
+
})
|
|
12254
|
+
]
|
|
12255
|
+
});
|
|
12256
|
+
});
|
|
12257
|
+
FilterMenu.displayName = "FilterMenu_UI";
|
|
12208
12258
|
//#endregion
|
|
12209
12259
|
//#region src/components/Meter/Meter.tsx
|
|
12210
12260
|
const MeterWrapper = styled.div`
|
|
@@ -12365,19 +12415,14 @@ const Meter = ({ segments, label, labelMeta, description, hideKey = false, max =
|
|
|
12365
12415
|
Meter.displayName = "Meter_UI";
|
|
12366
12416
|
//#endregion
|
|
12367
12417
|
//#region src/components/Modal/ModalCloseButton.tsx
|
|
12368
|
-
const CloseButton = styled(Close$1)`
|
|
12369
|
-
align-self: start;
|
|
12370
|
-
`;
|
|
12371
12418
|
const ModalCloseButton = () => {
|
|
12372
|
-
return /* @__PURE__ */ jsx(
|
|
12373
|
-
|
|
12374
|
-
|
|
12375
|
-
|
|
12376
|
-
|
|
12377
|
-
|
|
12378
|
-
|
|
12379
|
-
})
|
|
12380
|
-
});
|
|
12419
|
+
return /* @__PURE__ */ jsx(Dialog.Close, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
12420
|
+
label: "Dismiss modal",
|
|
12421
|
+
size: "sm",
|
|
12422
|
+
style: { alignSelf: "start" },
|
|
12423
|
+
variant: "ghost",
|
|
12424
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
12425
|
+
}) });
|
|
12381
12426
|
};
|
|
12382
12427
|
//#endregion
|
|
12383
12428
|
//#region src/components/Modal/ModalHeader.tsx
|
|
@@ -12389,7 +12434,7 @@ const Header = styled.header`
|
|
|
12389
12434
|
gap: var(--wui-space-01);
|
|
12390
12435
|
justify-content: ${({ $hideTitle }) => $hideTitle ? "flex-end" : "space-between"}; /* ensure ModalCloseButton is right-aligned */
|
|
12391
12436
|
|
|
12392
|
-
/*
|
|
12437
|
+
/* Dialog.Title creates an h2 element which inherits some margin */
|
|
12393
12438
|
h2 {
|
|
12394
12439
|
margin: 0;
|
|
12395
12440
|
padding-right: ${({ $hideCloseButon }) => $hideCloseButon ? "0" : "var(--wui-space-03)"};
|
|
@@ -12401,7 +12446,7 @@ const Header = styled.header`
|
|
|
12401
12446
|
top: var(--wui-space-03);
|
|
12402
12447
|
}
|
|
12403
12448
|
`;
|
|
12404
|
-
const Title
|
|
12449
|
+
const Title = styled(Dialog.Title)`
|
|
12405
12450
|
font-family: var(--wui-typography-heading-2-family);
|
|
12406
12451
|
line-height: var(--wui-typography-heading-2-line-height);
|
|
12407
12452
|
font-size: var(--wui-typography-heading-2-size);
|
|
@@ -12412,30 +12457,13 @@ const ModalHeader = ({ title, hideTitle, hideCloseButton }) => {
|
|
|
12412
12457
|
return /* @__PURE__ */ jsxs(Header, {
|
|
12413
12458
|
$hideCloseButon: hideCloseButton,
|
|
12414
12459
|
$hideTitle: hideTitle,
|
|
12415
|
-
children: [hideTitle ? /* @__PURE__ */ jsx(ScreenReaderOnly, { children: /* @__PURE__ */ jsx(Title
|
|
12460
|
+
children: [hideTitle ? /* @__PURE__ */ jsx(ScreenReaderOnly, { children: /* @__PURE__ */ jsx(Title, { children: title }) }) : /* @__PURE__ */ jsx(Title, { children: title }), hideCloseButton ? null : /* @__PURE__ */ jsx(ModalCloseButton, {})]
|
|
12416
12461
|
});
|
|
12417
12462
|
};
|
|
12418
12463
|
//#endregion
|
|
12419
12464
|
//#region src/components/Modal/constants.ts
|
|
12420
12465
|
const DEFAULT_MODAL_WIDTH = "532px";
|
|
12421
12466
|
//#endregion
|
|
12422
|
-
//#region src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
12423
|
-
const useFocusRestore = () => {
|
|
12424
|
-
const previouslyFocusedRef = useRef(null);
|
|
12425
|
-
const timeoutRef = useRef(null);
|
|
12426
|
-
useEffect(() => {
|
|
12427
|
-
previouslyFocusedRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
12428
|
-
}, []);
|
|
12429
|
-
useEffect(() => {
|
|
12430
|
-
return () => {
|
|
12431
|
-
if (isNotNil(timeoutRef.current)) clearTimeout(timeoutRef.current);
|
|
12432
|
-
if (isNotNil(previouslyFocusedRef.current)) timeoutRef.current = setTimeout(() => {
|
|
12433
|
-
previouslyFocusedRef.current?.focus();
|
|
12434
|
-
}, 0);
|
|
12435
|
-
};
|
|
12436
|
-
}, []);
|
|
12437
|
-
};
|
|
12438
|
-
//#endregion
|
|
12439
12467
|
//#region src/components/Modal/ModalContent.tsx
|
|
12440
12468
|
const modalEnter = keyframes`
|
|
12441
12469
|
from {
|
|
@@ -12472,8 +12500,8 @@ const positionStyleMap = {
|
|
|
12472
12500
|
transform-origin: left center;
|
|
12473
12501
|
animation: ${modalEnter} var(--wui-motion-duration-04) var(--wui-motion-ease-out);
|
|
12474
12502
|
|
|
12475
|
-
&[data-
|
|
12476
|
-
animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out);
|
|
12503
|
+
&[data-closed] {
|
|
12504
|
+
animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out) forwards;
|
|
12477
12505
|
}
|
|
12478
12506
|
`,
|
|
12479
12507
|
"fixed-top": css`
|
|
@@ -12491,8 +12519,8 @@ const positionStyleMap = {
|
|
|
12491
12519
|
transform-origin: left center;
|
|
12492
12520
|
animation: ${modalEnter} var(--wui-motion-duration-04) var(--wui-motion-ease-out);
|
|
12493
12521
|
|
|
12494
|
-
&[data-
|
|
12495
|
-
animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out);
|
|
12522
|
+
&[data-closed] {
|
|
12523
|
+
animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out) forwards;
|
|
12496
12524
|
}
|
|
12497
12525
|
`,
|
|
12498
12526
|
"right-side-panel": css`
|
|
@@ -12514,7 +12542,7 @@ const positionStyleMap = {
|
|
|
12514
12542
|
`} var(--wui-motion-duration-05) var(--wui-motion-ease-out);
|
|
12515
12543
|
transform-origin: right center;
|
|
12516
12544
|
|
|
12517
|
-
&[data-
|
|
12545
|
+
&[data-closed] {
|
|
12518
12546
|
animation: ${keyframes`
|
|
12519
12547
|
from {
|
|
12520
12548
|
opacity: 1;
|
|
@@ -12525,11 +12553,11 @@ const positionStyleMap = {
|
|
|
12525
12553
|
opacity: 0;
|
|
12526
12554
|
transform: translateX(100%);
|
|
12527
12555
|
}
|
|
12528
|
-
`} var(--wui-motion-duration-03) var(--wui-motion-ease-in);
|
|
12556
|
+
`} var(--wui-motion-duration-03) var(--wui-motion-ease-in) forwards;
|
|
12529
12557
|
}
|
|
12530
12558
|
`
|
|
12531
12559
|
};
|
|
12532
|
-
const StyledModalContent = styled(
|
|
12560
|
+
const StyledModalContent = styled(Dialog.Popup)`
|
|
12533
12561
|
position: fixed;
|
|
12534
12562
|
display: flex;
|
|
12535
12563
|
flex-direction: column;
|
|
@@ -12556,12 +12584,12 @@ const StyledModalContent = styled(Content$4)`
|
|
|
12556
12584
|
${({ $positionVariant }) => positionStyleMap[$positionVariant]}
|
|
12557
12585
|
}
|
|
12558
12586
|
`;
|
|
12559
|
-
const ModalContent = forwardRef(({ width, positionVariant, children, ...props }, ref) => {
|
|
12560
|
-
useFocusRestore();
|
|
12587
|
+
const ModalContent = forwardRef(({ width, positionVariant, initialFocusRef, children, ...props }, ref) => {
|
|
12561
12588
|
return /* @__PURE__ */ jsx(StyledModalContent, {
|
|
12562
12589
|
ref,
|
|
12563
12590
|
$positionVariant: positionVariant,
|
|
12564
12591
|
$width: width,
|
|
12592
|
+
...isNotNil(initialFocusRef) ? { initialFocus: initialFocusRef } : {},
|
|
12565
12593
|
...props,
|
|
12566
12594
|
children
|
|
12567
12595
|
});
|
|
@@ -12587,20 +12615,20 @@ const backdropHide = keyframes`
|
|
|
12587
12615
|
opacity: 0;
|
|
12588
12616
|
}
|
|
12589
12617
|
`;
|
|
12590
|
-
const ModalOverlay = styled(
|
|
12618
|
+
const ModalOverlay = styled(Dialog.Backdrop)`
|
|
12591
12619
|
animation: ${backdropShow} var(--wui-motion-duration-02);
|
|
12592
12620
|
background: var(--wui-color-backdrop);
|
|
12593
12621
|
inset: 0;
|
|
12594
12622
|
position: fixed;
|
|
12595
12623
|
z-index: var(--wui-zindex-backdrop);
|
|
12596
12624
|
|
|
12597
|
-
&[data-
|
|
12598
|
-
animation: ${backdropHide} var(--wui-motion-duration-02);
|
|
12625
|
+
&[data-closed] {
|
|
12626
|
+
animation: ${backdropHide} var(--wui-motion-duration-02) forwards;
|
|
12599
12627
|
}
|
|
12600
12628
|
`;
|
|
12601
12629
|
//#endregion
|
|
12602
12630
|
//#region src/components/Modal/Modal.tsx
|
|
12603
|
-
const ModalHiddenDescription = styled(Description)({ ...visuallyHiddenStyle });
|
|
12631
|
+
const ModalHiddenDescription = styled(Dialog.Description)({ ...visuallyHiddenStyle });
|
|
12604
12632
|
const ModalBody = styled.div`
|
|
12605
12633
|
flex-direction: column;
|
|
12606
12634
|
display: flex;
|
|
@@ -12618,175 +12646,77 @@ const ModalFooter = styled.footer`
|
|
|
12618
12646
|
order: 3;
|
|
12619
12647
|
`;
|
|
12620
12648
|
/**
|
|
12621
|
-
* A Modal is a focused UI element that appears atop the main interface, requiring
|
|
12622
|
-
* user interaction or dismissal before returning to the underlying content.
|
|
12623
|
-
*/
|
|
12624
|
-
const Modal = forwardRef(({ children, footer, hideCloseButton = false, hideTitle = false, initialFocusRef, isOpen, onRequestClose, positionVariant = "centered", title, width = DEFAULT_MODAL_WIDTH, ...props }, ref) => {
|
|
12625
|
-
return /* @__PURE__ */ jsx(Root$7, {
|
|
12626
|
-
onOpenChange: (open) => {
|
|
12627
|
-
if (!open && isNotNil(onRequestClose)) onRequestClose();
|
|
12628
|
-
},
|
|
12629
|
-
open: isOpen,
|
|
12630
|
-
children: /* @__PURE__ */ jsxs(Portal$3, { children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
|
|
12631
|
-
ref,
|
|
12632
|
-
onOpenAutoFocus: (event) => {
|
|
12633
|
-
if (isNotNil(initialFocusRef) && initialFocusRef.current) {
|
|
12634
|
-
event.preventDefault();
|
|
12635
|
-
requestAnimationFrame(() => {
|
|
12636
|
-
initialFocusRef.current?.focus();
|
|
12637
|
-
});
|
|
12638
|
-
}
|
|
12639
|
-
},
|
|
12640
|
-
positionVariant,
|
|
12641
|
-
width,
|
|
12642
|
-
...props,
|
|
12643
|
-
children: [
|
|
12644
|
-
/* @__PURE__ */ jsx(ModalScrollArea, { children: /* @__PURE__ */ jsx(ModalBody, { children }) }),
|
|
12645
|
-
isNotNil(footer) ? /* @__PURE__ */ jsx(ModalFooter, { children: footer }) : null,
|
|
12646
|
-
hideCloseButton && hideTitle ? null : /* @__PURE__ */ jsx(ModalHeader, {
|
|
12647
|
-
hideCloseButton,
|
|
12648
|
-
hideTitle,
|
|
12649
|
-
title
|
|
12650
|
-
}),
|
|
12651
|
-
/* @__PURE__ */ jsx(ModalHiddenDescription, {})
|
|
12652
|
-
]
|
|
12653
|
-
})] })
|
|
12654
|
-
});
|
|
12655
|
-
});
|
|
12656
|
-
Modal.displayName = "Modal_UI";
|
|
12657
|
-
//#endregion
|
|
12658
|
-
//#region src/components/Modal/ModalCallouts.tsx
|
|
12659
|
-
const ModalCallouts = ({ children }) => {
|
|
12660
|
-
return /* @__PURE__ */ jsx(Stack, {
|
|
12661
|
-
direction: "horizontal",
|
|
12662
|
-
gap: "space-08",
|
|
12663
|
-
children
|
|
12664
|
-
});
|
|
12665
|
-
};
|
|
12666
|
-
ModalCallouts.displayName = "ModalCallouts_UI";
|
|
12667
|
-
const ModalCallout = ({ title, image, children }) => {
|
|
12668
|
-
return /* @__PURE__ */ jsxs(Stack, {
|
|
12669
|
-
direction: "vertical",
|
|
12670
|
-
children: [
|
|
12671
|
-
image,
|
|
12672
|
-
/* @__PURE__ */ jsx(Heading, {
|
|
12673
|
-
variant: "heading4",
|
|
12674
|
-
children: title
|
|
12675
|
-
}),
|
|
12676
|
-
children
|
|
12677
|
-
]
|
|
12678
|
-
});
|
|
12679
|
-
};
|
|
12680
|
-
ModalCallout.displayName = "ModalCallout_UI";
|
|
12681
|
-
//#endregion
|
|
12682
|
-
//#region src/components/Popover/PopoverRoot.tsx
|
|
12683
|
-
/**
|
|
12684
|
-
* The root of a composable popover. Wrap `PopoverTrigger` (or `PopoverAnchor`)
|
|
12685
|
-
* and `PopoverContent` inside it.
|
|
12686
|
-
*
|
|
12687
|
-
* For the common "button opens a panel" case, prefer the bundled `Popover`.
|
|
12688
|
-
*/
|
|
12689
|
-
const PopoverRoot = ({ isOpen, ...props }) => /* @__PURE__ */ jsx(Root$4, {
|
|
12690
|
-
...props,
|
|
12691
|
-
...isOpen !== void 0 ? { open: isOpen } : {}
|
|
12692
|
-
});
|
|
12693
|
-
PopoverRoot.displayName = "PopoverRoot_UI";
|
|
12694
|
-
//#endregion
|
|
12695
|
-
//#region src/components/Popover/PopoverTrigger.tsx
|
|
12696
|
-
/**
|
|
12697
|
-
* The button that toggles the popover open and closed. By default it renders a
|
|
12698
|
-
* `<button>` wrapping its children; pass `asChild` to merge the trigger
|
|
12699
|
-
* behavior onto a single child element (e.g. a `Button` or `IconButton`).
|
|
12700
|
-
*/
|
|
12701
|
-
const PopoverTrigger = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Trigger$2, {
|
|
12702
|
-
ref: forwardedRef,
|
|
12703
|
-
...props
|
|
12704
|
-
}));
|
|
12705
|
-
PopoverTrigger.displayName = "PopoverTrigger_UI";
|
|
12706
|
-
//#endregion
|
|
12707
|
-
//#region src/components/Popover/PopoverPortal.tsx
|
|
12708
|
-
/**
|
|
12709
|
-
* Portals the popover content out of the DOM hierarchy of its trigger so it can
|
|
12710
|
-
* escape clipping ancestors (`overflow: hidden`, transformed containers, etc.).
|
|
12711
|
-
*/
|
|
12712
|
-
const PopoverPortal = (props) => /* @__PURE__ */ jsx(Portal$1, { ...props });
|
|
12713
|
-
PopoverPortal.displayName = "PopoverPortal_UI";
|
|
12714
|
-
//#endregion
|
|
12715
|
-
//#region src/components/Popover/PopoverContent.tsx
|
|
12716
|
-
const StyledContent$1 = styled(Content$2)`
|
|
12717
|
-
z-index: var(--wui-zindex-popover);
|
|
12718
|
-
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
12719
|
-
${({ $unstyled }) => !$unstyled && css`
|
|
12720
|
-
border-radius: var(--wui-border-radius-02);
|
|
12721
|
-
padding: var(--wui-space-04);
|
|
12722
|
-
max-width: var(--wui-popover-max-width);
|
|
12723
|
-
max-height: var(--wui-popover-max-height);
|
|
12724
|
-
background-color: var(--wui-color-bg-surface);
|
|
12725
|
-
box-shadow: var(--wui-elevation-01);
|
|
12726
|
-
border: 1px solid var(--wui-color-border);
|
|
12727
|
-
overflow: auto;
|
|
12728
|
-
`}
|
|
12729
|
-
|
|
12730
|
-
[data-wui-popover-close] {
|
|
12731
|
-
position: absolute;
|
|
12732
|
-
top: var(--wui-space-02);
|
|
12733
|
-
right: var(--wui-space-02);
|
|
12734
|
-
}
|
|
12735
|
-
`;
|
|
12736
|
-
const DEFAULT_SIDE_OFFSET = 8;
|
|
12737
|
-
const DEFAULT_MAX_WIDTH = "320px";
|
|
12738
|
-
const DEFAULT_MAX_HEIGHT = "auto";
|
|
12739
|
-
/**
|
|
12740
|
-
* The styled popover surface. Place inside a `PopoverRoot` (typically wrapped
|
|
12741
|
-
* in a `PopoverPortal`). Forwards all Radix Content props, including
|
|
12742
|
-
* dismissal/focus event handlers such as `onPointerDownOutside`,
|
|
12743
|
-
* `onOpenAutoFocus`, and `onCloseAutoFocus`.
|
|
12649
|
+
* A Modal is a focused UI element that appears atop the main interface, requiring
|
|
12650
|
+
* user interaction or dismissal before returning to the underlying content.
|
|
12744
12651
|
*/
|
|
12745
|
-
const
|
|
12746
|
-
return /* @__PURE__ */ jsx(
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
$unstyled: unstyled,
|
|
12750
|
-
sideOffset,
|
|
12751
|
-
style: {
|
|
12752
|
-
"--wui-popover-max-width": maxWidth,
|
|
12753
|
-
"--wui-popover-max-height": maxHeight,
|
|
12754
|
-
...style
|
|
12652
|
+
const Modal = forwardRef(({ children, footer, hideCloseButton = false, hideTitle = false, initialFocusRef, isOpen, onRequestClose, positionVariant = "centered", title, width = DEFAULT_MODAL_WIDTH, ...props }, ref) => {
|
|
12653
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
12654
|
+
onOpenChange: (open) => {
|
|
12655
|
+
if (!open && isNotNil(onRequestClose)) onRequestClose();
|
|
12755
12656
|
},
|
|
12756
|
-
|
|
12657
|
+
open: isOpen,
|
|
12658
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(ModalOverlay, {}), /* @__PURE__ */ jsxs(ModalContent, {
|
|
12659
|
+
ref,
|
|
12660
|
+
initialFocusRef,
|
|
12661
|
+
positionVariant,
|
|
12662
|
+
width,
|
|
12663
|
+
...props,
|
|
12664
|
+
children: [
|
|
12665
|
+
/* @__PURE__ */ jsx(ModalScrollArea, { children: /* @__PURE__ */ jsx(ModalBody, { children }) }),
|
|
12666
|
+
isNotNil(footer) ? /* @__PURE__ */ jsx(ModalFooter, { children: footer }) : null,
|
|
12667
|
+
hideCloseButton && hideTitle ? null : /* @__PURE__ */ jsx(ModalHeader, {
|
|
12668
|
+
hideCloseButton,
|
|
12669
|
+
hideTitle,
|
|
12670
|
+
title
|
|
12671
|
+
}),
|
|
12672
|
+
/* @__PURE__ */ jsx(ModalHiddenDescription, {})
|
|
12673
|
+
]
|
|
12674
|
+
})] })
|
|
12757
12675
|
});
|
|
12758
12676
|
});
|
|
12759
|
-
|
|
12677
|
+
Modal.displayName = "Modal_UI";
|
|
12760
12678
|
//#endregion
|
|
12761
|
-
//#region src/components/
|
|
12762
|
-
|
|
12763
|
-
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
})
|
|
12771
|
-
|
|
12679
|
+
//#region src/components/Modal/ModalCallouts.tsx
|
|
12680
|
+
const ModalCallouts = ({ children }) => {
|
|
12681
|
+
return /* @__PURE__ */ jsx(Stack, {
|
|
12682
|
+
direction: "horizontal",
|
|
12683
|
+
gap: "space-08",
|
|
12684
|
+
children
|
|
12685
|
+
});
|
|
12686
|
+
};
|
|
12687
|
+
ModalCallouts.displayName = "ModalCallouts_UI";
|
|
12688
|
+
const ModalCallout = ({ title, image, children }) => {
|
|
12689
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
12690
|
+
direction: "vertical",
|
|
12691
|
+
children: [
|
|
12692
|
+
image,
|
|
12693
|
+
/* @__PURE__ */ jsx(Heading, {
|
|
12694
|
+
variant: "heading4",
|
|
12695
|
+
children: title
|
|
12696
|
+
}),
|
|
12697
|
+
children
|
|
12698
|
+
]
|
|
12699
|
+
});
|
|
12700
|
+
};
|
|
12701
|
+
ModalCallout.displayName = "ModalCallout_UI";
|
|
12772
12702
|
//#endregion
|
|
12773
|
-
//#region src/
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
|
|
12777
|
-
|
|
12778
|
-
|
|
12779
|
-
|
|
12780
|
-
children: /* @__PURE__ */ jsx(IconButton, {
|
|
12781
|
-
"data-wui-popover-close": true,
|
|
12782
|
-
label,
|
|
12783
|
-
variant: "ghost",
|
|
12784
|
-
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
12785
|
-
})
|
|
12786
|
-
});
|
|
12787
|
-
PopoverCloseButton.displayName = "PopoverCloseButton_UI";
|
|
12703
|
+
//#region src/private/helpers/getControls/getControlProps.tsx
|
|
12704
|
+
const getControlProps = (isOpen, onOpenChange) => {
|
|
12705
|
+
return isNotNil(onOpenChange) && isNotNil(isOpen) ? {
|
|
12706
|
+
open: isOpen,
|
|
12707
|
+
onOpenChange
|
|
12708
|
+
} : {};
|
|
12709
|
+
};
|
|
12788
12710
|
//#endregion
|
|
12789
12711
|
//#region src/components/Popover/PopoverArrow.tsx
|
|
12712
|
+
const StyledArrowSvg = styled.svg`
|
|
12713
|
+
/* Override Base UI's inline top positioning and rotate the arrow to match Radix behavior.
|
|
12714
|
+
Radix applied rotate(180deg) so the circle sits near the trigger and the stalk extends
|
|
12715
|
+
down toward the popup. Base UI does not rotate the arrow automatically. */
|
|
12716
|
+
top: 0 !important;
|
|
12717
|
+
transform: rotate(180deg);
|
|
12718
|
+
transform-origin: center 0;
|
|
12719
|
+
`;
|
|
12790
12720
|
const StyledPath = styled.path`
|
|
12791
12721
|
fill: var(--wui-color-border-secondary);
|
|
12792
12722
|
`;
|
|
@@ -12825,86 +12755,259 @@ const StyledCircle = styled.circle`
|
|
|
12825
12755
|
}
|
|
12826
12756
|
`;
|
|
12827
12757
|
const PopoverArrow = ({ isAnimated }) => {
|
|
12828
|
-
return /* @__PURE__ */ jsx(
|
|
12829
|
-
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
]
|
|
12855
|
-
})
|
|
12856
|
-
});
|
|
12758
|
+
return /* @__PURE__ */ jsx(Popover$1.Arrow, { render: /* @__PURE__ */ jsxs(StyledArrowSvg, {
|
|
12759
|
+
fill: "none",
|
|
12760
|
+
height: "56",
|
|
12761
|
+
viewBox: "0 0 48 56",
|
|
12762
|
+
width: "48",
|
|
12763
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12764
|
+
children: [
|
|
12765
|
+
/* @__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" }),
|
|
12766
|
+
/* @__PURE__ */ jsx(StyledCircle, {
|
|
12767
|
+
$isAnimated: isAnimated,
|
|
12768
|
+
cx: "24",
|
|
12769
|
+
cy: "32",
|
|
12770
|
+
"data-wui-popover-arrow-inner-circle": true,
|
|
12771
|
+
r: "10",
|
|
12772
|
+
strokeWidth: "4"
|
|
12773
|
+
}),
|
|
12774
|
+
/* @__PURE__ */ jsx(StyledCircle, {
|
|
12775
|
+
$isAnimated: isAnimated,
|
|
12776
|
+
cx: "24",
|
|
12777
|
+
cy: "32",
|
|
12778
|
+
"data-wui-popover-arrow-outer-circle": true,
|
|
12779
|
+
r: "20",
|
|
12780
|
+
strokeWidth: "8"
|
|
12781
|
+
})
|
|
12782
|
+
]
|
|
12783
|
+
}) });
|
|
12857
12784
|
};
|
|
12858
12785
|
PopoverArrow.displayName = "PopoverArrow_UI";
|
|
12859
12786
|
//#endregion
|
|
12860
12787
|
//#region src/components/Popover/Popover.tsx
|
|
12788
|
+
const StyledPopup$2 = styled(Popover$1.Popup)`
|
|
12789
|
+
z-index: var(--wui-zindex-popover);
|
|
12790
|
+
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
12791
|
+
${({ $unstyled }) => !$unstyled && css`
|
|
12792
|
+
border-radius: var(--wui-border-radius-02);
|
|
12793
|
+
padding: var(--wui-space-04);
|
|
12794
|
+
max-width: var(--wui-popover-max-width, 320px);
|
|
12795
|
+
max-height: var(--wui-popover-max-height, auto);
|
|
12796
|
+
background-color: var(--wui-color-bg-surface);
|
|
12797
|
+
box-shadow: var(--wui-elevation-01);
|
|
12798
|
+
border: 1px solid var(--wui-color-border);
|
|
12799
|
+
overflow: auto;
|
|
12800
|
+
`}
|
|
12801
|
+
|
|
12802
|
+
${({ $withArrow }) => $withArrow && css`
|
|
12803
|
+
overflow: visible;
|
|
12804
|
+
`}
|
|
12805
|
+
|
|
12806
|
+
[data-wui-popover-close] {
|
|
12807
|
+
position: absolute;
|
|
12808
|
+
top: var(--wui-space-02);
|
|
12809
|
+
right: var(--wui-space-02);
|
|
12810
|
+
}
|
|
12811
|
+
`;
|
|
12861
12812
|
/**
|
|
12862
12813
|
* Displays rich content in a portal, triggered by a button.
|
|
12863
12814
|
*
|
|
12864
|
-
* For more control — custom anchor,
|
|
12865
|
-
*
|
|
12866
|
-
* primitives directly: `PopoverRoot`, `PopoverTrigger`, `PopoverAnchor`,
|
|
12815
|
+
* For more control — custom anchor, no injected close button, etc. — compose
|
|
12816
|
+
* the primitives directly: `PopoverRoot`, `PopoverTrigger`, `PopoverAnchor`,
|
|
12867
12817
|
* `PopoverPortal`, `PopoverContent`, `PopoverClose`.
|
|
12868
12818
|
*/
|
|
12869
|
-
const Popover = ({ children, trigger, isOpen, hideCloseButton = false, maxWidth, maxHeight, onOpenChange, unstyled = false, withArrow = false, isAnimated = false, colorScheme = "inherit", style, ...props }) => {
|
|
12870
|
-
const sideOffset = withArrow ?
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12819
|
+
const Popover = ({ children, trigger, isOpen, hideCloseButton = false, maxWidth, maxHeight, onOpenChange, unstyled = false, withArrow = false, isAnimated = false, colorScheme = "inherit", style, side, align, nativeButton = true, ...props }) => {
|
|
12820
|
+
const sideOffset = withArrow ? 32 : 8;
|
|
12821
|
+
const mergedStyle = {
|
|
12822
|
+
"--wui-popover-max-width": maxWidth,
|
|
12823
|
+
"--wui-popover-max-height": maxHeight,
|
|
12824
|
+
...style
|
|
12825
|
+
};
|
|
12826
|
+
return /* @__PURE__ */ jsxs(Popover$1.Root, {
|
|
12827
|
+
...getControlProps(isOpen, onOpenChange),
|
|
12828
|
+
children: [/* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
12829
|
+
nativeButton,
|
|
12830
|
+
render: trigger
|
|
12831
|
+
}), /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
12832
|
+
align,
|
|
12833
|
+
collisionAvoidance: {
|
|
12834
|
+
side: "flip",
|
|
12835
|
+
align: "shift",
|
|
12836
|
+
fallbackAxisSide: "none"
|
|
12837
|
+
},
|
|
12838
|
+
side,
|
|
12883
12839
|
sideOffset,
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12840
|
+
children: /* @__PURE__ */ jsxs(StyledPopup$2, {
|
|
12841
|
+
$colorScheme: colorScheme,
|
|
12842
|
+
...props,
|
|
12843
|
+
$unstyled: unstyled,
|
|
12844
|
+
$withArrow: withArrow,
|
|
12845
|
+
role: "dialog",
|
|
12846
|
+
style: mergedStyle,
|
|
12847
|
+
children: [
|
|
12848
|
+
!hideCloseButton && /* @__PURE__ */ jsx(Popover$1.Close, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
12849
|
+
"data-wui-popover-close": true,
|
|
12850
|
+
label: "Close",
|
|
12851
|
+
variant: "ghost",
|
|
12852
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
12853
|
+
}) }),
|
|
12854
|
+
withArrow ? /* @__PURE__ */ jsx(PopoverArrow, { isAnimated }) : null,
|
|
12855
|
+
/* @__PURE__ */ jsx("div", { children })
|
|
12856
|
+
]
|
|
12857
|
+
})
|
|
12892
12858
|
}) })]
|
|
12893
12859
|
});
|
|
12894
12860
|
};
|
|
12895
12861
|
Popover.displayName = "Popover_UI";
|
|
12896
12862
|
//#endregion
|
|
12863
|
+
//#region src/components/Popover/PopoverAnchorContext.tsx
|
|
12864
|
+
const PopoverAnchorContext = createContext(null);
|
|
12865
|
+
const PopoverAnchorProvider = PopoverAnchorContext.Provider;
|
|
12866
|
+
const usePopoverAnchor = () => useContext(PopoverAnchorContext);
|
|
12867
|
+
const useCreatePopoverAnchorRef = () => useRef(null);
|
|
12868
|
+
//#endregion
|
|
12897
12869
|
//#region src/components/Popover/PopoverAnchor.tsx
|
|
12898
12870
|
/**
|
|
12899
12871
|
* Positions the popover relative to an element other than the trigger. Useful
|
|
12900
12872
|
* when the element the user interacts with (e.g. a text input) is separate
|
|
12901
12873
|
* from what the popover attaches to.
|
|
12874
|
+
*
|
|
12875
|
+
* Wrap the anchor element and nest `PopoverTrigger` inside it.
|
|
12876
|
+
*/
|
|
12877
|
+
const PopoverAnchor = ({ children }) => {
|
|
12878
|
+
const sharedRef = usePopoverAnchor();
|
|
12879
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12880
|
+
ref: useCallback((node) => {
|
|
12881
|
+
if (sharedRef) sharedRef.current = node;
|
|
12882
|
+
}, [sharedRef]),
|
|
12883
|
+
children
|
|
12884
|
+
});
|
|
12885
|
+
};
|
|
12886
|
+
PopoverAnchor.displayName = "PopoverAnchor_UI";
|
|
12887
|
+
//#endregion
|
|
12888
|
+
//#region src/components/Popover/PopoverClose.tsx
|
|
12889
|
+
/**
|
|
12890
|
+
* An element that closes the popover when activated. Defaults to a `<button>`;
|
|
12891
|
+
* pass `render` to merge the close behavior onto a single child element. For
|
|
12892
|
+
* a pre-styled icon close button, use `PopoverCloseButton`.
|
|
12902
12893
|
*/
|
|
12903
|
-
const
|
|
12894
|
+
const PopoverClose = forwardRef((props, forwardedRef) => /* @__PURE__ */ jsx(Popover$1.Close, {
|
|
12904
12895
|
ref: forwardedRef,
|
|
12905
12896
|
...props
|
|
12906
12897
|
}));
|
|
12907
|
-
|
|
12898
|
+
PopoverClose.displayName = "PopoverClose_UI";
|
|
12899
|
+
//#endregion
|
|
12900
|
+
//#region src/components/Popover/PopoverCloseButton.tsx
|
|
12901
|
+
/**
|
|
12902
|
+
* A pre-styled close button intended to be placed inside a `PopoverContent`.
|
|
12903
|
+
* For a custom close control, use `PopoverClose` directly.
|
|
12904
|
+
*/
|
|
12905
|
+
const PopoverCloseButton = ({ label = "Close" } = {}) => /* @__PURE__ */ jsx(PopoverClose, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
12906
|
+
"data-wui-popover-close": true,
|
|
12907
|
+
label,
|
|
12908
|
+
variant: "ghost",
|
|
12909
|
+
children: /* @__PURE__ */ jsx(Icon, { type: "close" })
|
|
12910
|
+
}) });
|
|
12911
|
+
PopoverCloseButton.displayName = "PopoverCloseButton_UI";
|
|
12912
|
+
//#endregion
|
|
12913
|
+
//#region src/components/Popover/PopoverContent.tsx
|
|
12914
|
+
const StyledPopup$1 = styled(Popover$1.Popup)`
|
|
12915
|
+
z-index: var(--wui-zindex-popover);
|
|
12916
|
+
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
12917
|
+
${({ $unstyled }) => !$unstyled && css`
|
|
12918
|
+
border-radius: var(--wui-border-radius-02);
|
|
12919
|
+
padding: var(--wui-space-04);
|
|
12920
|
+
max-width: var(--wui-popover-max-width);
|
|
12921
|
+
max-height: var(--wui-popover-max-height);
|
|
12922
|
+
background-color: var(--wui-color-bg-surface);
|
|
12923
|
+
box-shadow: var(--wui-elevation-01);
|
|
12924
|
+
border: 1px solid var(--wui-color-border);
|
|
12925
|
+
overflow: auto;
|
|
12926
|
+
`}
|
|
12927
|
+
|
|
12928
|
+
[data-wui-popover-close] {
|
|
12929
|
+
position: absolute;
|
|
12930
|
+
top: var(--wui-space-02);
|
|
12931
|
+
right: var(--wui-space-02);
|
|
12932
|
+
}
|
|
12933
|
+
`;
|
|
12934
|
+
const DEFAULT_SIDE_OFFSET = 8;
|
|
12935
|
+
const DEFAULT_MAX_WIDTH = "320px";
|
|
12936
|
+
const DEFAULT_MAX_HEIGHT = "auto";
|
|
12937
|
+
/**
|
|
12938
|
+
* The styled popover surface. Place inside a `PopoverRoot` (typically wrapped
|
|
12939
|
+
* in a `PopoverPortal`). Wraps a `Positioner` and `Popup` internally.
|
|
12940
|
+
*/
|
|
12941
|
+
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) => {
|
|
12942
|
+
const sharedAnchorRef = usePopoverAnchor();
|
|
12943
|
+
const hasAnchor = sharedAnchorRef?.current != null;
|
|
12944
|
+
const mergedStyle = {
|
|
12945
|
+
"--wui-popover-max-width": maxWidth,
|
|
12946
|
+
"--wui-popover-max-height": maxHeight,
|
|
12947
|
+
...style
|
|
12948
|
+
};
|
|
12949
|
+
return /* @__PURE__ */ jsx(Popover$1.Positioner, {
|
|
12950
|
+
align,
|
|
12951
|
+
collisionAvoidance: {
|
|
12952
|
+
side: "flip",
|
|
12953
|
+
align: "shift",
|
|
12954
|
+
fallbackAxisSide: "none"
|
|
12955
|
+
},
|
|
12956
|
+
side,
|
|
12957
|
+
sideOffset,
|
|
12958
|
+
...hasAnchor ? { anchor: sharedAnchorRef } : {},
|
|
12959
|
+
children: /* @__PURE__ */ jsx(StyledPopup$1, {
|
|
12960
|
+
ref: forwardedRef,
|
|
12961
|
+
$colorScheme: colorScheme,
|
|
12962
|
+
$unstyled: unstyled,
|
|
12963
|
+
role,
|
|
12964
|
+
style: mergedStyle,
|
|
12965
|
+
...props,
|
|
12966
|
+
children
|
|
12967
|
+
})
|
|
12968
|
+
});
|
|
12969
|
+
});
|
|
12970
|
+
PopoverContent.displayName = "PopoverContent_UI";
|
|
12971
|
+
//#endregion
|
|
12972
|
+
//#region src/components/Popover/PopoverPortal.tsx
|
|
12973
|
+
/**
|
|
12974
|
+
* Portals the popover content out of the DOM hierarchy of its trigger so it can
|
|
12975
|
+
* escape clipping ancestors (`overflow: hidden`, transformed containers, etc.).
|
|
12976
|
+
*/
|
|
12977
|
+
const PopoverPortal = ({ children }) => /* @__PURE__ */ jsx(Popover$1.Portal, { children });
|
|
12978
|
+
PopoverPortal.displayName = "PopoverPortal_UI";
|
|
12979
|
+
//#endregion
|
|
12980
|
+
//#region src/components/Popover/PopoverRoot.tsx
|
|
12981
|
+
/**
|
|
12982
|
+
* The root of a composable popover. Wrap `PopoverTrigger` (or `PopoverAnchor`)
|
|
12983
|
+
* and `PopoverContent` inside it.
|
|
12984
|
+
*
|
|
12985
|
+
* For the common "button opens a panel" case, prefer the bundled `Popover`.
|
|
12986
|
+
*/
|
|
12987
|
+
const PopoverRoot = ({ isOpen, onOpenChange, children }) => {
|
|
12988
|
+
const anchorRef = useCreatePopoverAnchorRef();
|
|
12989
|
+
return /* @__PURE__ */ jsx(Popover$1.Root, {
|
|
12990
|
+
...getControlProps(isOpen, onOpenChange),
|
|
12991
|
+
children: /* @__PURE__ */ jsx(PopoverAnchorProvider, {
|
|
12992
|
+
value: anchorRef,
|
|
12993
|
+
children
|
|
12994
|
+
})
|
|
12995
|
+
});
|
|
12996
|
+
};
|
|
12997
|
+
PopoverRoot.displayName = "PopoverRoot_UI";
|
|
12998
|
+
//#endregion
|
|
12999
|
+
//#region src/components/Popover/PopoverTrigger.tsx
|
|
13000
|
+
/**
|
|
13001
|
+
* The button that toggles the popover open and closed. By default it renders a
|
|
13002
|
+
* `<button>` wrapping its children; pass `render` to merge the trigger
|
|
13003
|
+
* behavior onto a single child element (e.g. a `Button` or `IconButton`).
|
|
13004
|
+
*/
|
|
13005
|
+
const PopoverTrigger = forwardRef(({ nativeButton = true, ...props }, forwardedRef) => /* @__PURE__ */ jsx(Popover$1.Trigger, {
|
|
13006
|
+
ref: forwardedRef,
|
|
13007
|
+
nativeButton,
|
|
13008
|
+
...props
|
|
13009
|
+
}));
|
|
13010
|
+
PopoverTrigger.displayName = "PopoverTrigger_UI";
|
|
12908
13011
|
//#endregion
|
|
12909
13012
|
//#region src/components/ProgressBar/ProgressBar.tsx
|
|
12910
13013
|
const ProgressBarWrapper = styled.div`
|
|
@@ -12914,10 +13017,10 @@ const ProgressBarWrapper = styled.div`
|
|
|
12914
13017
|
align-items: center;
|
|
12915
13018
|
gap: var(--wui-space-02);
|
|
12916
13019
|
`;
|
|
12917
|
-
const
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
13020
|
+
const StyledTrack = styled(Progress.Track)`
|
|
13021
|
+
height: 100%;
|
|
13022
|
+
overflow: hidden;
|
|
13023
|
+
`;
|
|
12921
13024
|
const ProgressBarLabel = styled.div`
|
|
12922
13025
|
display: flex;
|
|
12923
13026
|
line-height: var(--wui-typography-label-3-line-height);
|
|
@@ -12926,17 +13029,15 @@ const ProgressBarLabel = styled.div`
|
|
|
12926
13029
|
color: var(--wui-color-text-secondary);
|
|
12927
13030
|
flex-shrink: 0;
|
|
12928
13031
|
`;
|
|
12929
|
-
const StyledProgressIndicator = styled(Indicator)`
|
|
13032
|
+
const StyledProgressIndicator = styled(Progress.Indicator)`
|
|
12930
13033
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
12931
13034
|
background-color: var(--wui-color-bg-fill);
|
|
12932
|
-
|
|
12933
|
-
height: 100%;
|
|
13035
|
+
display: block;
|
|
12934
13036
|
border-top-right-radius: var(--wui-border-radius-rounded);
|
|
12935
13037
|
border-bottom-right-radius: var(--wui-border-radius-rounded);
|
|
12936
|
-
transition:
|
|
12937
|
-
transform: ${({ $progress, $max }) => getTranslateValue($progress, $max)};
|
|
13038
|
+
transition: width 660ms cubic-bezier(0.65, 0, 0.35, 1);
|
|
12938
13039
|
`;
|
|
12939
|
-
const StyledProgressBar = styled(Root
|
|
13040
|
+
const StyledProgressBar = styled(Progress.Root)`
|
|
12940
13041
|
${({ $colorScheme }) => getColorScheme($colorScheme)}
|
|
12941
13042
|
position: relative;
|
|
12942
13043
|
overflow: hidden;
|
|
@@ -12956,14 +13057,11 @@ const ProgressBar = ({ progress, max = 100, children, labelLeft, labelRight, col
|
|
|
12956
13057
|
isNotNil(labelLeft) ? /* @__PURE__ */ jsx(ProgressBarLabel, { children: labelLeft }) : null,
|
|
12957
13058
|
/* @__PURE__ */ jsx(StyledProgressBar, {
|
|
12958
13059
|
$colorScheme: colorScheme,
|
|
13060
|
+
getAriaValueText: (_formattedValue, value) => value != null ? `${Math.round(value / max * 100)}%` : "indeterminate progress",
|
|
12959
13061
|
max,
|
|
12960
13062
|
value: progress,
|
|
12961
13063
|
...props,
|
|
12962
|
-
children: /* @__PURE__ */ jsx(StyledProgressIndicator, {
|
|
12963
|
-
$colorScheme: colorScheme,
|
|
12964
|
-
$max: max,
|
|
12965
|
-
$progress: progress
|
|
12966
|
-
})
|
|
13064
|
+
children: /* @__PURE__ */ jsx(StyledTrack, { children: /* @__PURE__ */ jsx(StyledProgressIndicator, { $colorScheme: colorScheme }) })
|
|
12967
13065
|
}),
|
|
12968
13066
|
isNotNil(labelRight) ? /* @__PURE__ */ jsx(ProgressBarLabel, { children: labelRight }) : null
|
|
12969
13067
|
] });
|
|
@@ -13545,7 +13643,7 @@ const segmentedControlStyles = css`
|
|
|
13545
13643
|
position: relative;
|
|
13546
13644
|
width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
|
|
13547
13645
|
`;
|
|
13548
|
-
const StyledSegmentedControl = styled(
|
|
13646
|
+
const StyledSegmentedControl = styled(ToggleGroup)`
|
|
13549
13647
|
${segmentedControlStyles}
|
|
13550
13648
|
`;
|
|
13551
13649
|
/**
|
|
@@ -13558,11 +13656,11 @@ const SegmentedControl = forwardRef(({ children, colorScheme = "inherit", disabl
|
|
|
13558
13656
|
$colorScheme: colorScheme,
|
|
13559
13657
|
$fullWidth: fullWidth,
|
|
13560
13658
|
disabled,
|
|
13561
|
-
|
|
13562
|
-
onValueChange:
|
|
13563
|
-
|
|
13564
|
-
|
|
13565
|
-
value: selectedValue,
|
|
13659
|
+
loopFocus: true,
|
|
13660
|
+
onValueChange: (newValue) => {
|
|
13661
|
+
if (newValue.length > 0 && newValue[0] !== void 0) onSelectedValueChange(newValue[0]);
|
|
13662
|
+
},
|
|
13663
|
+
value: [selectedValue],
|
|
13566
13664
|
...props,
|
|
13567
13665
|
children: /* @__PURE__ */ jsx(SegmentedControlValueProvider, {
|
|
13568
13666
|
value: selectedValue,
|
|
@@ -13574,7 +13672,7 @@ SegmentedControl.displayName = "SegmentedControl_UI";
|
|
|
13574
13672
|
//#endregion
|
|
13575
13673
|
//#region src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
13576
13674
|
const segmentedControlItemStyles = css`
|
|
13577
|
-
all: unset;
|
|
13675
|
+
all: unset;
|
|
13578
13676
|
align-items: center;
|
|
13579
13677
|
border-radius: var(--wui-border-radius-rounded);
|
|
13580
13678
|
color: var(--wui-color-text-secondary);
|
|
@@ -13608,10 +13706,11 @@ const segmentedControlItemStyles = css`
|
|
|
13608
13706
|
/* note: react-toggle-group uses 'aria-selected' and react-tabs uses "active" */
|
|
13609
13707
|
|
|
13610
13708
|
/* we can't style off of 'data-state' since that gets overridden when wrapped in a Tooltip */
|
|
13611
|
-
&:hover:not([aria-checked='true'], [aria-selected='true']) {
|
|
13709
|
+
&:hover:not([aria-pressed='true'], [aria-checked='true'], [aria-selected='true']) {
|
|
13612
13710
|
background-color: var(--wui-color-bg-surface-secondary-hover);
|
|
13613
13711
|
}
|
|
13614
13712
|
|
|
13713
|
+
&[aria-pressed='true'],
|
|
13615
13714
|
&[aria-checked='true'],
|
|
13616
13715
|
&[aria-selected='true'] {
|
|
13617
13716
|
color: var(--wui-color-segmented-color-text-override, var(--wui-color-text-selected));
|
|
@@ -13641,7 +13740,7 @@ const segmentedControlItemStyles = css`
|
|
|
13641
13740
|
}
|
|
13642
13741
|
}
|
|
13643
13742
|
`;
|
|
13644
|
-
const StyledSegmentedControlItem = styled(
|
|
13743
|
+
const StyledSegmentedControlItem = styled(Toggle)`
|
|
13645
13744
|
${segmentedControlItemStyles}
|
|
13646
13745
|
`;
|
|
13647
13746
|
const SegmentedControlItem = forwardRef(({ disabled, icon, label, "aria-label": ariaLabel, value, ...otherProps }, forwardedRef) => {
|
|
@@ -13650,8 +13749,7 @@ const SegmentedControlItem = forwardRef(({ disabled, icon, label, "aria-label":
|
|
|
13650
13749
|
const buttonRef = useRef(null);
|
|
13651
13750
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
13652
13751
|
const handleClick = (event) => {
|
|
13653
|
-
|
|
13654
|
-
if (state === "on") event.preventDefault();
|
|
13752
|
+
if (event.currentTarget.getAttribute("aria-pressed") === "true") event.preventDefault();
|
|
13655
13753
|
};
|
|
13656
13754
|
useEffect(() => {
|
|
13657
13755
|
const buttonElem = buttonRef.current;
|
|
@@ -13692,7 +13790,7 @@ const SegmentedControlItem = forwardRef(({ disabled, icon, label, "aria-label":
|
|
|
13692
13790
|
SegmentedControlItem.displayName = "SegmentedControlItem_UI";
|
|
13693
13791
|
//#endregion
|
|
13694
13792
|
//#region src/components/Select/Select.tsx
|
|
13695
|
-
const StyledTrigger = styled(Trigger
|
|
13793
|
+
const StyledTrigger = styled(Select$1.Trigger)`
|
|
13696
13794
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
13697
13795
|
${inputCss};
|
|
13698
13796
|
padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
|
|
@@ -13738,7 +13836,7 @@ const StyledTrigger = styled(Trigger$4)`
|
|
|
13738
13836
|
color: var(--wui-input-placeholder);
|
|
13739
13837
|
}
|
|
13740
13838
|
`;
|
|
13741
|
-
const
|
|
13839
|
+
const StyledPopup = styled(Select$1.Popup)`
|
|
13742
13840
|
--wui-select-content-border: var(--wui-color-border);
|
|
13743
13841
|
--wui-select-content-bg: var(--wui-color-bg-surface);
|
|
13744
13842
|
--wui-select-content-border-radius: var(--wui-border-radius-02);
|
|
@@ -13752,8 +13850,8 @@ const StyledContent = styled(Content$5)`
|
|
|
13752
13850
|
border-radius: var(--wui-select-content-border-radius);
|
|
13753
13851
|
box-shadow: var(--wui-elevation-01);
|
|
13754
13852
|
padding: var(--wui-select-option-padding);
|
|
13755
|
-
min-width: var(--
|
|
13756
|
-
max-height: var(--
|
|
13853
|
+
min-width: var(--anchor-width);
|
|
13854
|
+
max-height: var(--available-height);
|
|
13757
13855
|
z-index: var(--wui-zindex-select);
|
|
13758
13856
|
|
|
13759
13857
|
[role='separator'] {
|
|
@@ -13765,55 +13863,87 @@ const scrollButtonStyles = css`
|
|
|
13765
13863
|
display: flex;
|
|
13766
13864
|
justify-content: center;
|
|
13767
13865
|
`;
|
|
13768
|
-
const
|
|
13866
|
+
const StyledScrollDownArrow = styled(Select$1.ScrollDownArrow)`
|
|
13769
13867
|
${scrollButtonStyles}
|
|
13770
13868
|
`;
|
|
13771
|
-
const
|
|
13869
|
+
const StyledScrollUpArrow = styled(Select$1.ScrollUpArrow)`
|
|
13772
13870
|
${scrollButtonStyles}
|
|
13773
13871
|
`;
|
|
13774
13872
|
/**
|
|
13873
|
+
* Walks the React children tree to build a value→label mapping for Base UI's `items` prop.
|
|
13874
|
+
* This ensures `Select.Value` displays the label text instead of the raw value.
|
|
13875
|
+
*/
|
|
13876
|
+
const collectItemLabels = (children) => {
|
|
13877
|
+
const items = [];
|
|
13878
|
+
Children.forEach(children, (child) => {
|
|
13879
|
+
if (!isValidElement(child)) return;
|
|
13880
|
+
const { value, selectedDisplayValue, children: childChildren, textValue } = child.props;
|
|
13881
|
+
if (typeof value === "string") {
|
|
13882
|
+
if (selectedDisplayValue !== void 0 && selectedDisplayValue !== null) items.push({
|
|
13883
|
+
value,
|
|
13884
|
+
label: selectedDisplayValue
|
|
13885
|
+
});
|
|
13886
|
+
else if (typeof childChildren === "string") items.push({
|
|
13887
|
+
value,
|
|
13888
|
+
label: childChildren
|
|
13889
|
+
});
|
|
13890
|
+
else if (typeof textValue === "string") items.push({
|
|
13891
|
+
value,
|
|
13892
|
+
label: textValue
|
|
13893
|
+
});
|
|
13894
|
+
return;
|
|
13895
|
+
}
|
|
13896
|
+
if (childChildren !== void 0 && childChildren !== null) items.push(...collectItemLabels(childChildren));
|
|
13897
|
+
});
|
|
13898
|
+
return items;
|
|
13899
|
+
};
|
|
13900
|
+
/**
|
|
13775
13901
|
* Display a list of options and choose one of them. Replacement for the native Select HTML element.
|
|
13776
13902
|
*/
|
|
13777
|
-
const Select = forwardRef(({ colorScheme = "inherit", children, onOpenChange = () => null, onChange = () => null, placeholder = "Select...", fullWidth = false, forceOpen = false, ...props }, forwardedRef) => {
|
|
13903
|
+
const Select = forwardRef(({ colorScheme = "inherit", children, onOpenChange = () => null, onChange = () => null, placeholder = "Select...", fullWidth = false, forceOpen = false, disabled, value, "aria-invalid": ariaInvalid, ...props }, forwardedRef) => {
|
|
13778
13904
|
const responsiveFullWidth = useResponsiveProp(fullWidth);
|
|
13779
13905
|
const rootProps = {
|
|
13780
|
-
|
|
13906
|
+
disabled,
|
|
13907
|
+
items: useMemo(() => collectItemLabels(children), [children]),
|
|
13781
13908
|
onOpenChange,
|
|
13782
|
-
onValueChange: onChange
|
|
13909
|
+
onValueChange: onChange,
|
|
13910
|
+
value
|
|
13783
13911
|
};
|
|
13784
13912
|
if (forceOpen) rootProps["open"] = true;
|
|
13785
|
-
return /* @__PURE__ */ jsxs(Root
|
|
13913
|
+
return /* @__PURE__ */ jsxs(Select$1.Root, {
|
|
13786
13914
|
...rootProps,
|
|
13787
13915
|
children: [/* @__PURE__ */ jsxs(StyledTrigger, {
|
|
13788
13916
|
ref: forwardedRef,
|
|
13789
13917
|
$colorScheme: colorScheme,
|
|
13790
13918
|
$fullWidth: responsiveFullWidth,
|
|
13919
|
+
"aria-invalid": ariaInvalid,
|
|
13791
13920
|
...props,
|
|
13792
|
-
children: [/* @__PURE__ */ jsx(Value, { placeholder }), /* @__PURE__ */ jsx(Icon, {
|
|
13921
|
+
children: [/* @__PURE__ */ jsx(Select$1.Value, { placeholder }), /* @__PURE__ */ jsx(Icon, {
|
|
13793
13922
|
size: "md",
|
|
13794
13923
|
type: "caret-down"
|
|
13795
13924
|
})]
|
|
13796
|
-
}), /* @__PURE__ */ jsx(Portal
|
|
13797
|
-
|
|
13925
|
+
}), /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
|
|
13926
|
+
align: "start",
|
|
13927
|
+
alignItemWithTrigger: false,
|
|
13798
13928
|
sideOffset: 8,
|
|
13799
|
-
children: [
|
|
13800
|
-
/* @__PURE__ */ jsx(
|
|
13929
|
+
children: /* @__PURE__ */ jsxs(StyledPopup, { children: [
|
|
13930
|
+
/* @__PURE__ */ jsx(StyledScrollUpArrow, { children: /* @__PURE__ */ jsx(Icon, {
|
|
13801
13931
|
size: "sm",
|
|
13802
13932
|
type: "caret-up"
|
|
13803
13933
|
}) }),
|
|
13804
|
-
|
|
13805
|
-
/* @__PURE__ */ jsx(
|
|
13934
|
+
children,
|
|
13935
|
+
/* @__PURE__ */ jsx(StyledScrollDownArrow, { children: /* @__PURE__ */ jsx(Icon, {
|
|
13806
13936
|
size: "sm",
|
|
13807
13937
|
type: "caret-down"
|
|
13808
13938
|
}) })
|
|
13809
|
-
]
|
|
13939
|
+
] })
|
|
13810
13940
|
}) })]
|
|
13811
13941
|
});
|
|
13812
13942
|
});
|
|
13813
13943
|
Select.displayName = "Select_UI";
|
|
13814
13944
|
//#endregion
|
|
13815
13945
|
//#region src/components/Select/SelectOption.tsx
|
|
13816
|
-
const StyledItem = styled(Item
|
|
13946
|
+
const StyledItem = styled(Select$1.Item)`
|
|
13817
13947
|
${getTypographicStyles("label3")}
|
|
13818
13948
|
align-items: ${({ $checkmarkVerticalAlign }) => $checkmarkVerticalAlign === "center" ? "center" : "flex-start"};
|
|
13819
13949
|
background-color: transparent;
|
|
@@ -13839,15 +13969,17 @@ const StyledItem = styled(Item$2)`
|
|
|
13839
13969
|
background-color: transparent;
|
|
13840
13970
|
}
|
|
13841
13971
|
`;
|
|
13842
|
-
const SelectOption = forwardRef(({ children, selectedDisplayValue, checkmarkVerticalAlign = "center", ...props }, forwardedRef) => {
|
|
13972
|
+
const SelectOption = forwardRef(({ children, selectedDisplayValue, checkmarkVerticalAlign = "center", textValue, ...props }, forwardedRef) => {
|
|
13973
|
+
const label = typeof children === "string" ? children : textValue;
|
|
13843
13974
|
return /* @__PURE__ */ jsxs(StyledItem, {
|
|
13844
13975
|
...props,
|
|
13845
13976
|
ref: forwardedRef,
|
|
13846
13977
|
$checkmarkVerticalAlign: checkmarkVerticalAlign,
|
|
13978
|
+
...label != null ? { label } : {},
|
|
13847
13979
|
children: [isNotNil(selectedDisplayValue) ? /* @__PURE__ */ jsxs("div", { children: [children, /* @__PURE__ */ jsx("div", {
|
|
13848
13980
|
style: { display: "none" },
|
|
13849
|
-
children: /* @__PURE__ */ jsx(ItemText, { children: selectedDisplayValue })
|
|
13850
|
-
})] }) : /* @__PURE__ */ jsx(ItemText, { children }), /* @__PURE__ */ jsx(ItemIndicator, { children: /* @__PURE__ */ jsx(Icon, {
|
|
13981
|
+
children: /* @__PURE__ */ jsx(Select$1.ItemText, { children: selectedDisplayValue })
|
|
13982
|
+
})] }) : /* @__PURE__ */ jsx(Select$1.ItemText, { children }), /* @__PURE__ */ jsx(Select$1.ItemIndicator, { children: /* @__PURE__ */ jsx(Icon, {
|
|
13851
13983
|
size: "md",
|
|
13852
13984
|
type: "checkmark"
|
|
13853
13985
|
}) })]
|
|
@@ -13856,11 +13988,11 @@ const SelectOption = forwardRef(({ children, selectedDisplayValue, checkmarkVert
|
|
|
13856
13988
|
SelectOption.displayName = "SelectOption_UI";
|
|
13857
13989
|
//#endregion
|
|
13858
13990
|
//#region src/components/Select/SelectOptionGroup.tsx
|
|
13859
|
-
const StyledLabel = styled(
|
|
13991
|
+
const StyledLabel = styled(Select$1.GroupLabel)`
|
|
13860
13992
|
padding: var(--wui-select-option-padding);
|
|
13861
13993
|
`;
|
|
13862
13994
|
const SelectOptionGroup = ({ children, label, ...props }) => {
|
|
13863
|
-
return /* @__PURE__ */ jsxs(Group, {
|
|
13995
|
+
return /* @__PURE__ */ jsxs(Select$1.Group, {
|
|
13864
13996
|
...props,
|
|
13865
13997
|
children: [/* @__PURE__ */ jsx(StyledLabel, { children: /* @__PURE__ */ jsx(Heading, {
|
|
13866
13998
|
renderAs: "span",
|
|
@@ -13872,6 +14004,8 @@ const SelectOptionGroup = ({ children, label, ...props }) => {
|
|
|
13872
14004
|
//#endregion
|
|
13873
14005
|
//#region src/components/Slider/Slider.tsx
|
|
13874
14006
|
const SliderContainer = styled.div`
|
|
14007
|
+
width: 100%;
|
|
14008
|
+
|
|
13875
14009
|
--wui-slider-track-color: var(--wui-gray-6);
|
|
13876
14010
|
--wui-slider-track-border-radius: var(--wui-border-radius-rounded);
|
|
13877
14011
|
--wui-slider-range-color: var(--wui-color-bg-fill);
|
|
@@ -13887,28 +14021,28 @@ const SliderContainer = styled.div`
|
|
|
13887
14021
|
pointer-events: none;
|
|
13888
14022
|
}
|
|
13889
14023
|
`;
|
|
13890
|
-
const StyledSliderRoot = styled(Root
|
|
13891
|
-
|
|
14024
|
+
const StyledSliderRoot = styled(Slider$1.Root)`
|
|
14025
|
+
width: 100%;
|
|
14026
|
+
`;
|
|
14027
|
+
const StyledSliderControl = styled(Slider$1.Control)`
|
|
13892
14028
|
display: flex;
|
|
13893
14029
|
align-items: center;
|
|
13894
14030
|
user-select: none;
|
|
13895
14031
|
touch-action: none;
|
|
13896
14032
|
width: 100%;
|
|
13897
14033
|
`;
|
|
13898
|
-
const StyledSliderTrack = styled(Track)`
|
|
14034
|
+
const StyledSliderTrack = styled(Slider$1.Track)`
|
|
13899
14035
|
background-color: var(--wui-slider-track-color);
|
|
13900
14036
|
border-radius: var(--wui-slider-track-border-radius);
|
|
13901
|
-
|
|
14037
|
+
width: 100%;
|
|
13902
14038
|
height: 6px;
|
|
13903
14039
|
position: relative;
|
|
13904
14040
|
`;
|
|
13905
|
-
const
|
|
14041
|
+
const StyledSliderIndicator = styled(Slider$1.Indicator)`
|
|
13906
14042
|
background-color: var(--wui-slider-range-color);
|
|
13907
14043
|
border-radius: var(--wui-slider-track-border-radius);
|
|
13908
|
-
height: 100%;
|
|
13909
|
-
position: absolute;
|
|
13910
14044
|
`;
|
|
13911
|
-
const StyledSliderThumb = styled(Thumb)`
|
|
14045
|
+
const StyledSliderThumb = styled(Slider$1.Thumb)`
|
|
13912
14046
|
background-color: var(--wui-slider-thumb-color);
|
|
13913
14047
|
border-radius: var(--wui-border-radius-rounded);
|
|
13914
14048
|
cursor: grab;
|
|
@@ -13929,22 +14063,25 @@ const StyledSliderThumb = styled(Thumb)`
|
|
|
13929
14063
|
transition-timing-function: var(--wui-motion-ease-in);
|
|
13930
14064
|
}
|
|
13931
14065
|
|
|
13932
|
-
&:focus-visible {
|
|
14066
|
+
&:has(input:focus-visible) {
|
|
13933
14067
|
outline-color: var(--wui-color-focus-ring);
|
|
13934
14068
|
outline-offset: -1px;
|
|
13935
14069
|
outline-width: 2px;
|
|
13936
14070
|
}
|
|
13937
14071
|
`;
|
|
13938
|
-
const Slider = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, disabled = false, initialValue = [0], max = 100, min = 0, onChange,
|
|
14072
|
+
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 }) => {
|
|
13939
14073
|
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.");
|
|
13940
14074
|
const values = value ?? initialValue;
|
|
13941
14075
|
const handleValueChange = (newValue) => {
|
|
13942
|
-
if (onChange) onChange(newValue);
|
|
14076
|
+
if (onChange) onChange(typeof newValue === "number" ? [newValue] : [...newValue]);
|
|
14077
|
+
};
|
|
14078
|
+
const handleValueCommitted = (newValue) => {
|
|
14079
|
+
if (onValueCommitted) onValueCommitted(typeof newValue === "number" ? [newValue] : [...newValue]);
|
|
13943
14080
|
};
|
|
13944
14081
|
return /* @__PURE__ */ jsx(SliderContainer, {
|
|
13945
14082
|
...otherProps,
|
|
13946
14083
|
"data-testid": dataTestId,
|
|
13947
|
-
children: /* @__PURE__ */
|
|
14084
|
+
children: /* @__PURE__ */ jsx(StyledSliderRoot, {
|
|
13948
14085
|
"aria-label": ariaLabel,
|
|
13949
14086
|
"aria-labelledby": ariaLabelledby,
|
|
13950
14087
|
defaultValue: initialValue,
|
|
@@ -13952,13 +14089,13 @@ const Slider = ({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, di
|
|
|
13952
14089
|
max,
|
|
13953
14090
|
min,
|
|
13954
14091
|
onValueChange: handleValueChange,
|
|
14092
|
+
onValueCommitted: handleValueCommitted,
|
|
13955
14093
|
step,
|
|
13956
|
-
...onValueCommit ? { onValueCommit } : {},
|
|
13957
14094
|
...value ? { value } : {},
|
|
13958
|
-
children:
|
|
14095
|
+
children: /* @__PURE__ */ jsx(StyledSliderControl, { children: /* @__PURE__ */ jsxs(StyledSliderTrack, {
|
|
13959
14096
|
"data-testid": `${dataTestId}-track`,
|
|
13960
|
-
children: /* @__PURE__ */ jsx(
|
|
13961
|
-
})
|
|
14097
|
+
children: [/* @__PURE__ */ jsx(StyledSliderIndicator, { "data-testid": `${dataTestId}-range` }), values.map((_, index) => /* @__PURE__ */ jsx(StyledSliderThumb, { "data-testid": `${dataTestId}-thumb-${index}` }, `thumb-${index}`))]
|
|
14098
|
+
}) })
|
|
13962
14099
|
})
|
|
13963
14100
|
});
|
|
13964
14101
|
};
|
|
@@ -13976,7 +14113,7 @@ const StyledSplitButton = styled.span`
|
|
|
13976
14113
|
padding-right: 0;
|
|
13977
14114
|
}
|
|
13978
14115
|
|
|
13979
|
-
> [data-wui-button='true']:
|
|
14116
|
+
> [data-wui-button='true']:not(:first-child) {
|
|
13980
14117
|
border-top-left-radius: 0;
|
|
13981
14118
|
border-bottom-left-radius: 0;
|
|
13982
14119
|
display: inline-flex;
|
|
@@ -14158,18 +14295,22 @@ const useTabsValue = () => {
|
|
|
14158
14295
|
//#endregion
|
|
14159
14296
|
//#region src/components/Tabs/Tabs.tsx
|
|
14160
14297
|
const Tabs = ({ children, value: valueProp, onValueChange: onValueChangeProp, defaultValue, ...props }) => {
|
|
14161
|
-
const [
|
|
14298
|
+
const [internalValue, setInternalValue] = useState(valueProp ?? defaultValue);
|
|
14299
|
+
const isControlled = isNotNil(valueProp);
|
|
14300
|
+
const value = isControlled ? valueProp : internalValue;
|
|
14162
14301
|
const onValueChange = useCallback((newValue) => {
|
|
14163
|
-
|
|
14164
|
-
|
|
14302
|
+
if (newValue !== null) {
|
|
14303
|
+
setInternalValue(newValue);
|
|
14304
|
+
if (onValueChangeProp) onValueChangeProp(newValue);
|
|
14305
|
+
}
|
|
14165
14306
|
}, [onValueChangeProp]);
|
|
14166
14307
|
const rootProps = {
|
|
14167
14308
|
...props,
|
|
14168
14309
|
onValueChange
|
|
14169
14310
|
};
|
|
14170
14311
|
if (isNotNil(value)) rootProps.value = value;
|
|
14171
|
-
if (isNotNil(defaultValue)) rootProps.defaultValue = defaultValue;
|
|
14172
|
-
return /* @__PURE__ */ jsx(Root
|
|
14312
|
+
if (!isControlled && isNotNil(defaultValue)) rootProps.defaultValue = defaultValue;
|
|
14313
|
+
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
14173
14314
|
...rootProps,
|
|
14174
14315
|
children: /* @__PURE__ */ jsx(TabsValueProvider, {
|
|
14175
14316
|
value: value ?? defaultValue,
|
|
@@ -14181,7 +14322,7 @@ Tabs.displayName = "Tabs_UI";
|
|
|
14181
14322
|
//#endregion
|
|
14182
14323
|
//#region src/components/Tabs/TabsContent.tsx
|
|
14183
14324
|
const TabsContent = ({ children, value }) => {
|
|
14184
|
-
return /* @__PURE__ */ jsx(
|
|
14325
|
+
return /* @__PURE__ */ jsx(Tabs$1.Panel, {
|
|
14185
14326
|
value,
|
|
14186
14327
|
children
|
|
14187
14328
|
});
|
|
@@ -14206,7 +14347,7 @@ const SelectedTabIndicator = () => {
|
|
|
14206
14347
|
};
|
|
14207
14348
|
//#endregion
|
|
14208
14349
|
//#region src/components/Tabs/TabsList.tsx
|
|
14209
|
-
const StyledTabsList = styled(
|
|
14350
|
+
const StyledTabsList = styled(Tabs$1.List)`
|
|
14210
14351
|
${segmentedControlStyles}
|
|
14211
14352
|
`;
|
|
14212
14353
|
const TabsList = ({ children, fullWidth = true, ...props }) => {
|
|
@@ -14219,7 +14360,7 @@ const TabsList = ({ children, fullWidth = true, ...props }) => {
|
|
|
14219
14360
|
TabsList.displayName = "TabsList_UI";
|
|
14220
14361
|
//#endregion
|
|
14221
14362
|
//#region src/components/Tabs/StyledTabsTrigger.tsx
|
|
14222
|
-
const StyledTabsTrigger = styled(
|
|
14363
|
+
const StyledTabsTrigger = styled(Tabs$1.Tab)`
|
|
14223
14364
|
${segmentedControlItemStyles}
|
|
14224
14365
|
|
|
14225
14366
|
&:focus-visible {
|