@wistia/ui 2.8.0-beta.1fa4b2dd.2335dfd → 2.8.0-beta.26ca2b16.7aaa7e9
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 +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +179 -95
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v2.8.0-beta.
|
|
3
|
+
* @license @wistia/ui v2.8.0-beta.26ca2b16.7aaa7e9
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -16,7 +16,7 @@ import { Toaster, toast } from "sonner";
|
|
|
16
16
|
import { getValueAndUnit } from "polished";
|
|
17
17
|
import { useFilePicker as useFilePicker$1, useImperativeFilePicker as useImperativeFilePicker$1 } from "use-file-picker";
|
|
18
18
|
import { FileAmountLimitValidator, FileSizeValidator, FileTypeValidator, ImageDimensionsValidator, PersistentFileAmountLimitValidator } from "use-file-picker/validators";
|
|
19
|
-
import { debounce
|
|
19
|
+
import { debounce } from "throttle-debounce";
|
|
20
20
|
import { Link as Link$1, useInRouterContext } from "react-router";
|
|
21
21
|
import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
|
|
22
22
|
import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
|
|
@@ -37,6 +37,7 @@ import { PreviewCard as PreviewCard$1 } from "@base-ui/react/preview-card";
|
|
|
37
37
|
import ReactMarkdown from "react-markdown";
|
|
38
38
|
import { Dialog } from "@base-ui/react/dialog";
|
|
39
39
|
import { Progress } from "@base-ui/react/progress";
|
|
40
|
+
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
40
41
|
import { Select as Select$1 } from "@base-ui/react/select";
|
|
41
42
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
42
43
|
//#region src/components/ClickRegion/globalStyles.tsx
|
|
@@ -8733,7 +8734,7 @@ const useColorPickerState = () => {
|
|
|
8733
8734
|
};
|
|
8734
8735
|
//#endregion
|
|
8735
8736
|
//#region src/components/ColorPicker/ColorGrid.tsx
|
|
8736
|
-
const Container$
|
|
8737
|
+
const Container$8 = styled.div`
|
|
8737
8738
|
display: grid;
|
|
8738
8739
|
gap: var(--wui-space-01);
|
|
8739
8740
|
grid-template-columns: minmax(0, 1fr);
|
|
@@ -8762,7 +8763,7 @@ const ColorGrid = ({ children, label }) => {
|
|
|
8762
8763
|
commitValue(value);
|
|
8763
8764
|
}
|
|
8764
8765
|
}, [commitValue, onChangeNonDerivedValueAsHsv]);
|
|
8765
|
-
return /* @__PURE__ */ jsxs(Container$
|
|
8766
|
+
return /* @__PURE__ */ jsxs(Container$8, { children: [label != null && /* @__PURE__ */ jsx(LabelContainer$1, { children: /* @__PURE__ */ jsx(Label, { children: label }) }), /* @__PURE__ */ jsx(ItemsContainer$1, {
|
|
8766
8767
|
onValueChange,
|
|
8767
8768
|
value: valueAsHex,
|
|
8768
8769
|
children
|
|
@@ -8968,7 +8969,7 @@ const ColorSwatch = ({ children, diameterPx = 24, isSelected = false, derivative
|
|
|
8968
8969
|
};
|
|
8969
8970
|
//#endregion
|
|
8970
8971
|
//#region src/components/ColorPicker/ColorGridOption.tsx
|
|
8971
|
-
const Container$
|
|
8972
|
+
const Container$7 = styled(Radio$1.Root)`
|
|
8972
8973
|
border: none;
|
|
8973
8974
|
appearance: none;
|
|
8974
8975
|
outline: none;
|
|
@@ -8992,7 +8993,7 @@ const ColorGridOption = ({ value: rawValue, name }) => {
|
|
|
8992
8993
|
style: { fontFamily: "var(--wui-typography-family-mono)" },
|
|
8993
8994
|
children: value
|
|
8994
8995
|
}),
|
|
8995
|
-
children: /* @__PURE__ */ jsx(Container$
|
|
8996
|
+
children: /* @__PURE__ */ jsx(Container$7, {
|
|
8996
8997
|
"aria-label": value,
|
|
8997
8998
|
"aria-selected": valueAsHex === value,
|
|
8998
8999
|
role: "option",
|
|
@@ -9009,7 +9010,7 @@ const ColorGridOption = ({ value: rawValue, name }) => {
|
|
|
9009
9010
|
ColorGridOption.displayName = "ColorGridOption_UI";
|
|
9010
9011
|
//#endregion
|
|
9011
9012
|
//#region src/components/ColorPicker/ColorList.tsx
|
|
9012
|
-
const Container$
|
|
9013
|
+
const Container$6 = styled(ToggleGroup)`
|
|
9013
9014
|
display: grid;
|
|
9014
9015
|
grid-template-columns: minmax(0, 1fr);
|
|
9015
9016
|
`;
|
|
@@ -9027,7 +9028,7 @@ const ColorList = ({ children }) => {
|
|
|
9027
9028
|
onChangeNonDerivedValueAsHsv(hsv);
|
|
9028
9029
|
commitValue(value);
|
|
9029
9030
|
}, [commitValue, onChangeNonDerivedValueAsHsv]);
|
|
9030
|
-
return /* @__PURE__ */ jsx(Container$
|
|
9031
|
+
return /* @__PURE__ */ jsx(Container$6, {
|
|
9031
9032
|
onValueChange,
|
|
9032
9033
|
value: [valueAsHex],
|
|
9033
9034
|
children
|
|
@@ -9036,7 +9037,7 @@ const ColorList = ({ children }) => {
|
|
|
9036
9037
|
ColorList.displayName = "ColorList_UI";
|
|
9037
9038
|
//#endregion
|
|
9038
9039
|
//#region src/components/ColorPicker/ColorListGroup.tsx
|
|
9039
|
-
const Container$
|
|
9040
|
+
const Container$5 = styled.div`
|
|
9040
9041
|
display: grid;
|
|
9041
9042
|
gap: var(--wui-space-01);
|
|
9042
9043
|
grid-template-columns: minmax(0, 1fr);
|
|
@@ -9052,7 +9053,7 @@ const LabelContainer = styled.div`
|
|
|
9052
9053
|
* Groups `ColorListOption` items under a labeled heading within a `ColorList`.
|
|
9053
9054
|
*/
|
|
9054
9055
|
const ColorListGroup = ({ label, children }) => {
|
|
9055
|
-
return /* @__PURE__ */ jsxs(Container$
|
|
9056
|
+
return /* @__PURE__ */ jsxs(Container$5, {
|
|
9056
9057
|
"aria-label": label,
|
|
9057
9058
|
role: "group",
|
|
9058
9059
|
children: [/* @__PURE__ */ jsx(LabelContainer, { children: /* @__PURE__ */ jsx(Label, { children: label }) }), /* @__PURE__ */ jsx(ItemsContainer, { children })]
|
|
@@ -9081,7 +9082,7 @@ const ColorNameOrHexCode = ({ name, hexCode }) => {
|
|
|
9081
9082
|
};
|
|
9082
9083
|
//#endregion
|
|
9083
9084
|
//#region src/components/ColorPicker/ColorListOption.tsx
|
|
9084
|
-
const Container$
|
|
9085
|
+
const Container$4 = styled(Toggle)`
|
|
9085
9086
|
border: none;
|
|
9086
9087
|
appearance: none;
|
|
9087
9088
|
outline: none;
|
|
@@ -9112,7 +9113,7 @@ const ColorListOption = ({ value: rawValue, name }) => {
|
|
|
9112
9113
|
const { valueAsHsv, nonDerivedValueAsHex } = useColorPickerState();
|
|
9113
9114
|
const valueAsHex = formatHex(valueAsHsv);
|
|
9114
9115
|
const isSelected = valueAsHex === value;
|
|
9115
|
-
return /* @__PURE__ */ jsxs(Container$
|
|
9116
|
+
return /* @__PURE__ */ jsxs(Container$4, {
|
|
9116
9117
|
"aria-label": value,
|
|
9117
9118
|
"aria-selected": valueAsHex === value,
|
|
9118
9119
|
role: "option",
|
|
@@ -9201,7 +9202,7 @@ const ColorPickerPopoverContent = ({ children }) => {
|
|
|
9201
9202
|
ColorPickerPopoverContent.displayName = "ColorPickerPopoverContent_UI";
|
|
9202
9203
|
//#endregion
|
|
9203
9204
|
//#region src/components/ColorPicker/ColorPickerSection.tsx
|
|
9204
|
-
const Container$
|
|
9205
|
+
const Container$3 = styled.div`
|
|
9205
9206
|
padding: var(--wui-space-02);
|
|
9206
9207
|
`;
|
|
9207
9208
|
/**
|
|
@@ -9209,7 +9210,7 @@ const Container$4 = styled.div`
|
|
|
9209
9210
|
* `ColorPickerPopoverContent`. Provides consistent spacing between sections.
|
|
9210
9211
|
*/
|
|
9211
9212
|
const ColorPickerSection = ({ children }) => {
|
|
9212
|
-
return /* @__PURE__ */ jsx(Container$
|
|
9213
|
+
return /* @__PURE__ */ jsx(Container$3, { children: /* @__PURE__ */ jsx(Stack, { children }) });
|
|
9213
9214
|
};
|
|
9214
9215
|
ColorPickerSection.displayName = "ColorPickerSection_UI";
|
|
9215
9216
|
//#endregion
|
|
@@ -9430,7 +9431,7 @@ const ContrastEnforcerSwitch = () => {
|
|
|
9430
9431
|
};
|
|
9431
9432
|
//#endregion
|
|
9432
9433
|
//#region src/components/ColorPicker/ContrastIndicator.tsx
|
|
9433
|
-
const Container$
|
|
9434
|
+
const Container$2 = styled.div`
|
|
9434
9435
|
display: flex;
|
|
9435
9436
|
flex-direction: row;
|
|
9436
9437
|
justify-content: end;
|
|
@@ -9455,7 +9456,7 @@ const ContrastIndicator = () => {
|
|
|
9455
9456
|
children: [floorToTenth(currentContrastRatio).toFixed(1), ":1"]
|
|
9456
9457
|
})
|
|
9457
9458
|
] });
|
|
9458
|
-
return /* @__PURE__ */ jsx(Container$
|
|
9459
|
+
return /* @__PURE__ */ jsx(Container$2, { children: isContrastSufficient ? /* @__PURE__ */ jsx(Badge, {
|
|
9459
9460
|
colorScheme: "success",
|
|
9460
9461
|
icon: /* @__PURE__ */ jsx(Icon, { type: "checkmark" }),
|
|
9461
9462
|
label,
|
|
@@ -9922,7 +9923,7 @@ const HSVHueCanvas = ({ hsv }) => {
|
|
|
9922
9923
|
};
|
|
9923
9924
|
//#endregion
|
|
9924
9925
|
//#region src/components/ColorPicker/HueSlider.tsx
|
|
9925
|
-
const Container$
|
|
9926
|
+
const Container$1 = styled.div`
|
|
9926
9927
|
border-radius: var(--wui-border-radius-rounded);
|
|
9927
9928
|
border: 1px solid var(--wui-color-border);
|
|
9928
9929
|
height: ${24}px;
|
|
@@ -9930,7 +9931,7 @@ const Container$2 = styled.div`
|
|
|
9930
9931
|
padding: 0 var(--wui-space-03);
|
|
9931
9932
|
position: relative;
|
|
9932
9933
|
`;
|
|
9933
|
-
const Root = styled(Slider$1.Root)`
|
|
9934
|
+
const Root$1 = styled(Slider$1.Root)`
|
|
9934
9935
|
align-items: center;
|
|
9935
9936
|
display: flex;
|
|
9936
9937
|
position: absolute;
|
|
@@ -9947,7 +9948,7 @@ const Control = styled(Slider$1.Control)`
|
|
|
9947
9948
|
const Track = styled(Slider$1.Track)`
|
|
9948
9949
|
width: 100%;
|
|
9949
9950
|
`;
|
|
9950
|
-
const Thumb$
|
|
9951
|
+
const Thumb$2 = styled(Slider$1.Thumb)`
|
|
9951
9952
|
position: relative;
|
|
9952
9953
|
`;
|
|
9953
9954
|
const ThumbInner = styled.div`
|
|
@@ -9962,7 +9963,7 @@ const ThumbInner = styled.div`
|
|
|
9962
9963
|
transform: translate(-50%, -50%);
|
|
9963
9964
|
width: 16px;
|
|
9964
9965
|
|
|
9965
|
-
${Thumb$
|
|
9966
|
+
${Thumb$2}:focus-visible > & {
|
|
9966
9967
|
box-shadow:
|
|
9967
9968
|
inset 0 0 0 2px var(--wui-color-border),
|
|
9968
9969
|
inset 0 0 0 3px black;
|
|
@@ -10000,10 +10001,10 @@ const HueSlider = (props) => {
|
|
|
10000
10001
|
h: newHue
|
|
10001
10002
|
});
|
|
10002
10003
|
}, [nonDerivedValueAsHsv, onChangeNonDerivedValueAsHsv]);
|
|
10003
|
-
return /* @__PURE__ */ jsxs(Container$
|
|
10004
|
+
return /* @__PURE__ */ jsxs(Container$1, {
|
|
10004
10005
|
...props,
|
|
10005
10006
|
style: containerStyle,
|
|
10006
|
-
children: [/* @__PURE__ */ jsx(Root, {
|
|
10007
|
+
children: [/* @__PURE__ */ jsx(Root$1, {
|
|
10007
10008
|
max: 360,
|
|
10008
10009
|
min: 0,
|
|
10009
10010
|
onValueChange: onHueChange,
|
|
@@ -10011,7 +10012,7 @@ const HueSlider = (props) => {
|
|
|
10011
10012
|
orientation: "horizontal",
|
|
10012
10013
|
step: 1,
|
|
10013
10014
|
value: [nonDerivedValueAsHsv.h ?? 0],
|
|
10014
|
-
children: /* @__PURE__ */ jsxs(Control, { children: [/* @__PURE__ */ jsx(Track, {}), /* @__PURE__ */ jsx(Thumb$
|
|
10015
|
+
children: /* @__PURE__ */ jsxs(Control, { children: [/* @__PURE__ */ jsx(Track, {}), /* @__PURE__ */ jsx(Thumb$2, {
|
|
10015
10016
|
"aria-label": "Hue slider",
|
|
10016
10017
|
children: /* @__PURE__ */ jsx(ThumbInner, { style: thumbInnerStyle })
|
|
10017
10018
|
})] })
|
|
@@ -10139,13 +10140,13 @@ const HSVSaturationValueCanvas = ({ hue, shouldShowContrastCurve, minimumContras
|
|
|
10139
10140
|
//#region src/components/ColorPicker/SaturationAndValuePicker.tsx
|
|
10140
10141
|
const SATURATION_NUDGE = .02;
|
|
10141
10142
|
const VALUE_NUDGE = .02;
|
|
10142
|
-
const Container
|
|
10143
|
+
const Container = styled.div`
|
|
10143
10144
|
border-radius: var(--wui-border-radius-02);
|
|
10144
10145
|
box-shadow: 0 0 0 1px var(--wui-color-border);
|
|
10145
10146
|
overflow: hidden;
|
|
10146
10147
|
position: relative;
|
|
10147
10148
|
`;
|
|
10148
|
-
const Thumb = styled.button.attrs({ type: "button" })`
|
|
10149
|
+
const Thumb$1 = styled.button.attrs({ type: "button" })`
|
|
10149
10150
|
appearance: none;
|
|
10150
10151
|
border-radius: var(--wui-border-radius-rounded);
|
|
10151
10152
|
border: none;
|
|
@@ -10283,12 +10284,12 @@ const SaturationAndValuePicker = ({ dataTestId }) => {
|
|
|
10283
10284
|
window.removeEventListener("mouseup", onWindowMouseUp);
|
|
10284
10285
|
};
|
|
10285
10286
|
}, [onWindowMouseMove, onWindowMouseUp]);
|
|
10286
|
-
return /* @__PURE__ */ jsxs(Container
|
|
10287
|
+
return /* @__PURE__ */ jsxs(Container, {
|
|
10287
10288
|
ref: containerRef,
|
|
10288
10289
|
"data-testid": dataTestId,
|
|
10289
10290
|
onMouseDown: onContainerMouseDown,
|
|
10290
10291
|
children: [
|
|
10291
|
-
/* @__PURE__ */ jsx(Thumb, {
|
|
10292
|
+
/* @__PURE__ */ jsx(Thumb$1, {
|
|
10292
10293
|
ref: thumbRef,
|
|
10293
10294
|
"aria-describedby": instructionsId,
|
|
10294
10295
|
"aria-label": "Saturation and value thumb",
|
|
@@ -15867,96 +15868,179 @@ const RadioCardImage = ({ label, imageSrc, aspectRatio, padding = "space-04", re
|
|
|
15867
15868
|
//#endregion
|
|
15868
15869
|
//#region src/components/ScrollArea/ScrollArea.tsx
|
|
15869
15870
|
const SHADOW_SIZE_PX = 8;
|
|
15870
|
-
const
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
const ScrollContainer = styled.div`
|
|
15876
|
-
overflow: ${({ $locked }) => $locked ? "hidden" : "auto"};
|
|
15877
|
-
height: 100%;
|
|
15878
|
-
width: 100%;
|
|
15879
|
-
`;
|
|
15871
|
+
const FADE_SIZE_PX = 32;
|
|
15872
|
+
const SCROLLBAR_SIZE_PX = 12;
|
|
15873
|
+
const SCROLLBAR_PADDING_PX = 2;
|
|
15874
|
+
const THUMB_SIZE_PX = 6;
|
|
15875
|
+
const THUMB_SIZE_ACTIVE_PX = 8;
|
|
15880
15876
|
const Shadow = styled.div`
|
|
15881
15877
|
pointer-events: none;
|
|
15882
15878
|
position: absolute;
|
|
15883
15879
|
transition: box-shadow var(--wui-motion-duration-04) var(--wui-motion-ease);
|
|
15884
|
-
box-shadow:
|
|
15880
|
+
box-shadow: none;
|
|
15885
15881
|
z-index: 1;
|
|
15886
15882
|
`;
|
|
15887
15883
|
const ShadowAtTop = styled(Shadow)`
|
|
15888
|
-
transform: translateY(-${SHADOW_SIZE_PX}px);
|
|
15889
15884
|
height: 0;
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
top: 0;
|
|
15885
|
+
inset-inline: 0;
|
|
15886
|
+
top: -${SHADOW_SIZE_PX}px;
|
|
15893
15887
|
`;
|
|
15894
15888
|
const ShadowAtBottom = styled(Shadow)`
|
|
15895
|
-
|
|
15896
|
-
bottom: 0;
|
|
15889
|
+
bottom: -${SHADOW_SIZE_PX}px;
|
|
15897
15890
|
height: 0;
|
|
15898
|
-
|
|
15899
|
-
right: 0;
|
|
15891
|
+
inset-inline: 0;
|
|
15900
15892
|
`;
|
|
15901
|
-
const
|
|
15902
|
-
|
|
15903
|
-
|
|
15904
|
-
left: 0;
|
|
15905
|
-
top: 0;
|
|
15893
|
+
const ShadowAtInlineStart = styled(Shadow)`
|
|
15894
|
+
inset-block: 0;
|
|
15895
|
+
inset-inline-start: -${SHADOW_SIZE_PX}px;
|
|
15906
15896
|
width: 0;
|
|
15907
15897
|
`;
|
|
15908
|
-
const
|
|
15909
|
-
|
|
15910
|
-
|
|
15911
|
-
right: 0;
|
|
15912
|
-
top: 0;
|
|
15898
|
+
const ShadowAtInlineEnd = styled(Shadow)`
|
|
15899
|
+
inset-block: 0;
|
|
15900
|
+
inset-inline-end: -${SHADOW_SIZE_PX}px;
|
|
15913
15901
|
width: 0;
|
|
15914
15902
|
`;
|
|
15903
|
+
const fadeMaskCss = css`
|
|
15904
|
+
--wui-scroll-area-fade-size: ${FADE_SIZE_PX}px;
|
|
15905
|
+
--wui-scroll-area-fade-inline-direction: to right;
|
|
15906
|
+
|
|
15907
|
+
mask-composite: intersect;
|
|
15908
|
+
mask-image:
|
|
15909
|
+
linear-gradient(
|
|
15910
|
+
to bottom,
|
|
15911
|
+
transparent,
|
|
15912
|
+
#000000 min(var(--wui-scroll-area-fade-size), var(--scroll-area-overflow-y-start, 0px)),
|
|
15913
|
+
#000000
|
|
15914
|
+
calc(100% - min(var(--wui-scroll-area-fade-size), var(--scroll-area-overflow-y-end, 0px))),
|
|
15915
|
+
transparent
|
|
15916
|
+
),
|
|
15917
|
+
linear-gradient(
|
|
15918
|
+
var(--wui-scroll-area-fade-inline-direction),
|
|
15919
|
+
transparent,
|
|
15920
|
+
#000000 min(var(--wui-scroll-area-fade-size), var(--scroll-area-overflow-x-start, 0px)),
|
|
15921
|
+
#000000
|
|
15922
|
+
calc(100% - min(var(--wui-scroll-area-fade-size), var(--scroll-area-overflow-x-end, 0px))),
|
|
15923
|
+
transparent
|
|
15924
|
+
);
|
|
15925
|
+
|
|
15926
|
+
&:dir(rtl) {
|
|
15927
|
+
--wui-scroll-area-fade-inline-direction: to left;
|
|
15928
|
+
}
|
|
15929
|
+
`;
|
|
15930
|
+
const Viewport = styled(ScrollArea$1.Viewport)`
|
|
15931
|
+
height: 100%;
|
|
15932
|
+
width: 100%;
|
|
15933
|
+
|
|
15934
|
+
&:focus-visible {
|
|
15935
|
+
/* the root draws the focus ring, so the fade mask can't dim it */
|
|
15936
|
+
outline: none;
|
|
15937
|
+
}
|
|
15938
|
+
|
|
15939
|
+
${({ $overflowIndicator }) => $overflowIndicator === "fade" && fadeMaskCss}
|
|
15940
|
+
`;
|
|
15941
|
+
const Root = styled(ScrollArea$1.Root)`
|
|
15942
|
+
overflow: hidden;
|
|
15943
|
+
flex: 1 1 auto;
|
|
15944
|
+
|
|
15945
|
+
&:has(> ${Viewport}:focus-visible) {
|
|
15946
|
+
outline: 2px solid var(--wui-color-focus-ring);
|
|
15947
|
+
outline-offset: -2px;
|
|
15948
|
+
}
|
|
15949
|
+
|
|
15950
|
+
&[data-overflow-y-start] > ${ShadowAtTop},
|
|
15951
|
+
&[data-overflow-y-end] > ${ShadowAtBottom},
|
|
15952
|
+
&[data-overflow-x-start] > ${ShadowAtInlineStart},
|
|
15953
|
+
&[data-overflow-x-end] > ${ShadowAtInlineEnd} {
|
|
15954
|
+
box-shadow: 0 0 ${SHADOW_SIZE_PX}px ${SHADOW_SIZE_PX}px var(--wui-color-drop-shadow);
|
|
15955
|
+
}
|
|
15956
|
+
`;
|
|
15957
|
+
const Thumb = styled(ScrollArea$1.Thumb)`
|
|
15958
|
+
background-color: var(--wui-gray-alpha-8);
|
|
15959
|
+
border-radius: var(--wui-border-radius-rounded);
|
|
15960
|
+
transition-duration: var(--wui-motion-duration-03);
|
|
15961
|
+
transition-property: background-color, height, width;
|
|
15962
|
+
transition-timing-function: var(--wui-motion-ease);
|
|
15963
|
+
|
|
15964
|
+
&[data-orientation='vertical'] {
|
|
15965
|
+
width: ${THUMB_SIZE_PX}px;
|
|
15966
|
+
}
|
|
15967
|
+
|
|
15968
|
+
&[data-orientation='horizontal'] {
|
|
15969
|
+
height: ${THUMB_SIZE_PX}px;
|
|
15970
|
+
}
|
|
15971
|
+
`;
|
|
15972
|
+
const Scrollbar = styled(ScrollArea$1.Scrollbar)`
|
|
15973
|
+
display: flex;
|
|
15974
|
+
opacity: 0;
|
|
15975
|
+
padding: ${SCROLLBAR_PADDING_PX}px;
|
|
15976
|
+
pointer-events: none;
|
|
15977
|
+
transition: opacity var(--wui-motion-duration-04) var(--wui-motion-ease)
|
|
15978
|
+
var(--wui-motion-duration-03);
|
|
15979
|
+
z-index: 2;
|
|
15980
|
+
|
|
15981
|
+
&[data-orientation='vertical'] {
|
|
15982
|
+
justify-content: flex-end;
|
|
15983
|
+
width: ${SCROLLBAR_SIZE_PX}px;
|
|
15984
|
+
}
|
|
15985
|
+
|
|
15986
|
+
&[data-orientation='horizontal'] {
|
|
15987
|
+
align-items: flex-end;
|
|
15988
|
+
height: ${SCROLLBAR_SIZE_PX}px;
|
|
15989
|
+
}
|
|
15990
|
+
|
|
15991
|
+
&[data-hovering],
|
|
15992
|
+
&[data-scrolling] {
|
|
15993
|
+
opacity: 1;
|
|
15994
|
+
pointer-events: auto;
|
|
15995
|
+
transition-delay: 0s;
|
|
15996
|
+
transition-duration: var(--wui-motion-duration-01);
|
|
15997
|
+
}
|
|
15998
|
+
|
|
15999
|
+
&:is(:hover, :active) > ${Thumb} {
|
|
16000
|
+
background-color: var(--wui-gray-alpha-9);
|
|
16001
|
+
}
|
|
16002
|
+
|
|
16003
|
+
&[data-orientation='vertical']:is(:hover, :active) > ${Thumb} {
|
|
16004
|
+
width: ${THUMB_SIZE_ACTIVE_PX}px;
|
|
16005
|
+
}
|
|
16006
|
+
|
|
16007
|
+
&[data-orientation='horizontal']:is(:hover, :active) > ${Thumb} {
|
|
16008
|
+
height: ${THUMB_SIZE_ACTIVE_PX}px;
|
|
16009
|
+
}
|
|
16010
|
+
`;
|
|
15915
16011
|
/**
|
|
15916
|
-
* ScrollArea is a
|
|
15917
|
-
* scrollability.
|
|
16012
|
+
* ScrollArea is a scrollable container with shadow or fade effects to indicate
|
|
16013
|
+
* scrollability. Its scrollbars overlay the content and only appear while the
|
|
16014
|
+
* pointer is over the area or the content is being scrolled.
|
|
15918
16015
|
*/
|
|
15919
|
-
const ScrollArea = ({ children,
|
|
15920
|
-
|
|
15921
|
-
const [shadowState, setShadowState] = useState({
|
|
15922
|
-
canScrollUp: false,
|
|
15923
|
-
canScrollLeft: false,
|
|
15924
|
-
canScrollDown: false,
|
|
15925
|
-
canScrollRight: false
|
|
15926
|
-
});
|
|
15927
|
-
const scrollContainerRef = mergeRefs([scrollContainerRefInternal, forwardedRef]);
|
|
15928
|
-
const updateShadows = useCallback(() => {
|
|
15929
|
-
const scrollContainer = scrollContainerRefInternal.current;
|
|
15930
|
-
if (!scrollContainer) return;
|
|
15931
|
-
setShadowState({
|
|
15932
|
-
canScrollUp: scrollContainer.scrollTop > 0,
|
|
15933
|
-
canScrollLeft: scrollContainer.scrollLeft > 0,
|
|
15934
|
-
canScrollDown: scrollContainer.scrollTop + scrollContainer.clientHeight < scrollContainer.scrollHeight,
|
|
15935
|
-
canScrollRight: scrollContainer.scrollLeft + scrollContainer.clientWidth < scrollContainer.scrollWidth
|
|
15936
|
-
});
|
|
15937
|
-
}, []);
|
|
15938
|
-
const throttledUpdateShadows = useMemo(() => throttle(100, updateShadows), [updateShadows]);
|
|
15939
|
-
const onScrollScrollContainer = useCallback((event) => {
|
|
15940
|
-
onScroll?.(event);
|
|
15941
|
-
throttledUpdateShadows();
|
|
15942
|
-
}, [onScroll, throttledUpdateShadows]);
|
|
15943
|
-
useEffect(() => {
|
|
15944
|
-
updateShadows();
|
|
15945
|
-
}, [updateShadows]);
|
|
15946
|
-
return /* @__PURE__ */ jsxs(Container, {
|
|
16016
|
+
const ScrollArea = ({ children, style, locked = false, overflowIndicator = "shadow", ref, ...props }) => {
|
|
16017
|
+
return /* @__PURE__ */ jsxs(Root, {
|
|
15947
16018
|
style,
|
|
15948
16019
|
children: [
|
|
15949
|
-
/* @__PURE__ */
|
|
15950
|
-
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
|
|
16020
|
+
overflowIndicator === "shadow" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16021
|
+
/* @__PURE__ */ jsx(ShadowAtTop, {}),
|
|
16022
|
+
/* @__PURE__ */ jsx(ShadowAtBottom, {}),
|
|
16023
|
+
/* @__PURE__ */ jsx(ShadowAtInlineStart, {}),
|
|
16024
|
+
/* @__PURE__ */ jsx(ShadowAtInlineEnd, {})
|
|
16025
|
+
] }) : null,
|
|
16026
|
+
/* @__PURE__ */ jsx(Viewport, {
|
|
16027
|
+
ref,
|
|
16028
|
+
$overflowIndicator: overflowIndicator,
|
|
16029
|
+
style: locked ? { overflow: "hidden" } : void 0,
|
|
15957
16030
|
...props,
|
|
15958
16031
|
children
|
|
15959
|
-
})
|
|
16032
|
+
}),
|
|
16033
|
+
locked ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16034
|
+
/* @__PURE__ */ jsx(Scrollbar, {
|
|
16035
|
+
orientation: "vertical",
|
|
16036
|
+
children: /* @__PURE__ */ jsx(Thumb, {})
|
|
16037
|
+
}),
|
|
16038
|
+
/* @__PURE__ */ jsx(Scrollbar, {
|
|
16039
|
+
orientation: "horizontal",
|
|
16040
|
+
children: /* @__PURE__ */ jsx(Thumb, {})
|
|
16041
|
+
}),
|
|
16042
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Corner, {})
|
|
16043
|
+
] })
|
|
15960
16044
|
]
|
|
15961
16045
|
});
|
|
15962
16046
|
};
|