@dxos/react-ui 0.8.1 → 0.8.2-main.2f9c567
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/lib/browser/index.mjs +1152 -1150
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +1104 -1102
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1152 -1150
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Avatars/Avatar.d.ts +2 -2
- package/dist/types/src/components/Avatars/Avatar.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +1 -1
- package/dist/types/src/components/Dialogs/Dialog.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +2 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/components/Avatars/Avatar.tsx +17 -13
- package/src/components/Dialogs/Dialog.tsx +1 -0
- package/src/components/Popover/Popover.tsx +3 -0
- package/src/components/index.ts +1 -1
|
@@ -200,17 +200,18 @@ var DxAvatar = createComponent({
|
|
|
200
200
|
elementClass: NaturalDxAvatar,
|
|
201
201
|
react: React3
|
|
202
202
|
});
|
|
203
|
-
var AvatarContent = ({ icon, classNames, ...props }) => {
|
|
203
|
+
var AvatarContent = /* @__PURE__ */ forwardRef2(({ icon, classNames, ...props }, forwardedRef) => {
|
|
204
204
|
const href = useIconHref(icon);
|
|
205
205
|
const { labelId, descriptionId } = useAvatarContext("AvatarContent");
|
|
206
206
|
return /* @__PURE__ */ React3.createElement(DxAvatar, {
|
|
207
207
|
...props,
|
|
208
208
|
icon: href,
|
|
209
|
-
labelId,
|
|
209
|
+
"aria-labelledby": labelId,
|
|
210
210
|
"aria-describedby": descriptionId,
|
|
211
|
-
rootClassName: mx(classNames)
|
|
211
|
+
rootClassName: mx(classNames),
|
|
212
|
+
ref: forwardedRef
|
|
212
213
|
});
|
|
213
|
-
};
|
|
214
|
+
});
|
|
214
215
|
var AvatarLabel = /* @__PURE__ */ forwardRef2(({ asChild, srOnly, classNames, ...props }, forwardedRef) => {
|
|
215
216
|
const Root5 = asChild ? Slot2 : Primitive2.span;
|
|
216
217
|
const { tx } = useThemeContext();
|
|
@@ -790,6 +791,7 @@ var DialogContent = /* @__PURE__ */ forwardRef11(({ classNames, children, inOver
|
|
|
790
791
|
const { tx } = useThemeContext();
|
|
791
792
|
const { inOverlayLayout } = useOverlayLayoutContext(DIALOG_CONTENT_NAME);
|
|
792
793
|
return /* @__PURE__ */ React17.createElement(DialogContentPrimitive, {
|
|
794
|
+
"aria-describedby": void 0,
|
|
793
795
|
...props,
|
|
794
796
|
className: tx("dialog.content", "dialog", {
|
|
795
797
|
inOverlayLayout: propsInOverlayLayout || inOverlayLayout
|
|
@@ -881,1310 +883,1310 @@ var AlertDialog = {
|
|
|
881
883
|
Action: AlertDialogAction
|
|
882
884
|
};
|
|
883
885
|
|
|
884
|
-
// packages/ui/react-ui/src/components/
|
|
885
|
-
import
|
|
886
|
-
import {
|
|
887
|
-
import {
|
|
888
|
-
import
|
|
889
|
-
|
|
890
|
-
var
|
|
891
|
-
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
892
|
-
var ContextMenuContent = /* @__PURE__ */ forwardRef13(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
886
|
+
// packages/ui/react-ui/src/components/Input/Input.tsx
|
|
887
|
+
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
888
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
889
|
+
import React19, { forwardRef as forwardRef13, useCallback as useCallback4 } from "react";
|
|
890
|
+
import { InputRoot, PinInput as PinInputPrimitive, TextInput as TextInputPrimitive, TextArea as TextAreaPrimitive, useInputContext, INPUT_NAME, Description as DescriptionPrimitive, DescriptionAndValidation as DescriptionAndValidationPrimitive, Label as LabelPrimitive, Validation as ValidationPrimitive } from "@dxos/react-input";
|
|
891
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
892
|
+
var Label = /* @__PURE__ */ forwardRef13(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
893
893
|
const { tx } = useThemeContext();
|
|
894
|
-
|
|
895
|
-
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
896
|
-
return /* @__PURE__ */ React19.createElement(ContextMenuPrimitive.Content, {
|
|
894
|
+
return /* @__PURE__ */ React19.createElement(LabelPrimitive, {
|
|
897
895
|
...props,
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
elevation
|
|
896
|
+
className: tx("input.label", "input__label", {
|
|
897
|
+
srOnly
|
|
901
898
|
}, classNames),
|
|
902
899
|
ref: forwardedRef
|
|
903
900
|
}, children);
|
|
904
901
|
});
|
|
905
|
-
var
|
|
902
|
+
var Description = /* @__PURE__ */ forwardRef13(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
906
903
|
const { tx } = useThemeContext();
|
|
907
|
-
|
|
908
|
-
return /* @__PURE__ */ React19.createElement(Root5, {
|
|
904
|
+
return /* @__PURE__ */ React19.createElement(DescriptionPrimitive, {
|
|
909
905
|
...props,
|
|
910
|
-
className: tx("
|
|
906
|
+
className: tx("input.description", "input__description", {
|
|
907
|
+
srOnly
|
|
908
|
+
}, classNames),
|
|
911
909
|
ref: forwardedRef
|
|
912
910
|
}, children);
|
|
913
911
|
});
|
|
914
|
-
var
|
|
912
|
+
var Validation = /* @__PURE__ */ forwardRef13(({ __inputScope, srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
915
913
|
const { tx } = useThemeContext();
|
|
916
|
-
|
|
914
|
+
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
915
|
+
return /* @__PURE__ */ React19.createElement(ValidationPrimitive, {
|
|
917
916
|
...props,
|
|
918
|
-
className: tx("
|
|
917
|
+
className: tx("input.validation", `input__validation-message input__validation-message--${validationValence}`, {
|
|
918
|
+
srOnly,
|
|
919
|
+
validationValence
|
|
920
|
+
}, classNames),
|
|
919
921
|
ref: forwardedRef
|
|
920
|
-
});
|
|
922
|
+
}, children);
|
|
921
923
|
});
|
|
922
|
-
var
|
|
923
|
-
var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
|
|
924
|
-
var ContextMenuItem = /* @__PURE__ */ forwardRef13(({ classNames, ...props }, forwardedRef) => {
|
|
924
|
+
var DescriptionAndValidation = /* @__PURE__ */ forwardRef13(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
925
925
|
const { tx } = useThemeContext();
|
|
926
|
-
return /* @__PURE__ */ React19.createElement(
|
|
926
|
+
return /* @__PURE__ */ React19.createElement(DescriptionAndValidationPrimitive, {
|
|
927
927
|
...props,
|
|
928
|
-
className: tx("
|
|
928
|
+
className: tx("input.descriptionAndValidation", "input__description-and-validation", {
|
|
929
|
+
srOnly
|
|
930
|
+
}, classNames),
|
|
929
931
|
ref: forwardedRef
|
|
930
|
-
});
|
|
932
|
+
}, children);
|
|
931
933
|
});
|
|
932
|
-
var
|
|
934
|
+
var PinInput = /* @__PURE__ */ forwardRef13(({ density: propsDensity, elevation: propsElevation, segmentClassName: propsSegmentClassName, inputClassName, variant, ...props }, forwardedRef) => {
|
|
935
|
+
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
933
936
|
const { tx } = useThemeContext();
|
|
934
|
-
|
|
937
|
+
const density = useDensityContext(propsDensity);
|
|
938
|
+
const elevation = useElevationContext(propsElevation);
|
|
939
|
+
const segmentClassName = useCallback4(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
940
|
+
variant: "static",
|
|
941
|
+
focused,
|
|
942
|
+
disabled: props.disabled,
|
|
943
|
+
density,
|
|
944
|
+
elevation,
|
|
945
|
+
validationValence
|
|
946
|
+
}, propsSegmentClassName), [
|
|
947
|
+
tx,
|
|
948
|
+
props.disabled,
|
|
949
|
+
elevation,
|
|
950
|
+
propsElevation,
|
|
951
|
+
density
|
|
952
|
+
]);
|
|
953
|
+
return /* @__PURE__ */ React19.createElement(PinInputPrimitive, {
|
|
935
954
|
...props,
|
|
936
|
-
|
|
955
|
+
segmentClassName,
|
|
956
|
+
...props.autoFocus && !hasIosKeyboard2 && {
|
|
957
|
+
autoFocus: true
|
|
958
|
+
},
|
|
959
|
+
inputClassName: tx("input.inputWithSegments", "input input--pin", {
|
|
960
|
+
disabled: props.disabled
|
|
961
|
+
}, inputClassName),
|
|
937
962
|
ref: forwardedRef
|
|
938
963
|
});
|
|
939
964
|
});
|
|
940
|
-
var
|
|
941
|
-
const {
|
|
942
|
-
|
|
965
|
+
var TextInput = /* @__PURE__ */ forwardRef13(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
966
|
+
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
967
|
+
const themeContextValue = useThemeContext();
|
|
968
|
+
const density = useDensityContext(propsDensity);
|
|
969
|
+
const elevation = useElevationContext(propsElevation);
|
|
970
|
+
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
971
|
+
const { tx } = themeContextValue;
|
|
972
|
+
return /* @__PURE__ */ React19.createElement(TextInputPrimitive, {
|
|
943
973
|
...props,
|
|
944
|
-
className: tx("
|
|
974
|
+
className: tx("input.input", "input", {
|
|
975
|
+
variant,
|
|
976
|
+
disabled: props.disabled,
|
|
977
|
+
density,
|
|
978
|
+
elevation,
|
|
979
|
+
validationValence
|
|
980
|
+
}, classNames),
|
|
981
|
+
...props.autoFocus && !hasIosKeyboard2 && {
|
|
982
|
+
autoFocus: true
|
|
983
|
+
},
|
|
945
984
|
ref: forwardedRef
|
|
946
985
|
});
|
|
947
986
|
});
|
|
948
|
-
var
|
|
987
|
+
var TextArea = /* @__PURE__ */ forwardRef13(({ __inputScope, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
988
|
+
const { hasIosKeyboard: hasIosKeyboard2 } = useThemeContext();
|
|
949
989
|
const { tx } = useThemeContext();
|
|
950
|
-
|
|
990
|
+
const density = useDensityContext(propsDensity);
|
|
991
|
+
const elevation = useElevationContext(propsElevation);
|
|
992
|
+
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
993
|
+
return /* @__PURE__ */ React19.createElement(TextAreaPrimitive, {
|
|
951
994
|
...props,
|
|
952
|
-
className: tx("
|
|
995
|
+
className: tx("input.input", "input--text-area", {
|
|
996
|
+
variant,
|
|
997
|
+
disabled: props.disabled,
|
|
998
|
+
density,
|
|
999
|
+
elevation,
|
|
1000
|
+
validationValence
|
|
1001
|
+
}, classNames),
|
|
1002
|
+
...props.autoFocus && !hasIosKeyboard2 && {
|
|
1003
|
+
autoFocus: true
|
|
1004
|
+
},
|
|
953
1005
|
ref: forwardedRef
|
|
954
1006
|
});
|
|
955
1007
|
});
|
|
956
|
-
var
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
Viewport: ContextMenuViewport,
|
|
962
|
-
Arrow: ContextMenuArrow,
|
|
963
|
-
Group: ContextMenuGroup,
|
|
964
|
-
Item: ContextMenuItem,
|
|
965
|
-
CheckboxItem: ContextMenuCheckboxItem,
|
|
966
|
-
ItemIndicator: ContextMenuItemIndicator,
|
|
967
|
-
Separator: ContextMenuSeparator,
|
|
968
|
-
GroupLabel: ContextMenuGroupLabel
|
|
969
|
-
};
|
|
970
|
-
|
|
971
|
-
// packages/ui/react-ui/src/components/Menus/DropdownMenu.tsx
|
|
972
|
-
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
973
|
-
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
974
|
-
import { createContextScope } from "@radix-ui/react-context";
|
|
975
|
-
import { useId as useId2 } from "@radix-ui/react-id";
|
|
976
|
-
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
977
|
-
import { createMenuScope } from "@radix-ui/react-menu";
|
|
978
|
-
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
979
|
-
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
980
|
-
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
981
|
-
import React20, { useRef, useCallback as useCallback4, forwardRef as forwardRef14, useEffect as useEffect3 } from "react";
|
|
982
|
-
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
983
|
-
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [
|
|
984
|
-
createMenuScope
|
|
985
|
-
]);
|
|
986
|
-
var useMenuScope = createMenuScope();
|
|
987
|
-
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
|
988
|
-
var DropdownMenuRoot = (props) => {
|
|
989
|
-
const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
|
|
990
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
991
|
-
const triggerRef = useRef(null);
|
|
992
|
-
const [open = false, setOpen] = useControllableState({
|
|
993
|
-
prop: openProp,
|
|
994
|
-
defaultProp: defaultOpen,
|
|
995
|
-
onChange: onOpenChange
|
|
1008
|
+
var Checkbox = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, weight = "bold", classNames, ...props }, forwardedRef) => {
|
|
1009
|
+
const [checked, onCheckedChange] = useControllableState({
|
|
1010
|
+
prop: propsChecked,
|
|
1011
|
+
defaultProp: propsDefaultChecked,
|
|
1012
|
+
onChange: propsOnCheckedChange
|
|
996
1013
|
});
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
var DropdownMenuTrigger = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1019
|
-
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
1020
|
-
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
1021
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1022
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Anchor, {
|
|
1023
|
-
asChild: true,
|
|
1024
|
-
...menuScope
|
|
1025
|
-
}, /* @__PURE__ */ React20.createElement(Primitive7.button, {
|
|
1026
|
-
type: "button",
|
|
1027
|
-
id: context.triggerId,
|
|
1028
|
-
"aria-haspopup": "menu",
|
|
1029
|
-
"aria-expanded": context.open,
|
|
1030
|
-
"aria-controls": context.open ? context.contentId : void 0,
|
|
1031
|
-
"data-state": context.open ? "open" : "closed",
|
|
1032
|
-
"data-disabled": disabled ? "" : void 0,
|
|
1033
|
-
disabled,
|
|
1034
|
-
...triggerProps,
|
|
1035
|
-
ref: composeRefs(forwardedRef, context.triggerRef),
|
|
1036
|
-
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
|
1037
|
-
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
1038
|
-
context.onOpenToggle();
|
|
1039
|
-
if (!context.open) {
|
|
1040
|
-
event.preventDefault();
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
}),
|
|
1044
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
1045
|
-
if (disabled) {
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
|
-
if ([
|
|
1049
|
-
"Enter",
|
|
1050
|
-
" "
|
|
1051
|
-
].includes(event.key)) {
|
|
1052
|
-
context.onOpenToggle();
|
|
1053
|
-
}
|
|
1054
|
-
if (event.key === "ArrowDown") {
|
|
1055
|
-
context.onOpenChange(true);
|
|
1056
|
-
}
|
|
1057
|
-
if ([
|
|
1058
|
-
"Enter",
|
|
1059
|
-
" ",
|
|
1060
|
-
"ArrowDown"
|
|
1061
|
-
].includes(event.key)) {
|
|
1062
|
-
event.preventDefault();
|
|
1063
|
-
}
|
|
1014
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1015
|
+
const { tx } = useThemeContext();
|
|
1016
|
+
return /* @__PURE__ */ React19.createElement(CheckboxPrimitive, {
|
|
1017
|
+
...props,
|
|
1018
|
+
checked,
|
|
1019
|
+
onCheckedChange,
|
|
1020
|
+
id,
|
|
1021
|
+
"aria-describedby": descriptionId,
|
|
1022
|
+
...validationValence === "error" && {
|
|
1023
|
+
"aria-invalid": "true",
|
|
1024
|
+
"aria-errormessage": errorMessageId
|
|
1025
|
+
},
|
|
1026
|
+
className: tx("input.checkbox", "input--checkbox", {
|
|
1027
|
+
size
|
|
1028
|
+
}, "shrink-0", classNames),
|
|
1029
|
+
ref: forwardedRef
|
|
1030
|
+
}, /* @__PURE__ */ React19.createElement(Icon, {
|
|
1031
|
+
icon: checked === "indeterminate" ? "ph--minus--regular" : "ph--check--regular",
|
|
1032
|
+
classNames: tx("input.checkboxIndicator", "input--checkbox__indicator", {
|
|
1033
|
+
size,
|
|
1034
|
+
checked
|
|
1064
1035
|
})
|
|
1065
1036
|
}));
|
|
1066
1037
|
});
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1073
|
-
useEffect3(() => {
|
|
1074
|
-
if (virtualRef.current) {
|
|
1075
|
-
context.triggerRef.current = virtualRef.current;
|
|
1076
|
-
}
|
|
1077
|
-
});
|
|
1078
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Anchor, {
|
|
1079
|
-
...menuScope,
|
|
1080
|
-
virtualRef
|
|
1081
|
-
});
|
|
1082
|
-
};
|
|
1083
|
-
DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
|
|
1084
|
-
var PORTAL_NAME = "DropdownMenuPortal";
|
|
1085
|
-
var DropdownMenuPortal = (props) => {
|
|
1086
|
-
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
1087
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1088
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Portal, {
|
|
1089
|
-
...menuScope,
|
|
1090
|
-
...portalProps
|
|
1038
|
+
var Switch = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, classNames, ...props }, forwardedRef) => {
|
|
1039
|
+
const [checked, onCheckedChange] = useControllableState({
|
|
1040
|
+
prop: propsChecked,
|
|
1041
|
+
defaultProp: propsDefaultChecked ?? false,
|
|
1042
|
+
onChange: propsOnCheckedChange
|
|
1091
1043
|
});
|
|
1092
|
-
};
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1044
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1045
|
+
return /* @__PURE__ */ React19.createElement("input", {
|
|
1046
|
+
type: "checkbox",
|
|
1047
|
+
className: mx3("dx-checkbox--switch dx-focus-ring", classNames),
|
|
1048
|
+
checked,
|
|
1049
|
+
onChange: (event) => {
|
|
1050
|
+
onCheckedChange(event.target.checked);
|
|
1051
|
+
},
|
|
1052
|
+
id,
|
|
1053
|
+
"aria-describedby": descriptionId,
|
|
1098
1054
|
...props,
|
|
1099
|
-
|
|
1055
|
+
...validationValence === "error" && {
|
|
1056
|
+
"aria-invalid": "true",
|
|
1057
|
+
"aria-errormessage": errorMessageId
|
|
1058
|
+
},
|
|
1100
1059
|
ref: forwardedRef
|
|
1101
|
-
}
|
|
1060
|
+
});
|
|
1102
1061
|
});
|
|
1103
|
-
var
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1062
|
+
var Input = {
|
|
1063
|
+
Root: InputRoot,
|
|
1064
|
+
PinInput,
|
|
1065
|
+
TextInput,
|
|
1066
|
+
TextArea,
|
|
1067
|
+
Checkbox,
|
|
1068
|
+
Switch,
|
|
1069
|
+
Label,
|
|
1070
|
+
Description,
|
|
1071
|
+
Validation,
|
|
1072
|
+
DescriptionAndValidation
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1076
|
+
import { CaretDown, CaretRight } from "@phosphor-icons/react";
|
|
1077
|
+
import { Slot as Slot6 } from "@radix-ui/react-slot";
|
|
1078
|
+
import React21, { forwardRef as forwardRef14 } from "react";
|
|
1079
|
+
import { List as ListPrimitive, ListItemHeading as ListPrimitiveItemHeading, ListItemOpenTrigger as ListPrimitiveItemOpenTrigger, ListItemCollapsibleContent, ListItem as ListPrimitiveItem, LIST_NAME, LIST_ITEM_NAME, useListContext, useListItemContext } from "@dxos/react-list";
|
|
1080
|
+
|
|
1081
|
+
// packages/ui/react-ui/src/components/Lists/ListDropIndicator.tsx
|
|
1082
|
+
import React20 from "react";
|
|
1083
|
+
var edgeToOrientationMap = {
|
|
1084
|
+
top: "horizontal",
|
|
1085
|
+
bottom: "horizontal",
|
|
1086
|
+
left: "vertical",
|
|
1087
|
+
right: "vertical"
|
|
1088
|
+
};
|
|
1089
|
+
var orientationStyles = {
|
|
1090
|
+
horizontal: "h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]",
|
|
1091
|
+
vertical: "w-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]"
|
|
1092
|
+
};
|
|
1093
|
+
var edgeStyles = {
|
|
1094
|
+
top: "top-[--line-offset] before:top-[--offset-terminal]",
|
|
1095
|
+
right: "right-[--line-offset] before:right-[--offset-terminal]",
|
|
1096
|
+
bottom: "bottom-[--line-offset] before:bottom-[--offset-terminal]",
|
|
1097
|
+
left: "left-[--line-offset] before:left-[--offset-terminal]"
|
|
1098
|
+
};
|
|
1099
|
+
var strokeSize = 2;
|
|
1100
|
+
var terminalSize = 8;
|
|
1101
|
+
var offsetToAlignTerminalWithLine = (strokeSize - terminalSize) / 2;
|
|
1102
|
+
var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineInset - terminalSize }) => {
|
|
1103
|
+
const orientation = edgeToOrientationMap[edge];
|
|
1104
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
|
1105
|
+
role: "none",
|
|
1137
1106
|
style: {
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
}
|
|
1107
|
+
"--line-thickness": `${strokeSize}px`,
|
|
1108
|
+
"--line-offset": `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
1109
|
+
"--line-inset": `${lineInset}px`,
|
|
1110
|
+
"--terminal-size": `${terminalSize}px`,
|
|
1111
|
+
"--terminal-radius": `${terminalSize / 2}px`,
|
|
1112
|
+
"--terminal-inset": `${terminalInset}px`,
|
|
1113
|
+
"--offset-terminal": `${offsetToAlignTerminalWithLine}px`
|
|
1114
|
+
},
|
|
1115
|
+
className: `absolute z-10 pointer-events-none bg-accentSurface before:content-[''] before:w-[--terminal-size] before:h-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles[orientation]} ${edgeStyles[edge]}`
|
|
1148
1116
|
});
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
var
|
|
1153
|
-
const {
|
|
1154
|
-
const
|
|
1155
|
-
return /* @__PURE__ */
|
|
1156
|
-
|
|
1157
|
-
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1120
|
+
var List = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, forwardedRef) => {
|
|
1121
|
+
const { tx } = useThemeContext();
|
|
1122
|
+
const density = useDensityContext(props.density);
|
|
1123
|
+
return /* @__PURE__ */ React21.createElement(DensityProvider, {
|
|
1124
|
+
density
|
|
1125
|
+
}, /* @__PURE__ */ React21.createElement(ListPrimitive, {
|
|
1126
|
+
...props,
|
|
1127
|
+
className: tx("list.root", "list", {}, classNames),
|
|
1158
1128
|
ref: forwardedRef
|
|
1159
|
-
});
|
|
1129
|
+
}, children));
|
|
1160
1130
|
});
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
const { __scopeDropdownMenu, classNames, ...labelProps } = props;
|
|
1165
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1131
|
+
var ListItemEndcap = /* @__PURE__ */ forwardRef14(({ children, classNames, asChild, ...props }, forwardedRef) => {
|
|
1132
|
+
const Root5 = asChild ? Slot6 : "div";
|
|
1133
|
+
const density = useDensityContext();
|
|
1166
1134
|
const { tx } = useThemeContext();
|
|
1167
|
-
return /* @__PURE__ */
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1135
|
+
return /* @__PURE__ */ React21.createElement(Root5, {
|
|
1136
|
+
...!asChild && {
|
|
1137
|
+
role: "none"
|
|
1138
|
+
},
|
|
1139
|
+
...props,
|
|
1140
|
+
className: tx("list.item.endcap", "list__listItem__endcap", {
|
|
1141
|
+
density
|
|
1142
|
+
}, classNames),
|
|
1171
1143
|
ref: forwardedRef
|
|
1144
|
+
}, children);
|
|
1145
|
+
});
|
|
1146
|
+
var MockListItemOpenTrigger = ({ classNames, ...props }) => {
|
|
1147
|
+
const density = useDensityContext();
|
|
1148
|
+
const { tx } = useThemeContext();
|
|
1149
|
+
return /* @__PURE__ */ React21.createElement("div", {
|
|
1150
|
+
role: "none",
|
|
1151
|
+
...props,
|
|
1152
|
+
className: tx("list.item.openTrigger", "list__listItem__openTrigger--mock", {
|
|
1153
|
+
density
|
|
1154
|
+
}, classNames)
|
|
1172
1155
|
});
|
|
1156
|
+
};
|
|
1157
|
+
var ListItemHeading = /* @__PURE__ */ forwardRef14(({ children, classNames, ...props }, forwardedRef) => {
|
|
1158
|
+
const { tx } = useThemeContext();
|
|
1159
|
+
const density = useDensityContext();
|
|
1160
|
+
return /* @__PURE__ */ React21.createElement(ListPrimitiveItemHeading, {
|
|
1161
|
+
...props,
|
|
1162
|
+
className: tx("list.item.heading", "list__listItem__heading", {
|
|
1163
|
+
density
|
|
1164
|
+
}, classNames),
|
|
1165
|
+
ref: forwardedRef
|
|
1166
|
+
}, children);
|
|
1173
1167
|
});
|
|
1174
|
-
|
|
1175
|
-
var ITEM_NAME = "DropdownMenuItem";
|
|
1176
|
-
var DropdownMenuItem = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1177
|
-
const { __scopeDropdownMenu, classNames, ...itemProps } = props;
|
|
1178
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1168
|
+
var ListItemOpenTrigger = /* @__PURE__ */ forwardRef14(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
|
|
1179
1169
|
const { tx } = useThemeContext();
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1170
|
+
const density = useDensityContext();
|
|
1171
|
+
const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
1172
|
+
const Icon3 = open ? CaretDown : CaretRight;
|
|
1173
|
+
return /* @__PURE__ */ React21.createElement(ListPrimitiveItemOpenTrigger, {
|
|
1174
|
+
...props,
|
|
1175
|
+
className: tx("list.item.openTrigger", "list__listItem__openTrigger", {
|
|
1176
|
+
density
|
|
1177
|
+
}, classNames),
|
|
1184
1178
|
ref: forwardedRef
|
|
1185
|
-
}
|
|
1179
|
+
}, children || /* @__PURE__ */ React21.createElement(Icon3, {
|
|
1180
|
+
weight: "bold",
|
|
1181
|
+
className: tx("list.item.openTriggerIcon", "list__listItem__openTrigger__icon", {})
|
|
1182
|
+
}));
|
|
1186
1183
|
});
|
|
1187
|
-
|
|
1188
|
-
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
1189
|
-
var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1190
|
-
const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
|
|
1191
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1184
|
+
var ListItemRoot = /* @__PURE__ */ forwardRef14(({ classNames, children, ...props }, forwardedRef) => {
|
|
1192
1185
|
const { tx } = useThemeContext();
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
...
|
|
1196
|
-
className: tx("
|
|
1186
|
+
const density = useDensityContext();
|
|
1187
|
+
return /* @__PURE__ */ React21.createElement(ListPrimitiveItem, {
|
|
1188
|
+
...props,
|
|
1189
|
+
className: tx("list.item.root", "list__listItem", {
|
|
1190
|
+
density,
|
|
1191
|
+
collapsible: props.collapsible
|
|
1192
|
+
}, classNames),
|
|
1197
1193
|
ref: forwardedRef
|
|
1198
|
-
});
|
|
1194
|
+
}, children);
|
|
1199
1195
|
});
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1196
|
+
var ListItem = {
|
|
1197
|
+
Root: ListItemRoot,
|
|
1198
|
+
Endcap: ListItemEndcap,
|
|
1199
|
+
Heading: ListItemHeading,
|
|
1200
|
+
OpenTrigger: ListItemOpenTrigger,
|
|
1201
|
+
CollapsibleContent: ListItemCollapsibleContent,
|
|
1202
|
+
MockOpenTrigger: MockListItemOpenTrigger,
|
|
1203
|
+
DropIndicator: ListDropIndicator
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1206
|
+
// packages/ui/react-ui/src/components/Lists/Tree.tsx
|
|
1207
|
+
import React23, { forwardRef as forwardRef15 } from "react";
|
|
1208
|
+
|
|
1209
|
+
// packages/ui/react-ui/src/components/Lists/TreeDropIndicator.tsx
|
|
1210
|
+
import React22 from "react";
|
|
1211
|
+
var edgeToOrientationMap2 = {
|
|
1212
|
+
"reorder-above": "sibling",
|
|
1213
|
+
"reorder-below": "sibling",
|
|
1214
|
+
"make-child": "child",
|
|
1215
|
+
reparent: "child"
|
|
1216
|
+
};
|
|
1217
|
+
var orientationStyles2 = {
|
|
1218
|
+
// TODO(wittjosiah): Stop using left/right here.
|
|
1219
|
+
sibling: "bs-[--line-thickness] left-[--horizontal-indent] right-0 bg-accentSurface before:left-[--negative-terminal-size]",
|
|
1220
|
+
child: "is-full block-start-0 block-end-0 border-[length:--line-thickness] before:invisible"
|
|
1221
|
+
};
|
|
1222
|
+
var instructionStyles = {
|
|
1223
|
+
"reorder-above": "block-start-[--line-offset] before:block-start-[--offset-terminal]",
|
|
1224
|
+
"reorder-below": "block-end-[--line-offset] before:block-end-[--offset-terminal]",
|
|
1225
|
+
"make-child": "border-accentSurface",
|
|
1226
|
+
// TODO(wittjosiah): This is not occurring in the current implementation.
|
|
1227
|
+
reparent: ""
|
|
1228
|
+
};
|
|
1229
|
+
var strokeSize2 = 2;
|
|
1230
|
+
var terminalSize2 = 8;
|
|
1231
|
+
var offsetToAlignTerminalWithLine2 = (strokeSize2 - terminalSize2) / 2;
|
|
1232
|
+
var TreeDropIndicator = ({ instruction, gap = 0 }) => {
|
|
1233
|
+
const lineOffset = `calc(-0.5 * (${gap}px + ${strokeSize2}px))`;
|
|
1234
|
+
const isBlocked = instruction.type === "instruction-blocked";
|
|
1235
|
+
const desiredInstruction = isBlocked ? instruction.desired : instruction;
|
|
1236
|
+
const orientation = edgeToOrientationMap2[desiredInstruction.type];
|
|
1237
|
+
if (isBlocked) {
|
|
1238
|
+
return null;
|
|
1239
|
+
}
|
|
1240
|
+
return /* @__PURE__ */ React22.createElement("div", {
|
|
1241
|
+
style: {
|
|
1242
|
+
"--line-thickness": `${strokeSize2}px`,
|
|
1243
|
+
"--line-offset": `${lineOffset}`,
|
|
1244
|
+
"--terminal-size": `${terminalSize2}px`,
|
|
1245
|
+
"--terminal-radius": `${terminalSize2 / 2}px`,
|
|
1246
|
+
"--negative-terminal-size": `-${terminalSize2}px`,
|
|
1247
|
+
"--offset-terminal": `${offsetToAlignTerminalWithLine2}px`,
|
|
1248
|
+
"--horizontal-indent": `${desiredInstruction.currentLevel * desiredInstruction.indentPerLevel + 4}px`
|
|
1249
|
+
},
|
|
1250
|
+
className: `absolute z-10 pointer-events-none before:is-[--terminal-size] before:bs-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles2[orientation]} ${instructionStyles[desiredInstruction.type]}`
|
|
1251
|
+
});
|
|
1252
|
+
};
|
|
1253
|
+
|
|
1254
|
+
// packages/ui/react-ui/src/components/Lists/Tree.tsx
|
|
1255
|
+
var TreeRoot = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
1256
|
+
return /* @__PURE__ */ React23.createElement(List, {
|
|
1257
|
+
...props,
|
|
1208
1258
|
ref: forwardedRef
|
|
1209
1259
|
});
|
|
1210
1260
|
});
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.RadioItem, {
|
|
1217
|
-
...menuScope,
|
|
1218
|
-
...radioItemProps,
|
|
1261
|
+
var TreeBranch = /* @__PURE__ */ forwardRef15(({ __listScope, ...props }, forwardedRef) => {
|
|
1262
|
+
const { headingId } = useListItemContext(LIST_ITEM_NAME, __listScope);
|
|
1263
|
+
return /* @__PURE__ */ React23.createElement(List, {
|
|
1264
|
+
...props,
|
|
1265
|
+
"aria-labelledby": headingId,
|
|
1219
1266
|
ref: forwardedRef
|
|
1220
1267
|
});
|
|
1221
1268
|
});
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1227
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.ItemIndicator, {
|
|
1228
|
-
...menuScope,
|
|
1229
|
-
...itemIndicatorProps,
|
|
1230
|
-
ref: forwardedRef
|
|
1231
|
-
});
|
|
1232
|
-
});
|
|
1233
|
-
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
1234
|
-
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
1235
|
-
var DropdownMenuSeparator = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1236
|
-
const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
|
|
1237
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1238
|
-
const { tx } = useThemeContext();
|
|
1239
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Separator, {
|
|
1240
|
-
...menuScope,
|
|
1241
|
-
...separatorProps,
|
|
1242
|
-
className: tx("menu.separator", "menu__item", {}, classNames),
|
|
1243
|
-
ref: forwardedRef
|
|
1244
|
-
});
|
|
1245
|
-
});
|
|
1246
|
-
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
1247
|
-
var ARROW_NAME = "DropdownMenuArrow";
|
|
1248
|
-
var DropdownMenuArrow = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1249
|
-
const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
|
|
1250
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1251
|
-
const { tx } = useThemeContext();
|
|
1252
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Arrow, {
|
|
1253
|
-
...menuScope,
|
|
1254
|
-
...arrowProps,
|
|
1255
|
-
className: tx("menu.arrow", "menu__arrow", {}, classNames),
|
|
1269
|
+
var TreeItemRoot = /* @__PURE__ */ forwardRef15((props, forwardedRef) => {
|
|
1270
|
+
return /* @__PURE__ */ React23.createElement(ListItem.Root, {
|
|
1271
|
+
role: "treeitem",
|
|
1272
|
+
...props,
|
|
1256
1273
|
ref: forwardedRef
|
|
1257
1274
|
});
|
|
1258
1275
|
});
|
|
1259
|
-
|
|
1260
|
-
var
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
onChange: onOpenChange
|
|
1267
|
-
});
|
|
1268
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.Sub, {
|
|
1269
|
-
...menuScope,
|
|
1270
|
-
open,
|
|
1271
|
-
onOpenChange: setOpen
|
|
1272
|
-
}, children);
|
|
1276
|
+
var TreeItemHeading = ListItem.Heading;
|
|
1277
|
+
var TreeItemOpenTrigger = ListItem.OpenTrigger;
|
|
1278
|
+
var MockTreeItemOpenTrigger = ListItem.MockOpenTrigger;
|
|
1279
|
+
var TreeItemBody = ListItem.CollapsibleContent;
|
|
1280
|
+
var Tree = {
|
|
1281
|
+
Root: TreeRoot,
|
|
1282
|
+
Branch: TreeBranch
|
|
1273
1283
|
};
|
|
1274
|
-
var
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
ref: forwardedRef
|
|
1282
|
-
});
|
|
1283
|
-
});
|
|
1284
|
-
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
1285
|
-
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
|
1286
|
-
var DropdownMenuSubContent = /* @__PURE__ */ forwardRef14((props, forwardedRef) => {
|
|
1287
|
-
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
1288
|
-
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1289
|
-
return /* @__PURE__ */ React20.createElement(MenuPrimitive.SubContent, {
|
|
1290
|
-
...menuScope,
|
|
1291
|
-
...subContentProps,
|
|
1292
|
-
ref: forwardedRef,
|
|
1293
|
-
style: {
|
|
1294
|
-
...props.style,
|
|
1295
|
-
// re-namespace exposed content custom properties
|
|
1296
|
-
...{
|
|
1297
|
-
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1298
|
-
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1299
|
-
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1300
|
-
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1301
|
-
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
});
|
|
1305
|
-
});
|
|
1306
|
-
DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
1307
|
-
var DropdownMenu = {
|
|
1308
|
-
Root: DropdownMenuRoot,
|
|
1309
|
-
Trigger: DropdownMenuTrigger,
|
|
1310
|
-
VirtualTrigger: DropdownMenuVirtualTrigger,
|
|
1311
|
-
Portal: DropdownMenuPortal,
|
|
1312
|
-
Content: DropdownMenuContent,
|
|
1313
|
-
Viewport: DropdownMenuViewport,
|
|
1314
|
-
Group: DropdownMenuGroup,
|
|
1315
|
-
GroupLabel: DropdownMenuGroupLabel,
|
|
1316
|
-
Item: DropdownMenuItem,
|
|
1317
|
-
CheckboxItem: DropdownMenuCheckboxItem,
|
|
1318
|
-
RadioGroup: DropdownMenuRadioGroup,
|
|
1319
|
-
RadioItem: DropdownMenuRadioItem,
|
|
1320
|
-
ItemIndicator: DropdownMenuItemIndicator,
|
|
1321
|
-
Separator: DropdownMenuSeparator,
|
|
1322
|
-
Arrow: DropdownMenuArrow,
|
|
1323
|
-
Sub: DropdownMenuSub,
|
|
1324
|
-
SubTrigger: DropdownMenuSubTrigger,
|
|
1325
|
-
SubContent: DropdownMenuSubContent
|
|
1284
|
+
var TreeItem = {
|
|
1285
|
+
Root: TreeItemRoot,
|
|
1286
|
+
Heading: TreeItemHeading,
|
|
1287
|
+
Body: TreeItemBody,
|
|
1288
|
+
OpenTrigger: TreeItemOpenTrigger,
|
|
1289
|
+
MockOpenTrigger: MockTreeItemOpenTrigger,
|
|
1290
|
+
DropIndicator: TreeDropIndicator
|
|
1326
1291
|
};
|
|
1327
|
-
var useDropdownMenuMenuScope = useMenuScope;
|
|
1328
1292
|
|
|
1329
|
-
// packages/ui/react-ui/src/components/
|
|
1330
|
-
import {
|
|
1293
|
+
// packages/ui/react-ui/src/components/Lists/Treegrid.tsx
|
|
1294
|
+
import { useArrowNavigationGroup, useFocusableGroup } from "@fluentui/react-tabster";
|
|
1295
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
1296
|
+
import { Primitive as Primitive6 } from "@radix-ui/react-primitive";
|
|
1297
|
+
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
1331
1298
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1332
|
-
import
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
var
|
|
1299
|
+
import React24, { forwardRef as forwardRef16 } from "react";
|
|
1300
|
+
var TREEGRID_ROW_NAME = "TreegridRow";
|
|
1301
|
+
var [createTreegridRowContext, createTreegridRowScope] = createContextScope(TREEGRID_ROW_NAME, []);
|
|
1302
|
+
var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
|
|
1303
|
+
var PATH_SEPARATOR = "~";
|
|
1304
|
+
var PARENT_OF_SEPARATOR = " ";
|
|
1305
|
+
var TreegridRoot = /* @__PURE__ */ forwardRef16(({ asChild, classNames, children, style, gridTemplateColumns, ...props }, forwardedRef) => {
|
|
1336
1306
|
const { tx } = useThemeContext();
|
|
1337
|
-
|
|
1307
|
+
const Root5 = asChild ? Slot7 : Primitive6.div;
|
|
1308
|
+
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
1309
|
+
axis: "vertical",
|
|
1310
|
+
tabbable: false,
|
|
1311
|
+
circular: true
|
|
1312
|
+
});
|
|
1313
|
+
return /* @__PURE__ */ React24.createElement(Root5, {
|
|
1314
|
+
role: "treegrid",
|
|
1315
|
+
...arrowNavigationAttrs,
|
|
1338
1316
|
...props,
|
|
1339
|
-
className: tx("
|
|
1340
|
-
|
|
1341
|
-
|
|
1317
|
+
className: tx("treegrid.root", "treegrid", {}, classNames),
|
|
1318
|
+
style: {
|
|
1319
|
+
...style,
|
|
1320
|
+
gridTemplateColumns
|
|
1321
|
+
},
|
|
1342
1322
|
ref: forwardedRef
|
|
1343
1323
|
}, children);
|
|
1344
1324
|
});
|
|
1345
|
-
var
|
|
1325
|
+
var TreegridRow = /* @__PURE__ */ forwardRef16(({ __treegridRowScope, asChild, classNames, children, id, parentOf, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, ...props }, forwardedRef) => {
|
|
1346
1326
|
const { tx } = useThemeContext();
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1327
|
+
const Root5 = asChild ? Slot7 : Primitive6.div;
|
|
1328
|
+
const pathParts = id.split(PATH_SEPARATOR);
|
|
1329
|
+
const level = pathParts.length - 1;
|
|
1330
|
+
const [open, onOpenChange] = useControllableState2({
|
|
1331
|
+
prop: propsOpen,
|
|
1332
|
+
onChange: propsOnOpenChange,
|
|
1333
|
+
defaultProp: defaultOpen
|
|
1334
|
+
});
|
|
1335
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
1336
|
+
tabBehavior: "limited"
|
|
1337
|
+
});
|
|
1338
|
+
const arrowGroupAttrs = useArrowNavigationGroup({
|
|
1339
|
+
axis: "horizontal",
|
|
1340
|
+
tabbable: false,
|
|
1341
|
+
circular: false,
|
|
1342
|
+
memorizeCurrent: false
|
|
1343
|
+
});
|
|
1344
|
+
return /* @__PURE__ */ React24.createElement(TreegridRowProvider, {
|
|
1345
|
+
open,
|
|
1346
|
+
onOpenChange,
|
|
1347
|
+
scope: __treegridRowScope
|
|
1348
|
+
}, /* @__PURE__ */ React24.createElement(Root5, {
|
|
1349
|
+
role: "row",
|
|
1350
|
+
"aria-level": level,
|
|
1351
|
+
className: tx("treegrid.row", "treegrid__row", {
|
|
1352
|
+
level
|
|
1351
1353
|
}, classNames),
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
return /* @__PURE__ */ React21.createElement(ValidationPrimitive, {
|
|
1354
|
+
...parentOf && {
|
|
1355
|
+
"aria-expanded": open,
|
|
1356
|
+
"aria-owns": parentOf
|
|
1357
|
+
},
|
|
1358
|
+
tabIndex: 0,
|
|
1359
|
+
...focusableGroupAttrs,
|
|
1359
1360
|
...props,
|
|
1360
|
-
|
|
1361
|
-
srOnly,
|
|
1362
|
-
validationValence
|
|
1363
|
-
}, classNames),
|
|
1361
|
+
id,
|
|
1364
1362
|
ref: forwardedRef
|
|
1365
|
-
},
|
|
1363
|
+
}, /* @__PURE__ */ React24.createElement("div", {
|
|
1364
|
+
role: "none",
|
|
1365
|
+
className: "contents",
|
|
1366
|
+
...arrowGroupAttrs
|
|
1367
|
+
}, children)));
|
|
1366
1368
|
});
|
|
1367
|
-
var
|
|
1369
|
+
var TreegridCell = /* @__PURE__ */ forwardRef16(({ classNames, children, indent, ...props }, forwardedRef) => {
|
|
1368
1370
|
const { tx } = useThemeContext();
|
|
1369
|
-
return /* @__PURE__ */
|
|
1370
|
-
|
|
1371
|
-
className: tx("
|
|
1372
|
-
|
|
1371
|
+
return /* @__PURE__ */ React24.createElement("div", {
|
|
1372
|
+
role: "gridcell",
|
|
1373
|
+
className: tx("treegrid.cell", "treegrid__cell", {
|
|
1374
|
+
indent
|
|
1373
1375
|
}, classNames),
|
|
1376
|
+
...props,
|
|
1374
1377
|
ref: forwardedRef
|
|
1375
1378
|
}, children);
|
|
1376
1379
|
});
|
|
1377
|
-
var
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1380
|
+
var Treegrid = {
|
|
1381
|
+
Root: TreegridRoot,
|
|
1382
|
+
Row: TreegridRow,
|
|
1383
|
+
Cell: TreegridCell,
|
|
1384
|
+
PARENT_OF_SEPARATOR,
|
|
1385
|
+
PATH_SEPARATOR,
|
|
1386
|
+
createTreegridRowScope,
|
|
1387
|
+
useTreegridRowContext
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1390
|
+
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1391
|
+
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
1392
|
+
import { Root as DialogRoot2, DialogContent as DialogContent2, DialogTitle as DialogTitle2 } from "@radix-ui/react-dialog";
|
|
1393
|
+
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
1394
|
+
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
1395
|
+
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
1396
|
+
import React25, { forwardRef as forwardRef17, useCallback as useCallback6, useEffect as useEffect4, useRef, useState as useState8 } from "react";
|
|
1397
|
+
import { log } from "@dxos/log";
|
|
1398
|
+
import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
|
|
1399
|
+
|
|
1400
|
+
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1401
|
+
import { useCallback as useCallback5, useEffect as useEffect3, useState as useState7 } from "react";
|
|
1402
|
+
var MotionState;
|
|
1403
|
+
(function(MotionState2) {
|
|
1404
|
+
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
1405
|
+
MotionState2[MotionState2["DEBOUNCING"] = 1] = "DEBOUNCING";
|
|
1406
|
+
MotionState2[MotionState2["FOLLOWING"] = 2] = "FOLLOWING";
|
|
1407
|
+
})(MotionState || (MotionState = {}));
|
|
1408
|
+
var useSwipeToDismiss = (ref, {
|
|
1409
|
+
onDismiss,
|
|
1410
|
+
dismissThreshold = 64,
|
|
1411
|
+
debounceThreshold = 8,
|
|
1412
|
+
offset = 0
|
|
1413
|
+
/* side = 'inline-start' */
|
|
1414
|
+
}) => {
|
|
1415
|
+
const $root = ref.current;
|
|
1416
|
+
const [motionState, setMotionState] = useState7(0);
|
|
1417
|
+
const [gestureStartX, setGestureStartX] = useState7(0);
|
|
1418
|
+
const setIdle = useCallback5(() => {
|
|
1419
|
+
setMotionState(0);
|
|
1420
|
+
$root?.style.removeProperty("inset-inline-start");
|
|
1421
|
+
$root?.style.setProperty("transition-duration", "200ms");
|
|
1422
|
+
}, [
|
|
1423
|
+
$root
|
|
1395
1424
|
]);
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
const
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1425
|
+
const setFollowing = useCallback5(() => {
|
|
1426
|
+
setMotionState(2);
|
|
1427
|
+
$root?.style.setProperty("transition-duration", "0ms");
|
|
1428
|
+
}, [
|
|
1429
|
+
$root
|
|
1430
|
+
]);
|
|
1431
|
+
const handlePointerDown = useCallback5(({ screenX }) => {
|
|
1432
|
+
if (motionState === 0) {
|
|
1433
|
+
setMotionState(1);
|
|
1434
|
+
setGestureStartX(screenX);
|
|
1435
|
+
}
|
|
1436
|
+
}, [
|
|
1437
|
+
motionState
|
|
1438
|
+
]);
|
|
1439
|
+
const handlePointerMove = useCallback5(({ screenX }) => {
|
|
1440
|
+
if ($root) {
|
|
1441
|
+
const delta = Math.min(screenX - gestureStartX, 0);
|
|
1442
|
+
switch (motionState) {
|
|
1443
|
+
case 2:
|
|
1444
|
+
if (Math.abs(delta) > dismissThreshold) {
|
|
1445
|
+
setIdle();
|
|
1446
|
+
onDismiss?.();
|
|
1447
|
+
} else {
|
|
1448
|
+
$root.style.setProperty("inset-inline-start", `${offset + delta}px`);
|
|
1449
|
+
}
|
|
1450
|
+
break;
|
|
1451
|
+
case 1:
|
|
1452
|
+
if (Math.abs(delta) > debounceThreshold) {
|
|
1453
|
+
setFollowing();
|
|
1454
|
+
}
|
|
1455
|
+
break;
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}, [
|
|
1459
|
+
$root,
|
|
1460
|
+
motionState,
|
|
1461
|
+
gestureStartX
|
|
1462
|
+
]);
|
|
1463
|
+
const handlePointerUp = useCallback5(() => {
|
|
1464
|
+
setIdle();
|
|
1465
|
+
}, [
|
|
1466
|
+
setIdle
|
|
1467
|
+
]);
|
|
1468
|
+
useEffect3(() => {
|
|
1469
|
+
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
1470
|
+
return () => {
|
|
1471
|
+
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
1472
|
+
};
|
|
1473
|
+
}, [
|
|
1474
|
+
$root,
|
|
1475
|
+
handlePointerDown
|
|
1476
|
+
]);
|
|
1477
|
+
useEffect3(() => {
|
|
1478
|
+
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
1479
|
+
return () => {
|
|
1480
|
+
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
1481
|
+
};
|
|
1482
|
+
}, [
|
|
1483
|
+
$root,
|
|
1484
|
+
handlePointerMove
|
|
1485
|
+
]);
|
|
1486
|
+
useEffect3(() => {
|
|
1487
|
+
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
1488
|
+
return () => {
|
|
1489
|
+
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
1490
|
+
};
|
|
1491
|
+
}, [
|
|
1492
|
+
$root,
|
|
1493
|
+
handlePointerUp
|
|
1494
|
+
]);
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1497
|
+
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1498
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui/src/components/Main/Main.tsx";
|
|
1499
|
+
var MAIN_ROOT_NAME = "MainRoot";
|
|
1500
|
+
var NAVIGATION_SIDEBAR_NAME = "NavigationSidebar";
|
|
1501
|
+
var COMPLEMENTARY_SIDEBAR_NAME = "ComplementarySidebar";
|
|
1502
|
+
var MAIN_NAME = "Main";
|
|
1503
|
+
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
1504
|
+
var landmarkAttr = "data-main-landmark";
|
|
1505
|
+
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
1506
|
+
const handleKeyDown = useCallback6((event) => {
|
|
1507
|
+
const target = event.target;
|
|
1508
|
+
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
1509
|
+
event.preventDefault();
|
|
1510
|
+
const landmarks = Array.from(document.querySelectorAll(`[${landmarkAttr}]:not([inert])`)).map((el) => el.hasAttribute(landmarkAttr) ? parseInt(el.getAttribute(landmarkAttr)) : NaN).sort();
|
|
1511
|
+
const l = landmarks.length;
|
|
1512
|
+
const cursor = landmarks.indexOf(parseInt(target.getAttribute(landmarkAttr)));
|
|
1513
|
+
const nextLandmark = landmarks[(cursor + l + (event.getModifierState("Shift") ? -1 : 1)) % l];
|
|
1514
|
+
document.querySelector(`[${landmarkAttr}="${nextLandmark}"]`)?.focus();
|
|
1515
|
+
}
|
|
1516
|
+
propsOnKeyDown?.(event);
|
|
1517
|
+
}, [
|
|
1518
|
+
propsOnKeyDown
|
|
1519
|
+
]);
|
|
1520
|
+
const focusableGroupAttrs = window ? {} : {
|
|
1521
|
+
tabBehavior: "limited",
|
|
1522
|
+
ignoreDefaultKeydown: {
|
|
1523
|
+
Tab: true
|
|
1524
|
+
}
|
|
1525
|
+
};
|
|
1526
|
+
return {
|
|
1527
|
+
onKeyDown: handleKeyDown,
|
|
1528
|
+
[landmarkAttr]: landmark,
|
|
1529
|
+
tabIndex: 0,
|
|
1530
|
+
...focusableGroupAttrs
|
|
1531
|
+
};
|
|
1532
|
+
};
|
|
1533
|
+
var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
1534
|
+
resizing: false,
|
|
1535
|
+
navigationSidebarState: "closed",
|
|
1536
|
+
setNavigationSidebarState: (nextState) => {
|
|
1537
|
+
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
1538
|
+
F: __dxlog_file,
|
|
1539
|
+
L: 82,
|
|
1540
|
+
S: void 0,
|
|
1541
|
+
C: (f, a) => f(...a)
|
|
1542
|
+
});
|
|
1543
|
+
},
|
|
1544
|
+
complementarySidebarState: "closed",
|
|
1545
|
+
setComplementarySidebarState: (nextState) => {
|
|
1546
|
+
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
1547
|
+
F: __dxlog_file,
|
|
1548
|
+
L: 87,
|
|
1549
|
+
S: void 0,
|
|
1550
|
+
C: (f, a) => f(...a)
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1429
1553
|
});
|
|
1430
|
-
var
|
|
1431
|
-
const {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1554
|
+
var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
1555
|
+
const { setNavigationSidebarState, navigationSidebarState, setComplementarySidebarState, complementarySidebarState } = useMainContext(consumerName);
|
|
1556
|
+
return {
|
|
1557
|
+
navigationSidebarState,
|
|
1558
|
+
setNavigationSidebarState,
|
|
1559
|
+
toggleNavigationSidebar: useCallback6(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
1560
|
+
navigationSidebarState,
|
|
1561
|
+
setNavigationSidebarState
|
|
1562
|
+
]),
|
|
1563
|
+
openNavigationSidebar: useCallback6(() => setNavigationSidebarState("expanded"), []),
|
|
1564
|
+
collapseNavigationSidebar: useCallback6(() => setNavigationSidebarState("collapsed"), []),
|
|
1565
|
+
closeNavigationSidebar: useCallback6(() => setNavigationSidebarState("closed"), []),
|
|
1566
|
+
complementarySidebarState,
|
|
1567
|
+
setComplementarySidebarState,
|
|
1568
|
+
toggleComplementarySidebar: useCallback6(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
1569
|
+
complementarySidebarState,
|
|
1570
|
+
setComplementarySidebarState
|
|
1571
|
+
]),
|
|
1572
|
+
openComplementarySidebar: useCallback6(() => setComplementarySidebarState("expanded"), []),
|
|
1573
|
+
collapseComplementarySidebar: useCallback6(() => setComplementarySidebarState("collapsed"), []),
|
|
1574
|
+
closeComplementarySidebar: useCallback6(() => setComplementarySidebarState("closed"), [])
|
|
1575
|
+
};
|
|
1576
|
+
};
|
|
1577
|
+
var resizeDebounce = 3e3;
|
|
1578
|
+
var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState, onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState, onComplementarySidebarStateChange, children, ...props }) => {
|
|
1579
|
+
const [isLg] = useMediaQuery("lg", {
|
|
1580
|
+
ssr: false
|
|
1449
1581
|
});
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
defaultProp: propsDefaultChecked,
|
|
1455
|
-
onChange: propsOnCheckedChange
|
|
1582
|
+
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState3({
|
|
1583
|
+
prop: propsNavigationSidebarState,
|
|
1584
|
+
defaultProp: defaultNavigationSidebarState,
|
|
1585
|
+
onChange: onNavigationSidebarStateChange
|
|
1456
1586
|
});
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
checked,
|
|
1462
|
-
onCheckedChange,
|
|
1463
|
-
id,
|
|
1464
|
-
"aria-describedby": descriptionId,
|
|
1465
|
-
...validationValence === "error" && {
|
|
1466
|
-
"aria-invalid": "true",
|
|
1467
|
-
"aria-errormessage": errorMessageId
|
|
1468
|
-
},
|
|
1469
|
-
className: tx("input.checkbox", "input--checkbox", {
|
|
1470
|
-
size
|
|
1471
|
-
}, "shrink-0", classNames),
|
|
1472
|
-
ref: forwardedRef
|
|
1473
|
-
}, /* @__PURE__ */ React21.createElement(Icon, {
|
|
1474
|
-
icon: checked === "indeterminate" ? "ph--minus--regular" : "ph--check--regular",
|
|
1475
|
-
classNames: tx("input.checkboxIndicator", "input--checkbox__indicator", {
|
|
1476
|
-
size,
|
|
1477
|
-
checked
|
|
1478
|
-
})
|
|
1479
|
-
}));
|
|
1480
|
-
});
|
|
1481
|
-
var Switch = /* @__PURE__ */ forwardRef15(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, classNames, ...props }, forwardedRef) => {
|
|
1482
|
-
const [checked, onCheckedChange] = useControllableState2({
|
|
1483
|
-
prop: propsChecked,
|
|
1484
|
-
defaultProp: propsDefaultChecked ?? false,
|
|
1485
|
-
onChange: propsOnCheckedChange
|
|
1587
|
+
const [complementarySidebarState = isLg ? "expanded" : "collapsed", setComplementarySidebarState] = useControllableState3({
|
|
1588
|
+
prop: propsComplementarySidebarState,
|
|
1589
|
+
defaultProp: defaultComplementarySidebarState,
|
|
1590
|
+
onChange: onComplementarySidebarStateChange
|
|
1486
1591
|
});
|
|
1487
|
-
const
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1592
|
+
const [resizing, setResizing] = useState8(false);
|
|
1593
|
+
const resizeInterval = useRef(null);
|
|
1594
|
+
const handleResize = useCallback6(() => {
|
|
1595
|
+
setResizing(true);
|
|
1596
|
+
if (resizeInterval.current) {
|
|
1597
|
+
clearTimeout(resizeInterval.current);
|
|
1598
|
+
}
|
|
1599
|
+
resizeInterval.current = setTimeout(() => {
|
|
1600
|
+
setResizing(false);
|
|
1601
|
+
resizeInterval.current = null;
|
|
1602
|
+
}, resizeDebounce);
|
|
1603
|
+
}, []);
|
|
1604
|
+
useEffect4(() => {
|
|
1605
|
+
window.addEventListener("resize", handleResize);
|
|
1606
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
1607
|
+
}, [
|
|
1608
|
+
handleResize
|
|
1609
|
+
]);
|
|
1610
|
+
return /* @__PURE__ */ React25.createElement(MainProvider, {
|
|
1497
1611
|
...props,
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
});
|
|
1504
|
-
});
|
|
1505
|
-
var Input = {
|
|
1506
|
-
Root: InputRoot,
|
|
1507
|
-
PinInput,
|
|
1508
|
-
TextInput,
|
|
1509
|
-
TextArea,
|
|
1510
|
-
Checkbox,
|
|
1511
|
-
Switch,
|
|
1512
|
-
Label: Label3,
|
|
1513
|
-
Description,
|
|
1514
|
-
Validation,
|
|
1515
|
-
DescriptionAndValidation
|
|
1516
|
-
};
|
|
1517
|
-
|
|
1518
|
-
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1519
|
-
import { CaretDown, CaretRight } from "@phosphor-icons/react";
|
|
1520
|
-
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
1521
|
-
import React23, { forwardRef as forwardRef16 } from "react";
|
|
1522
|
-
import { List as ListPrimitive, ListItemHeading as ListPrimitiveItemHeading, ListItemOpenTrigger as ListPrimitiveItemOpenTrigger, ListItemCollapsibleContent, ListItem as ListPrimitiveItem, LIST_NAME, LIST_ITEM_NAME, useListContext, useListItemContext } from "@dxos/react-list";
|
|
1523
|
-
|
|
1524
|
-
// packages/ui/react-ui/src/components/Lists/ListDropIndicator.tsx
|
|
1525
|
-
import React22 from "react";
|
|
1526
|
-
var edgeToOrientationMap = {
|
|
1527
|
-
top: "horizontal",
|
|
1528
|
-
bottom: "horizontal",
|
|
1529
|
-
left: "vertical",
|
|
1530
|
-
right: "vertical"
|
|
1531
|
-
};
|
|
1532
|
-
var orientationStyles = {
|
|
1533
|
-
horizontal: "h-[--line-thickness] left-[calc(var(--line-inset)+var(--terminal-radius))] right-[--line-inset] before:left-[--terminal-inset]",
|
|
1534
|
-
vertical: "w-[--line-thickness] top-[calc(var(--line-inset)+var(--terminal-radius))] bottom-[--line-inset] before:top-[--terminal-inset]"
|
|
1612
|
+
navigationSidebarState,
|
|
1613
|
+
setNavigationSidebarState,
|
|
1614
|
+
complementarySidebarState,
|
|
1615
|
+
setComplementarySidebarState,
|
|
1616
|
+
resizing
|
|
1617
|
+
}, children);
|
|
1535
1618
|
};
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
bottom: "bottom-[--line-offset] before:bottom-[--offset-terminal]",
|
|
1540
|
-
left: "left-[--line-offset] before:left-[--offset-terminal]"
|
|
1619
|
+
MainRoot.displayName = MAIN_ROOT_NAME;
|
|
1620
|
+
var handleOpenAutoFocus = (event) => {
|
|
1621
|
+
!document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
|
|
1541
1622
|
};
|
|
1542
|
-
var
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
var ListDropIndicator = ({ edge, gap = 0, lineInset = 0, terminalInset = lineInset - terminalSize }) => {
|
|
1546
|
-
const orientation = edgeToOrientationMap[edge];
|
|
1547
|
-
return /* @__PURE__ */ React22.createElement("div", {
|
|
1548
|
-
role: "none",
|
|
1549
|
-
style: {
|
|
1550
|
-
"--line-thickness": `${strokeSize}px`,
|
|
1551
|
-
"--line-offset": `calc(-0.5 * (${gap}px + ${strokeSize}px))`,
|
|
1552
|
-
"--line-inset": `${lineInset}px`,
|
|
1553
|
-
"--terminal-size": `${terminalSize}px`,
|
|
1554
|
-
"--terminal-radius": `${terminalSize / 2}px`,
|
|
1555
|
-
"--terminal-inset": `${terminalInset}px`,
|
|
1556
|
-
"--offset-terminal": `${offsetToAlignTerminalWithLine}px`
|
|
1557
|
-
},
|
|
1558
|
-
className: `absolute z-10 pointer-events-none bg-accentSurface before:content-[''] before:w-[--terminal-size] before:h-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles[orientation]} ${edgeStyles[edge]}`
|
|
1623
|
+
var MainSidebar = /* @__PURE__ */ forwardRef17(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
|
|
1624
|
+
const [isLg] = useMediaQuery("lg", {
|
|
1625
|
+
ssr: false
|
|
1559
1626
|
});
|
|
1560
|
-
};
|
|
1561
|
-
|
|
1562
|
-
// packages/ui/react-ui/src/components/Lists/List.tsx
|
|
1563
|
-
var List = /* @__PURE__ */ forwardRef16(({ classNames, children, ...props }, forwardedRef) => {
|
|
1564
1627
|
const { tx } = useThemeContext();
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1628
|
+
const { t } = useTranslation();
|
|
1629
|
+
const ref = useForwardedRef(forwardedRef);
|
|
1630
|
+
const noopRef = useRef(null);
|
|
1631
|
+
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
1632
|
+
onDismiss: () => onStateChange?.("closed")
|
|
1633
|
+
});
|
|
1634
|
+
const handleKeyDown = useCallback6((event) => {
|
|
1635
|
+
if (event.key === "Escape") {
|
|
1636
|
+
event.target.closest("[data-tabster]")?.focus();
|
|
1637
|
+
}
|
|
1638
|
+
props.onKeyDown?.(event);
|
|
1639
|
+
}, [
|
|
1640
|
+
props.onKeyDown
|
|
1641
|
+
]);
|
|
1642
|
+
const Root5 = isLg ? Primitive7.div : DialogContent2;
|
|
1643
|
+
return /* @__PURE__ */ React25.createElement(DialogRoot2, {
|
|
1644
|
+
open: state !== "closed",
|
|
1645
|
+
"aria-label": toLocalizedString(label, t),
|
|
1646
|
+
modal: false
|
|
1647
|
+
}, !isLg && /* @__PURE__ */ React25.createElement(DialogTitle2, {
|
|
1648
|
+
className: "sr-only"
|
|
1649
|
+
}, toLocalizedString(label, t)), /* @__PURE__ */ React25.createElement(Root5, {
|
|
1650
|
+
...!isLg && {
|
|
1651
|
+
forceMount: true,
|
|
1652
|
+
tabIndex: -1,
|
|
1653
|
+
onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
|
|
1654
|
+
},
|
|
1569
1655
|
...props,
|
|
1570
|
-
|
|
1571
|
-
|
|
1656
|
+
"data-side": side === "inline-end" ? "ie" : "is",
|
|
1657
|
+
"data-state": state,
|
|
1658
|
+
"data-resizing": resizing ? "true" : "false",
|
|
1659
|
+
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
1660
|
+
onKeyDown: handleKeyDown,
|
|
1661
|
+
...state === "closed" && {
|
|
1662
|
+
inert: "true"
|
|
1663
|
+
},
|
|
1664
|
+
ref
|
|
1572
1665
|
}, children));
|
|
1573
1666
|
});
|
|
1574
|
-
var
|
|
1575
|
-
const
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
...!asChild && {
|
|
1580
|
-
role: "none"
|
|
1581
|
-
},
|
|
1667
|
+
var MainNavigationSidebar = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
1668
|
+
const { navigationSidebarState, setNavigationSidebarState, resizing } = useMainContext(NAVIGATION_SIDEBAR_NAME);
|
|
1669
|
+
const mover = useLandmarkMover(props.onKeyDown, "0");
|
|
1670
|
+
return /* @__PURE__ */ React25.createElement(MainSidebar, {
|
|
1671
|
+
...mover,
|
|
1582
1672
|
...props,
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1673
|
+
state: navigationSidebarState,
|
|
1674
|
+
onStateChange: setNavigationSidebarState,
|
|
1675
|
+
resizing,
|
|
1676
|
+
side: "inline-start",
|
|
1586
1677
|
ref: forwardedRef
|
|
1587
|
-
}, children);
|
|
1588
|
-
});
|
|
1589
|
-
var MockListItemOpenTrigger = ({ classNames, ...props }) => {
|
|
1590
|
-
const density = useDensityContext();
|
|
1591
|
-
const { tx } = useThemeContext();
|
|
1592
|
-
return /* @__PURE__ */ React23.createElement("div", {
|
|
1593
|
-
role: "none",
|
|
1594
|
-
...props,
|
|
1595
|
-
className: tx("list.item.openTrigger", "list__listItem__openTrigger--mock", {
|
|
1596
|
-
density
|
|
1597
|
-
}, classNames)
|
|
1598
1678
|
});
|
|
1599
|
-
};
|
|
1600
|
-
var ListItemHeading = /* @__PURE__ */ forwardRef16(({ children, classNames, ...props }, forwardedRef) => {
|
|
1601
|
-
const { tx } = useThemeContext();
|
|
1602
|
-
const density = useDensityContext();
|
|
1603
|
-
return /* @__PURE__ */ React23.createElement(ListPrimitiveItemHeading, {
|
|
1604
|
-
...props,
|
|
1605
|
-
className: tx("list.item.heading", "list__listItem__heading", {
|
|
1606
|
-
density
|
|
1607
|
-
}, classNames),
|
|
1608
|
-
ref: forwardedRef
|
|
1609
|
-
}, children);
|
|
1610
|
-
});
|
|
1611
|
-
var ListItemOpenTrigger = /* @__PURE__ */ forwardRef16(({ __listItemScope, classNames, children, ...props }, forwardedRef) => {
|
|
1612
|
-
const { tx } = useThemeContext();
|
|
1613
|
-
const density = useDensityContext();
|
|
1614
|
-
const { open } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
1615
|
-
const Icon3 = open ? CaretDown : CaretRight;
|
|
1616
|
-
return /* @__PURE__ */ React23.createElement(ListPrimitiveItemOpenTrigger, {
|
|
1617
|
-
...props,
|
|
1618
|
-
className: tx("list.item.openTrigger", "list__listItem__openTrigger", {
|
|
1619
|
-
density
|
|
1620
|
-
}, classNames),
|
|
1621
|
-
ref: forwardedRef
|
|
1622
|
-
}, children || /* @__PURE__ */ React23.createElement(Icon3, {
|
|
1623
|
-
weight: "bold",
|
|
1624
|
-
className: tx("list.item.openTriggerIcon", "list__listItem__openTrigger__icon", {})
|
|
1625
|
-
}));
|
|
1626
1679
|
});
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
density,
|
|
1634
|
-
collapsible: props.collapsible
|
|
1635
|
-
}, classNames),
|
|
1636
|
-
ref: forwardedRef
|
|
1637
|
-
}, children);
|
|
1638
|
-
});
|
|
1639
|
-
var ListItem = {
|
|
1640
|
-
Root: ListItemRoot,
|
|
1641
|
-
Endcap: ListItemEndcap,
|
|
1642
|
-
Heading: ListItemHeading,
|
|
1643
|
-
OpenTrigger: ListItemOpenTrigger,
|
|
1644
|
-
CollapsibleContent: ListItemCollapsibleContent,
|
|
1645
|
-
MockOpenTrigger: MockListItemOpenTrigger,
|
|
1646
|
-
DropIndicator: ListDropIndicator
|
|
1647
|
-
};
|
|
1648
|
-
|
|
1649
|
-
// packages/ui/react-ui/src/components/Lists/Tree.tsx
|
|
1650
|
-
import React25, { forwardRef as forwardRef17 } from "react";
|
|
1651
|
-
|
|
1652
|
-
// packages/ui/react-ui/src/components/Lists/TreeDropIndicator.tsx
|
|
1653
|
-
import React24 from "react";
|
|
1654
|
-
var edgeToOrientationMap2 = {
|
|
1655
|
-
"reorder-above": "sibling",
|
|
1656
|
-
"reorder-below": "sibling",
|
|
1657
|
-
"make-child": "child",
|
|
1658
|
-
reparent: "child"
|
|
1659
|
-
};
|
|
1660
|
-
var orientationStyles2 = {
|
|
1661
|
-
// TODO(wittjosiah): Stop using left/right here.
|
|
1662
|
-
sibling: "bs-[--line-thickness] left-[--horizontal-indent] right-0 bg-accentSurface before:left-[--negative-terminal-size]",
|
|
1663
|
-
child: "is-full block-start-0 block-end-0 border-[length:--line-thickness] before:invisible"
|
|
1664
|
-
};
|
|
1665
|
-
var instructionStyles = {
|
|
1666
|
-
"reorder-above": "block-start-[--line-offset] before:block-start-[--offset-terminal]",
|
|
1667
|
-
"reorder-below": "block-end-[--line-offset] before:block-end-[--offset-terminal]",
|
|
1668
|
-
"make-child": "border-accentSurface",
|
|
1669
|
-
// TODO(wittjosiah): This is not occurring in the current implementation.
|
|
1670
|
-
reparent: ""
|
|
1671
|
-
};
|
|
1672
|
-
var strokeSize2 = 2;
|
|
1673
|
-
var terminalSize2 = 8;
|
|
1674
|
-
var offsetToAlignTerminalWithLine2 = (strokeSize2 - terminalSize2) / 2;
|
|
1675
|
-
var TreeDropIndicator = ({ instruction, gap = 0 }) => {
|
|
1676
|
-
const lineOffset = `calc(-0.5 * (${gap}px + ${strokeSize2}px))`;
|
|
1677
|
-
const isBlocked = instruction.type === "instruction-blocked";
|
|
1678
|
-
const desiredInstruction = isBlocked ? instruction.desired : instruction;
|
|
1679
|
-
const orientation = edgeToOrientationMap2[desiredInstruction.type];
|
|
1680
|
-
if (isBlocked) {
|
|
1681
|
-
return null;
|
|
1682
|
-
}
|
|
1683
|
-
return /* @__PURE__ */ React24.createElement("div", {
|
|
1684
|
-
style: {
|
|
1685
|
-
"--line-thickness": `${strokeSize2}px`,
|
|
1686
|
-
"--line-offset": `${lineOffset}`,
|
|
1687
|
-
"--terminal-size": `${terminalSize2}px`,
|
|
1688
|
-
"--terminal-radius": `${terminalSize2 / 2}px`,
|
|
1689
|
-
"--negative-terminal-size": `-${terminalSize2}px`,
|
|
1690
|
-
"--offset-terminal": `${offsetToAlignTerminalWithLine2}px`,
|
|
1691
|
-
"--horizontal-indent": `${desiredInstruction.currentLevel * desiredInstruction.indentPerLevel + 4}px`
|
|
1692
|
-
},
|
|
1693
|
-
className: `absolute z-10 pointer-events-none before:is-[--terminal-size] before:bs-[--terminal-size] box-border before:absolute before:border-[length:--line-thickness] before:border-solid before:border-accentSurface before:rounded-full ${orientationStyles2[orientation]} ${instructionStyles[desiredInstruction.type]}`
|
|
1694
|
-
});
|
|
1695
|
-
};
|
|
1696
|
-
|
|
1697
|
-
// packages/ui/react-ui/src/components/Lists/Tree.tsx
|
|
1698
|
-
var TreeRoot = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
1699
|
-
return /* @__PURE__ */ React25.createElement(List, {
|
|
1680
|
+
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
1681
|
+
var MainComplementarySidebar = /* @__PURE__ */ forwardRef17((props, forwardedRef) => {
|
|
1682
|
+
const { complementarySidebarState, setComplementarySidebarState, resizing } = useMainContext(COMPLEMENTARY_SIDEBAR_NAME);
|
|
1683
|
+
const mover = useLandmarkMover(props.onKeyDown, "2");
|
|
1684
|
+
return /* @__PURE__ */ React25.createElement(MainSidebar, {
|
|
1685
|
+
...mover,
|
|
1700
1686
|
...props,
|
|
1687
|
+
state: complementarySidebarState,
|
|
1688
|
+
onStateChange: setComplementarySidebarState,
|
|
1689
|
+
resizing,
|
|
1690
|
+
side: "inline-end",
|
|
1701
1691
|
ref: forwardedRef
|
|
1702
1692
|
});
|
|
1703
1693
|
});
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1694
|
+
MainNavigationSidebar.displayName = NAVIGATION_SIDEBAR_NAME;
|
|
1695
|
+
var MainContent = /* @__PURE__ */ forwardRef17(({ asChild, classNames, bounce, handlesFocus, children, role, ...props }, forwardedRef) => {
|
|
1696
|
+
const { navigationSidebarState, complementarySidebarState } = useMainContext(MAIN_NAME);
|
|
1697
|
+
const { tx } = useThemeContext();
|
|
1698
|
+
const Root5 = asChild ? Slot8 : role ? "div" : "main";
|
|
1699
|
+
const mover = useLandmarkMover(props.onKeyDown, "1");
|
|
1700
|
+
return /* @__PURE__ */ React25.createElement(Root5, {
|
|
1701
|
+
role,
|
|
1702
|
+
...handlesFocus && {
|
|
1703
|
+
...mover
|
|
1704
|
+
},
|
|
1707
1705
|
...props,
|
|
1708
|
-
"
|
|
1706
|
+
"data-sidebar-inline-start-state": navigationSidebarState,
|
|
1707
|
+
"data-sidebar-inline-end-state": complementarySidebarState,
|
|
1708
|
+
className: tx("main.content", "main", {
|
|
1709
|
+
bounce,
|
|
1710
|
+
handlesFocus
|
|
1711
|
+
}, classNames),
|
|
1709
1712
|
ref: forwardedRef
|
|
1710
|
-
});
|
|
1713
|
+
}, children);
|
|
1711
1714
|
});
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
+
MainContent.displayName = MAIN_NAME;
|
|
1716
|
+
var MainOverlay = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
|
|
1717
|
+
const [isLg] = useMediaQuery("lg", {
|
|
1718
|
+
ssr: false
|
|
1719
|
+
});
|
|
1720
|
+
const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_NAME);
|
|
1721
|
+
const { tx } = useThemeContext();
|
|
1722
|
+
return /* @__PURE__ */ React25.createElement("div", {
|
|
1723
|
+
onClick: () => {
|
|
1724
|
+
setNavigationSidebarState("collapsed");
|
|
1725
|
+
setComplementarySidebarState("collapsed");
|
|
1726
|
+
},
|
|
1715
1727
|
...props,
|
|
1728
|
+
className: tx("main.overlay", "main__overlay", {
|
|
1729
|
+
isLg,
|
|
1730
|
+
inlineStartSidebarOpen: navigationSidebarState,
|
|
1731
|
+
inlineEndSidebarOpen: complementarySidebarState
|
|
1732
|
+
}, classNames),
|
|
1733
|
+
"data-state": navigationSidebarState === "expanded" || complementarySidebarState === "expanded" ? "open" : "closed",
|
|
1734
|
+
"aria-hidden": "true",
|
|
1716
1735
|
ref: forwardedRef
|
|
1717
1736
|
});
|
|
1718
1737
|
});
|
|
1719
|
-
var
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
Branch: TreeBranch
|
|
1726
|
-
};
|
|
1727
|
-
var TreeItem = {
|
|
1728
|
-
Root: TreeItemRoot,
|
|
1729
|
-
Heading: TreeItemHeading,
|
|
1730
|
-
Body: TreeItemBody,
|
|
1731
|
-
OpenTrigger: TreeItemOpenTrigger,
|
|
1732
|
-
MockOpenTrigger: MockTreeItemOpenTrigger,
|
|
1733
|
-
DropIndicator: TreeDropIndicator
|
|
1738
|
+
var Main = {
|
|
1739
|
+
Root: MainRoot,
|
|
1740
|
+
Content: MainContent,
|
|
1741
|
+
Overlay: MainOverlay,
|
|
1742
|
+
NavigationSidebar: MainNavigationSidebar,
|
|
1743
|
+
ComplementarySidebar: MainComplementarySidebar
|
|
1734
1744
|
};
|
|
1735
1745
|
|
|
1736
|
-
// packages/ui/react-ui/src/components/
|
|
1737
|
-
import
|
|
1738
|
-
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
1746
|
+
// packages/ui/react-ui/src/components/Menus/ContextMenu.tsx
|
|
1747
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
1739
1748
|
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
|
1740
1749
|
import { Slot as Slot9 } from "@radix-ui/react-slot";
|
|
1741
|
-
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
1742
1750
|
import React26, { forwardRef as forwardRef18 } from "react";
|
|
1743
|
-
var
|
|
1744
|
-
var
|
|
1745
|
-
var
|
|
1746
|
-
var
|
|
1747
|
-
|
|
1748
|
-
|
|
1751
|
+
var ContextMenuRoot = ContextMenuPrimitive.ContextMenu;
|
|
1752
|
+
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
1753
|
+
var ContextMenuPortal = ContextMenuPrimitive.Portal;
|
|
1754
|
+
var ContextMenuContent = /* @__PURE__ */ forwardRef18(({ classNames, children, collisionPadding = 8, ...props }, forwardedRef) => {
|
|
1755
|
+
const { tx } = useThemeContext();
|
|
1756
|
+
const elevation = useElevationContext();
|
|
1757
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1758
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Content, {
|
|
1759
|
+
...props,
|
|
1760
|
+
collisionPadding: safeCollisionPadding,
|
|
1761
|
+
className: tx("menu.content", "menu", {
|
|
1762
|
+
elevation
|
|
1763
|
+
}, classNames),
|
|
1764
|
+
ref: forwardedRef
|
|
1765
|
+
}, children);
|
|
1766
|
+
});
|
|
1767
|
+
var ContextMenuViewport = /* @__PURE__ */ forwardRef18(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
1749
1768
|
const { tx } = useThemeContext();
|
|
1750
1769
|
const Root5 = asChild ? Slot9 : Primitive8.div;
|
|
1751
|
-
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
1752
|
-
axis: "vertical",
|
|
1753
|
-
tabbable: false,
|
|
1754
|
-
circular: true
|
|
1755
|
-
});
|
|
1756
1770
|
return /* @__PURE__ */ React26.createElement(Root5, {
|
|
1757
|
-
role: "treegrid",
|
|
1758
|
-
...arrowNavigationAttrs,
|
|
1759
1771
|
...props,
|
|
1760
|
-
className: tx("
|
|
1761
|
-
style: {
|
|
1762
|
-
...style,
|
|
1763
|
-
gridTemplateColumns
|
|
1764
|
-
},
|
|
1772
|
+
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
1765
1773
|
ref: forwardedRef
|
|
1766
1774
|
}, children);
|
|
1767
1775
|
});
|
|
1768
|
-
var
|
|
1776
|
+
var ContextMenuArrow = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
1769
1777
|
const { tx } = useThemeContext();
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
prop: propsOpen,
|
|
1775
|
-
onChange: propsOnOpenChange,
|
|
1776
|
-
defaultProp: defaultOpen
|
|
1778
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Arrow, {
|
|
1779
|
+
...props,
|
|
1780
|
+
className: tx("menu.arrow", "menu__arrow", {}, classNames),
|
|
1781
|
+
ref: forwardedRef
|
|
1777
1782
|
});
|
|
1778
|
-
|
|
1779
|
-
|
|
1783
|
+
});
|
|
1784
|
+
var ContextMenuGroup = ContextMenuPrimitive.Group;
|
|
1785
|
+
var ContextMenuItemIndicator = ContextMenuPrimitive.ItemIndicator;
|
|
1786
|
+
var ContextMenuItem = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
1787
|
+
const { tx } = useThemeContext();
|
|
1788
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Item, {
|
|
1789
|
+
...props,
|
|
1790
|
+
className: tx("menu.item", "menu__item", {}, classNames),
|
|
1791
|
+
ref: forwardedRef
|
|
1780
1792
|
});
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1793
|
+
});
|
|
1794
|
+
var ContextMenuCheckboxItem = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
1795
|
+
const { tx } = useThemeContext();
|
|
1796
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.CheckboxItem, {
|
|
1797
|
+
...props,
|
|
1798
|
+
className: tx("menu.item", "menu__item--checkbox", {}, classNames),
|
|
1799
|
+
ref: forwardedRef
|
|
1786
1800
|
});
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
}, /* @__PURE__ */ React26.createElement(Root5, {
|
|
1792
|
-
role: "row",
|
|
1793
|
-
"aria-level": level,
|
|
1794
|
-
className: tx("treegrid.row", "treegrid__row", {
|
|
1795
|
-
level
|
|
1796
|
-
}, classNames),
|
|
1797
|
-
...parentOf && {
|
|
1798
|
-
"aria-expanded": open,
|
|
1799
|
-
"aria-owns": parentOf
|
|
1800
|
-
},
|
|
1801
|
-
tabIndex: 0,
|
|
1802
|
-
...focusableGroupAttrs,
|
|
1801
|
+
});
|
|
1802
|
+
var ContextMenuSeparator = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
1803
|
+
const { tx } = useThemeContext();
|
|
1804
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Separator, {
|
|
1803
1805
|
...props,
|
|
1804
|
-
|
|
1806
|
+
className: tx("menu.separator", "menu__item", {}, classNames),
|
|
1805
1807
|
ref: forwardedRef
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1808
|
+
});
|
|
1809
|
+
});
|
|
1810
|
+
var ContextMenuGroupLabel = /* @__PURE__ */ forwardRef18(({ classNames, ...props }, forwardedRef) => {
|
|
1811
|
+
const { tx } = useThemeContext();
|
|
1812
|
+
return /* @__PURE__ */ React26.createElement(ContextMenuPrimitive.Label, {
|
|
1813
|
+
...props,
|
|
1814
|
+
className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
|
|
1815
|
+
ref: forwardedRef
|
|
1816
|
+
});
|
|
1817
|
+
});
|
|
1818
|
+
var ContextMenu2 = {
|
|
1819
|
+
Root: ContextMenuRoot,
|
|
1820
|
+
Trigger: ContextMenuTrigger,
|
|
1821
|
+
Portal: ContextMenuPortal,
|
|
1822
|
+
Content: ContextMenuContent,
|
|
1823
|
+
Viewport: ContextMenuViewport,
|
|
1824
|
+
Arrow: ContextMenuArrow,
|
|
1825
|
+
Group: ContextMenuGroup,
|
|
1826
|
+
Item: ContextMenuItem,
|
|
1827
|
+
CheckboxItem: ContextMenuCheckboxItem,
|
|
1828
|
+
ItemIndicator: ContextMenuItemIndicator,
|
|
1829
|
+
Separator: ContextMenuSeparator,
|
|
1830
|
+
GroupLabel: ContextMenuGroupLabel
|
|
1831
|
+
};
|
|
1832
|
+
|
|
1833
|
+
// packages/ui/react-ui/src/components/Menus/DropdownMenu.tsx
|
|
1834
|
+
import { composeEventHandlers } from "@radix-ui/primitive";
|
|
1835
|
+
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
1836
|
+
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
1837
|
+
import { useId as useId2 } from "@radix-ui/react-id";
|
|
1838
|
+
import * as MenuPrimitive from "@radix-ui/react-menu";
|
|
1839
|
+
import { createMenuScope } from "@radix-ui/react-menu";
|
|
1840
|
+
import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
|
|
1841
|
+
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
1842
|
+
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
1843
|
+
import React27, { useRef as useRef2, useCallback as useCallback7, forwardRef as forwardRef19, useEffect as useEffect5 } from "react";
|
|
1844
|
+
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
1845
|
+
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope2(DROPDOWN_MENU_NAME, [
|
|
1846
|
+
createMenuScope
|
|
1847
|
+
]);
|
|
1848
|
+
var useMenuScope = createMenuScope();
|
|
1849
|
+
var [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME);
|
|
1850
|
+
var DropdownMenuRoot = (props) => {
|
|
1851
|
+
const { __scopeDropdownMenu, children, dir, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
|
|
1852
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1853
|
+
const triggerRef = useRef2(null);
|
|
1854
|
+
const [open = false, setOpen] = useControllableState4({
|
|
1855
|
+
prop: openProp,
|
|
1856
|
+
defaultProp: defaultOpen,
|
|
1857
|
+
onChange: onOpenChange
|
|
1858
|
+
});
|
|
1859
|
+
return /* @__PURE__ */ React27.createElement(DropdownMenuProvider, {
|
|
1860
|
+
scope: __scopeDropdownMenu,
|
|
1861
|
+
triggerId: useId2(),
|
|
1862
|
+
triggerRef,
|
|
1863
|
+
contentId: useId2(),
|
|
1864
|
+
open,
|
|
1865
|
+
onOpenChange: setOpen,
|
|
1866
|
+
onOpenToggle: useCallback7(() => setOpen((prevOpen) => !prevOpen), [
|
|
1867
|
+
setOpen
|
|
1868
|
+
]),
|
|
1869
|
+
modal
|
|
1870
|
+
}, /* @__PURE__ */ React27.createElement(MenuPrimitive.Root, {
|
|
1871
|
+
...menuScope,
|
|
1872
|
+
open,
|
|
1873
|
+
onOpenChange: setOpen,
|
|
1874
|
+
dir,
|
|
1875
|
+
modal
|
|
1876
|
+
}, children));
|
|
1877
|
+
};
|
|
1878
|
+
DropdownMenuRoot.displayName = DROPDOWN_MENU_NAME;
|
|
1879
|
+
var TRIGGER_NAME = "DropdownMenuTrigger";
|
|
1880
|
+
var DropdownMenuTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
1881
|
+
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
1882
|
+
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
1883
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1884
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Anchor, {
|
|
1885
|
+
asChild: true,
|
|
1886
|
+
...menuScope
|
|
1887
|
+
}, /* @__PURE__ */ React27.createElement(Primitive9.button, {
|
|
1888
|
+
type: "button",
|
|
1889
|
+
id: context.triggerId,
|
|
1890
|
+
"aria-haspopup": "menu",
|
|
1891
|
+
"aria-expanded": context.open,
|
|
1892
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
|
1893
|
+
"data-state": context.open ? "open" : "closed",
|
|
1894
|
+
"data-disabled": disabled ? "" : void 0,
|
|
1895
|
+
disabled,
|
|
1896
|
+
...triggerProps,
|
|
1897
|
+
ref: composeRefs(forwardedRef, context.triggerRef),
|
|
1898
|
+
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
|
1899
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
1900
|
+
context.onOpenToggle();
|
|
1901
|
+
if (!context.open) {
|
|
1902
|
+
event.preventDefault();
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
}),
|
|
1906
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
1907
|
+
if (disabled) {
|
|
1908
|
+
return;
|
|
1909
|
+
}
|
|
1910
|
+
if ([
|
|
1911
|
+
"Enter",
|
|
1912
|
+
" "
|
|
1913
|
+
].includes(event.key)) {
|
|
1914
|
+
context.onOpenToggle();
|
|
1915
|
+
}
|
|
1916
|
+
if (event.key === "ArrowDown") {
|
|
1917
|
+
context.onOpenChange(true);
|
|
1918
|
+
}
|
|
1919
|
+
if ([
|
|
1920
|
+
"Enter",
|
|
1921
|
+
" ",
|
|
1922
|
+
"ArrowDown"
|
|
1923
|
+
].includes(event.key)) {
|
|
1924
|
+
event.preventDefault();
|
|
1925
|
+
}
|
|
1926
|
+
})
|
|
1927
|
+
}));
|
|
1811
1928
|
});
|
|
1812
|
-
|
|
1929
|
+
DropdownMenuTrigger.displayName = TRIGGER_NAME;
|
|
1930
|
+
var VIRTUAL_TRIGGER_NAME = "DropdownMenuVirtualTrigger";
|
|
1931
|
+
var DropdownMenuVirtualTrigger = (props) => {
|
|
1932
|
+
const { __scopeDropdownMenu, virtualRef } = props;
|
|
1933
|
+
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
1934
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1935
|
+
useEffect5(() => {
|
|
1936
|
+
if (virtualRef.current) {
|
|
1937
|
+
context.triggerRef.current = virtualRef.current;
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Anchor, {
|
|
1941
|
+
...menuScope,
|
|
1942
|
+
virtualRef
|
|
1943
|
+
});
|
|
1944
|
+
};
|
|
1945
|
+
DropdownMenuVirtualTrigger.displayName = VIRTUAL_TRIGGER_NAME;
|
|
1946
|
+
var PORTAL_NAME = "DropdownMenuPortal";
|
|
1947
|
+
var DropdownMenuPortal = (props) => {
|
|
1948
|
+
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
1949
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1950
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Portal, {
|
|
1951
|
+
...menuScope,
|
|
1952
|
+
...portalProps
|
|
1953
|
+
});
|
|
1954
|
+
};
|
|
1955
|
+
DropdownMenuPortal.displayName = PORTAL_NAME;
|
|
1956
|
+
var DropdownMenuViewport = /* @__PURE__ */ forwardRef19(({ classNames, asChild, children, ...props }, forwardedRef) => {
|
|
1813
1957
|
const { tx } = useThemeContext();
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
className: tx("treegrid.cell", "treegrid__cell", {
|
|
1817
|
-
indent
|
|
1818
|
-
}, classNames),
|
|
1958
|
+
const Root5 = asChild ? Slot10 : Primitive9.div;
|
|
1959
|
+
return /* @__PURE__ */ React27.createElement(Root5, {
|
|
1819
1960
|
...props,
|
|
1961
|
+
className: tx("menu.viewport", "menu__viewport", {}, classNames),
|
|
1820
1962
|
ref: forwardedRef
|
|
1821
1963
|
}, children);
|
|
1822
1964
|
});
|
|
1823
|
-
var
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
// packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
|
|
1844
|
-
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState7 } from "react";
|
|
1845
|
-
var MotionState;
|
|
1846
|
-
(function(MotionState2) {
|
|
1847
|
-
MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
|
|
1848
|
-
MotionState2[MotionState2["DEBOUNCING"] = 1] = "DEBOUNCING";
|
|
1849
|
-
MotionState2[MotionState2["FOLLOWING"] = 2] = "FOLLOWING";
|
|
1850
|
-
})(MotionState || (MotionState = {}));
|
|
1851
|
-
var useSwipeToDismiss = (ref, {
|
|
1852
|
-
onDismiss,
|
|
1853
|
-
dismissThreshold = 64,
|
|
1854
|
-
debounceThreshold = 8,
|
|
1855
|
-
offset = 0
|
|
1856
|
-
/* side = 'inline-start' */
|
|
1857
|
-
}) => {
|
|
1858
|
-
const $root = ref.current;
|
|
1859
|
-
const [motionState, setMotionState] = useState7(0);
|
|
1860
|
-
const [gestureStartX, setGestureStartX] = useState7(0);
|
|
1861
|
-
const setIdle = useCallback6(() => {
|
|
1862
|
-
setMotionState(0);
|
|
1863
|
-
$root?.style.removeProperty("inset-inline-start");
|
|
1864
|
-
$root?.style.setProperty("transition-duration", "200ms");
|
|
1865
|
-
}, [
|
|
1866
|
-
$root
|
|
1867
|
-
]);
|
|
1868
|
-
const setFollowing = useCallback6(() => {
|
|
1869
|
-
setMotionState(2);
|
|
1870
|
-
$root?.style.setProperty("transition-duration", "0ms");
|
|
1871
|
-
}, [
|
|
1872
|
-
$root
|
|
1873
|
-
]);
|
|
1874
|
-
const handlePointerDown = useCallback6(({ screenX }) => {
|
|
1875
|
-
if (motionState === 0) {
|
|
1876
|
-
setMotionState(1);
|
|
1877
|
-
setGestureStartX(screenX);
|
|
1878
|
-
}
|
|
1879
|
-
}, [
|
|
1880
|
-
motionState
|
|
1881
|
-
]);
|
|
1882
|
-
const handlePointerMove = useCallback6(({ screenX }) => {
|
|
1883
|
-
if ($root) {
|
|
1884
|
-
const delta = Math.min(screenX - gestureStartX, 0);
|
|
1885
|
-
switch (motionState) {
|
|
1886
|
-
case 2:
|
|
1887
|
-
if (Math.abs(delta) > dismissThreshold) {
|
|
1888
|
-
setIdle();
|
|
1889
|
-
onDismiss?.();
|
|
1890
|
-
} else {
|
|
1891
|
-
$root.style.setProperty("inset-inline-start", `${offset + delta}px`);
|
|
1892
|
-
}
|
|
1893
|
-
break;
|
|
1894
|
-
case 1:
|
|
1895
|
-
if (Math.abs(delta) > debounceThreshold) {
|
|
1896
|
-
setFollowing();
|
|
1897
|
-
}
|
|
1898
|
-
break;
|
|
1965
|
+
var CONTENT_NAME = "DropdownMenuContent";
|
|
1966
|
+
var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
1967
|
+
const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
|
|
1968
|
+
const { tx } = useThemeContext();
|
|
1969
|
+
const context = useDropdownMenuContext(CONTENT_NAME, __scopeDropdownMenu);
|
|
1970
|
+
const elevation = useElevationContext();
|
|
1971
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
1972
|
+
const hasInteractedOutsideRef = useRef2(false);
|
|
1973
|
+
const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
|
|
1974
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Content, {
|
|
1975
|
+
id: context.contentId,
|
|
1976
|
+
"aria-labelledby": context.triggerId,
|
|
1977
|
+
...menuScope,
|
|
1978
|
+
...contentProps,
|
|
1979
|
+
collisionPadding: safeCollisionPadding,
|
|
1980
|
+
ref: forwardedRef,
|
|
1981
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
1982
|
+
if (!hasInteractedOutsideRef.current) {
|
|
1983
|
+
context.triggerRef.current?.focus();
|
|
1899
1984
|
}
|
|
1900
|
-
|
|
1901
|
-
}, [
|
|
1902
|
-
$root,
|
|
1903
|
-
motionState,
|
|
1904
|
-
gestureStartX
|
|
1905
|
-
]);
|
|
1906
|
-
const handlePointerUp = useCallback6(() => {
|
|
1907
|
-
setIdle();
|
|
1908
|
-
}, [
|
|
1909
|
-
setIdle
|
|
1910
|
-
]);
|
|
1911
|
-
useEffect4(() => {
|
|
1912
|
-
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
1913
|
-
return () => {
|
|
1914
|
-
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
1915
|
-
};
|
|
1916
|
-
}, [
|
|
1917
|
-
$root,
|
|
1918
|
-
handlePointerDown
|
|
1919
|
-
]);
|
|
1920
|
-
useEffect4(() => {
|
|
1921
|
-
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
1922
|
-
return () => {
|
|
1923
|
-
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
1924
|
-
};
|
|
1925
|
-
}, [
|
|
1926
|
-
$root,
|
|
1927
|
-
handlePointerMove
|
|
1928
|
-
]);
|
|
1929
|
-
useEffect4(() => {
|
|
1930
|
-
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
1931
|
-
return () => {
|
|
1932
|
-
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
1933
|
-
};
|
|
1934
|
-
}, [
|
|
1935
|
-
$root,
|
|
1936
|
-
handlePointerUp
|
|
1937
|
-
]);
|
|
1938
|
-
};
|
|
1939
|
-
|
|
1940
|
-
// packages/ui/react-ui/src/components/Main/Main.tsx
|
|
1941
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui/src/components/Main/Main.tsx";
|
|
1942
|
-
var MAIN_ROOT_NAME = "MainRoot";
|
|
1943
|
-
var NAVIGATION_SIDEBAR_NAME = "NavigationSidebar";
|
|
1944
|
-
var COMPLEMENTARY_SIDEBAR_NAME = "ComplementarySidebar";
|
|
1945
|
-
var MAIN_NAME = "Main";
|
|
1946
|
-
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
1947
|
-
var landmarkAttr = "data-main-landmark";
|
|
1948
|
-
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
1949
|
-
const handleKeyDown = useCallback7((event) => {
|
|
1950
|
-
const target = event.target;
|
|
1951
|
-
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
1985
|
+
hasInteractedOutsideRef.current = false;
|
|
1952
1986
|
event.preventDefault();
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
const
|
|
1956
|
-
const
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1987
|
+
}),
|
|
1988
|
+
onInteractOutside: composeEventHandlers(props.onInteractOutside, (event) => {
|
|
1989
|
+
const originalEvent = event.detail.originalEvent;
|
|
1990
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
1991
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
1992
|
+
if (!context.modal || isRightClick) {
|
|
1993
|
+
hasInteractedOutsideRef.current = true;
|
|
1994
|
+
}
|
|
1995
|
+
}),
|
|
1996
|
+
className: tx("menu.content", "menu", {
|
|
1997
|
+
elevation
|
|
1998
|
+
}, classNames),
|
|
1999
|
+
style: {
|
|
2000
|
+
...props.style,
|
|
2001
|
+
// re-namespace exposed content custom properties
|
|
2002
|
+
...{
|
|
2003
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
2004
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
2005
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
2006
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
2007
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
2008
|
+
}
|
|
1967
2009
|
}
|
|
1968
|
-
};
|
|
1969
|
-
return {
|
|
1970
|
-
onKeyDown: handleKeyDown,
|
|
1971
|
-
[landmarkAttr]: landmark,
|
|
1972
|
-
tabIndex: 0,
|
|
1973
|
-
...focusableGroupAttrs
|
|
1974
|
-
};
|
|
1975
|
-
};
|
|
1976
|
-
var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
1977
|
-
resizing: false,
|
|
1978
|
-
navigationSidebarState: "closed",
|
|
1979
|
-
setNavigationSidebarState: (nextState) => {
|
|
1980
|
-
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
1981
|
-
F: __dxlog_file,
|
|
1982
|
-
L: 82,
|
|
1983
|
-
S: void 0,
|
|
1984
|
-
C: (f, a) => f(...a)
|
|
1985
|
-
});
|
|
1986
|
-
},
|
|
1987
|
-
complementarySidebarState: "closed",
|
|
1988
|
-
setComplementarySidebarState: (nextState) => {
|
|
1989
|
-
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
1990
|
-
F: __dxlog_file,
|
|
1991
|
-
L: 87,
|
|
1992
|
-
S: void 0,
|
|
1993
|
-
C: (f, a) => f(...a)
|
|
1994
|
-
});
|
|
1995
|
-
}
|
|
1996
|
-
});
|
|
1997
|
-
var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
1998
|
-
const { setNavigationSidebarState, navigationSidebarState, setComplementarySidebarState, complementarySidebarState } = useMainContext(consumerName);
|
|
1999
|
-
return {
|
|
2000
|
-
navigationSidebarState,
|
|
2001
|
-
setNavigationSidebarState,
|
|
2002
|
-
toggleNavigationSidebar: useCallback7(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2003
|
-
navigationSidebarState,
|
|
2004
|
-
setNavigationSidebarState
|
|
2005
|
-
]),
|
|
2006
|
-
openNavigationSidebar: useCallback7(() => setNavigationSidebarState("expanded"), []),
|
|
2007
|
-
collapseNavigationSidebar: useCallback7(() => setNavigationSidebarState("collapsed"), []),
|
|
2008
|
-
closeNavigationSidebar: useCallback7(() => setNavigationSidebarState("closed"), []),
|
|
2009
|
-
complementarySidebarState,
|
|
2010
|
-
setComplementarySidebarState,
|
|
2011
|
-
toggleComplementarySidebar: useCallback7(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2012
|
-
complementarySidebarState,
|
|
2013
|
-
setComplementarySidebarState
|
|
2014
|
-
]),
|
|
2015
|
-
openComplementarySidebar: useCallback7(() => setComplementarySidebarState("expanded"), []),
|
|
2016
|
-
collapseComplementarySidebar: useCallback7(() => setComplementarySidebarState("collapsed"), []),
|
|
2017
|
-
closeComplementarySidebar: useCallback7(() => setComplementarySidebarState("closed"), [])
|
|
2018
|
-
};
|
|
2019
|
-
};
|
|
2020
|
-
var resizeDebounce = 3e3;
|
|
2021
|
-
var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState, onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState, onComplementarySidebarStateChange, children, ...props }) => {
|
|
2022
|
-
const [isLg] = useMediaQuery("lg", {
|
|
2023
|
-
ssr: false
|
|
2024
|
-
});
|
|
2025
|
-
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState4({
|
|
2026
|
-
prop: propsNavigationSidebarState,
|
|
2027
|
-
defaultProp: defaultNavigationSidebarState,
|
|
2028
|
-
onChange: onNavigationSidebarStateChange
|
|
2029
2010
|
});
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2011
|
+
});
|
|
2012
|
+
DropdownMenuContent.displayName = CONTENT_NAME;
|
|
2013
|
+
var GROUP_NAME = "DropdownMenuGroup";
|
|
2014
|
+
var DropdownMenuGroup = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2015
|
+
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
2016
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2017
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Group, {
|
|
2018
|
+
...menuScope,
|
|
2019
|
+
...groupProps,
|
|
2020
|
+
ref: forwardedRef
|
|
2034
2021
|
});
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
},
|
|
2046
|
-
|
|
2047
|
-
useEffect5(() => {
|
|
2048
|
-
window.addEventListener("resize", handleResize);
|
|
2049
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
2050
|
-
}, [
|
|
2051
|
-
handleResize
|
|
2052
|
-
]);
|
|
2053
|
-
return /* @__PURE__ */ React27.createElement(MainProvider, {
|
|
2054
|
-
...props,
|
|
2055
|
-
navigationSidebarState,
|
|
2056
|
-
setNavigationSidebarState,
|
|
2057
|
-
complementarySidebarState,
|
|
2058
|
-
setComplementarySidebarState,
|
|
2059
|
-
resizing
|
|
2060
|
-
}, children);
|
|
2061
|
-
};
|
|
2062
|
-
MainRoot.displayName = MAIN_ROOT_NAME;
|
|
2063
|
-
var handleOpenAutoFocus = (event) => {
|
|
2064
|
-
!document.body.hasAttribute("data-is-keyboard") && event.preventDefault();
|
|
2065
|
-
};
|
|
2066
|
-
var MainSidebar = /* @__PURE__ */ forwardRef19(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
|
|
2067
|
-
const [isLg] = useMediaQuery("lg", {
|
|
2068
|
-
ssr: false
|
|
2022
|
+
});
|
|
2023
|
+
DropdownMenuGroup.displayName = GROUP_NAME;
|
|
2024
|
+
var LABEL_NAME = "DropdownMenuLabel";
|
|
2025
|
+
var DropdownMenuGroupLabel = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2026
|
+
const { __scopeDropdownMenu, classNames, ...labelProps } = props;
|
|
2027
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2028
|
+
const { tx } = useThemeContext();
|
|
2029
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Label, {
|
|
2030
|
+
...menuScope,
|
|
2031
|
+
...labelProps,
|
|
2032
|
+
className: tx("menu.groupLabel", "menu__group__label", {}, classNames),
|
|
2033
|
+
ref: forwardedRef
|
|
2069
2034
|
});
|
|
2035
|
+
});
|
|
2036
|
+
DropdownMenuGroupLabel.displayName = LABEL_NAME;
|
|
2037
|
+
var ITEM_NAME = "DropdownMenuItem";
|
|
2038
|
+
var DropdownMenuItem = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2039
|
+
const { __scopeDropdownMenu, classNames, ...itemProps } = props;
|
|
2040
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2070
2041
|
const { tx } = useThemeContext();
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2042
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Item, {
|
|
2043
|
+
...menuScope,
|
|
2044
|
+
...itemProps,
|
|
2045
|
+
className: tx("menu.item", "menu__item", {}, classNames),
|
|
2046
|
+
ref: forwardedRef
|
|
2076
2047
|
});
|
|
2077
|
-
const handleKeyDown = useCallback7((event) => {
|
|
2078
|
-
if (event.key === "Escape") {
|
|
2079
|
-
event.target.closest("[data-tabster]")?.focus();
|
|
2080
|
-
}
|
|
2081
|
-
props.onKeyDown?.(event);
|
|
2082
|
-
}, [
|
|
2083
|
-
props.onKeyDown
|
|
2084
|
-
]);
|
|
2085
|
-
const Root5 = isLg ? Primitive9.div : DialogContent2;
|
|
2086
|
-
return /* @__PURE__ */ React27.createElement(DialogRoot2, {
|
|
2087
|
-
open: state !== "closed",
|
|
2088
|
-
"aria-label": toLocalizedString(label, t),
|
|
2089
|
-
modal: false
|
|
2090
|
-
}, !isLg && /* @__PURE__ */ React27.createElement(DialogTitle2, {
|
|
2091
|
-
className: "sr-only"
|
|
2092
|
-
}, toLocalizedString(label, t)), /* @__PURE__ */ React27.createElement(Root5, {
|
|
2093
|
-
...!isLg && {
|
|
2094
|
-
forceMount: true,
|
|
2095
|
-
tabIndex: -1,
|
|
2096
|
-
onOpenAutoFocus: onOpenAutoFocus ?? handleOpenAutoFocus
|
|
2097
|
-
},
|
|
2098
|
-
...props,
|
|
2099
|
-
"data-side": side === "inline-end" ? "ie" : "is",
|
|
2100
|
-
"data-state": state,
|
|
2101
|
-
"data-resizing": resizing ? "true" : "false",
|
|
2102
|
-
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
2103
|
-
onKeyDown: handleKeyDown,
|
|
2104
|
-
...state === "closed" && {
|
|
2105
|
-
inert: "true"
|
|
2106
|
-
},
|
|
2107
|
-
ref
|
|
2108
|
-
}, children));
|
|
2109
2048
|
});
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2049
|
+
DropdownMenuItem.displayName = ITEM_NAME;
|
|
2050
|
+
var CHECKBOX_ITEM_NAME = "DropdownMenuCheckboxItem";
|
|
2051
|
+
var DropdownMenuCheckboxItem = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2052
|
+
const { __scopeDropdownMenu, classNames, ...checkboxItemProps } = props;
|
|
2053
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2054
|
+
const { tx } = useThemeContext();
|
|
2055
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.CheckboxItem, {
|
|
2056
|
+
...menuScope,
|
|
2057
|
+
...checkboxItemProps,
|
|
2058
|
+
className: tx("menu.item", "menu__item--checkbox", {}, classNames),
|
|
2120
2059
|
ref: forwardedRef
|
|
2121
2060
|
});
|
|
2122
2061
|
});
|
|
2123
|
-
|
|
2124
|
-
var
|
|
2125
|
-
|
|
2126
|
-
const
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
...
|
|
2130
|
-
|
|
2131
|
-
onStateChange: setComplementarySidebarState,
|
|
2132
|
-
resizing,
|
|
2133
|
-
side: "inline-end",
|
|
2062
|
+
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME;
|
|
2063
|
+
var RADIO_GROUP_NAME = "DropdownMenuRadioGroup";
|
|
2064
|
+
var DropdownMenuRadioGroup = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2065
|
+
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
2066
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2067
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.RadioGroup, {
|
|
2068
|
+
...menuScope,
|
|
2069
|
+
...radioGroupProps,
|
|
2134
2070
|
ref: forwardedRef
|
|
2135
2071
|
});
|
|
2136
2072
|
});
|
|
2137
|
-
|
|
2138
|
-
var
|
|
2139
|
-
|
|
2140
|
-
const {
|
|
2141
|
-
const
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
...handlesFocus && {
|
|
2146
|
-
...mover
|
|
2147
|
-
},
|
|
2148
|
-
...props,
|
|
2149
|
-
"data-sidebar-inline-start-state": navigationSidebarState,
|
|
2150
|
-
"data-sidebar-inline-end-state": complementarySidebarState,
|
|
2151
|
-
className: tx("main.content", "main", {
|
|
2152
|
-
bounce,
|
|
2153
|
-
handlesFocus
|
|
2154
|
-
}, classNames),
|
|
2073
|
+
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
2074
|
+
var RADIO_ITEM_NAME = "DropdownMenuRadioItem";
|
|
2075
|
+
var DropdownMenuRadioItem = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2076
|
+
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
2077
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2078
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.RadioItem, {
|
|
2079
|
+
...menuScope,
|
|
2080
|
+
...radioItemProps,
|
|
2155
2081
|
ref: forwardedRef
|
|
2156
|
-
}
|
|
2082
|
+
});
|
|
2157
2083
|
});
|
|
2158
|
-
|
|
2159
|
-
var
|
|
2160
|
-
|
|
2161
|
-
|
|
2084
|
+
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME;
|
|
2085
|
+
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
2086
|
+
var DropdownMenuItemIndicator = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2087
|
+
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
2088
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2089
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.ItemIndicator, {
|
|
2090
|
+
...menuScope,
|
|
2091
|
+
...itemIndicatorProps,
|
|
2092
|
+
ref: forwardedRef
|
|
2162
2093
|
});
|
|
2163
|
-
|
|
2094
|
+
});
|
|
2095
|
+
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
2096
|
+
var SEPARATOR_NAME = "DropdownMenuSeparator";
|
|
2097
|
+
var DropdownMenuSeparator = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2098
|
+
const { __scopeDropdownMenu, classNames, ...separatorProps } = props;
|
|
2099
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2164
2100
|
const { tx } = useThemeContext();
|
|
2165
|
-
return /* @__PURE__ */ React27.createElement(
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
},
|
|
2170
|
-
...props,
|
|
2171
|
-
className: tx("main.overlay", "main__overlay", {
|
|
2172
|
-
isLg,
|
|
2173
|
-
inlineStartSidebarOpen: navigationSidebarState,
|
|
2174
|
-
inlineEndSidebarOpen: complementarySidebarState
|
|
2175
|
-
}, classNames),
|
|
2176
|
-
"data-state": navigationSidebarState === "expanded" || complementarySidebarState === "expanded" ? "open" : "closed",
|
|
2177
|
-
"aria-hidden": "true",
|
|
2101
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Separator, {
|
|
2102
|
+
...menuScope,
|
|
2103
|
+
...separatorProps,
|
|
2104
|
+
className: tx("menu.separator", "menu__item", {}, classNames),
|
|
2178
2105
|
ref: forwardedRef
|
|
2179
2106
|
});
|
|
2180
2107
|
});
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2108
|
+
DropdownMenuSeparator.displayName = SEPARATOR_NAME;
|
|
2109
|
+
var ARROW_NAME = "DropdownMenuArrow";
|
|
2110
|
+
var DropdownMenuArrow = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2111
|
+
const { __scopeDropdownMenu, classNames, ...arrowProps } = props;
|
|
2112
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2113
|
+
const { tx } = useThemeContext();
|
|
2114
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Arrow, {
|
|
2115
|
+
...menuScope,
|
|
2116
|
+
...arrowProps,
|
|
2117
|
+
className: tx("menu.arrow", "menu__arrow", {}, classNames),
|
|
2118
|
+
ref: forwardedRef
|
|
2119
|
+
});
|
|
2120
|
+
});
|
|
2121
|
+
DropdownMenuArrow.displayName = ARROW_NAME;
|
|
2122
|
+
var DropdownMenuSub = (props) => {
|
|
2123
|
+
const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
|
|
2124
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2125
|
+
const [open = false, setOpen] = useControllableState4({
|
|
2126
|
+
prop: openProp,
|
|
2127
|
+
defaultProp: defaultOpen,
|
|
2128
|
+
onChange: onOpenChange
|
|
2129
|
+
});
|
|
2130
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.Sub, {
|
|
2131
|
+
...menuScope,
|
|
2132
|
+
open,
|
|
2133
|
+
onOpenChange: setOpen
|
|
2134
|
+
}, children);
|
|
2135
|
+
};
|
|
2136
|
+
var SUB_TRIGGER_NAME = "DropdownMenuSubTrigger";
|
|
2137
|
+
var DropdownMenuSubTrigger = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2138
|
+
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
2139
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2140
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.SubTrigger, {
|
|
2141
|
+
...menuScope,
|
|
2142
|
+
...subTriggerProps,
|
|
2143
|
+
ref: forwardedRef
|
|
2144
|
+
});
|
|
2145
|
+
});
|
|
2146
|
+
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME;
|
|
2147
|
+
var SUB_CONTENT_NAME = "DropdownMenuSubContent";
|
|
2148
|
+
var DropdownMenuSubContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
|
|
2149
|
+
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
2150
|
+
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2151
|
+
return /* @__PURE__ */ React27.createElement(MenuPrimitive.SubContent, {
|
|
2152
|
+
...menuScope,
|
|
2153
|
+
...subContentProps,
|
|
2154
|
+
ref: forwardedRef,
|
|
2155
|
+
style: {
|
|
2156
|
+
...props.style,
|
|
2157
|
+
// re-namespace exposed content custom properties
|
|
2158
|
+
...{
|
|
2159
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
2160
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
2161
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
2162
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
2163
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
});
|
|
2167
|
+
});
|
|
2168
|
+
DropdownMenuSubContent.displayName = SUB_CONTENT_NAME;
|
|
2169
|
+
var DropdownMenu = {
|
|
2170
|
+
Root: DropdownMenuRoot,
|
|
2171
|
+
Trigger: DropdownMenuTrigger,
|
|
2172
|
+
VirtualTrigger: DropdownMenuVirtualTrigger,
|
|
2173
|
+
Portal: DropdownMenuPortal,
|
|
2174
|
+
Content: DropdownMenuContent,
|
|
2175
|
+
Viewport: DropdownMenuViewport,
|
|
2176
|
+
Group: DropdownMenuGroup,
|
|
2177
|
+
GroupLabel: DropdownMenuGroupLabel,
|
|
2178
|
+
Item: DropdownMenuItem,
|
|
2179
|
+
CheckboxItem: DropdownMenuCheckboxItem,
|
|
2180
|
+
RadioGroup: DropdownMenuRadioGroup,
|
|
2181
|
+
RadioItem: DropdownMenuRadioItem,
|
|
2182
|
+
ItemIndicator: DropdownMenuItemIndicator,
|
|
2183
|
+
Separator: DropdownMenuSeparator,
|
|
2184
|
+
Arrow: DropdownMenuArrow,
|
|
2185
|
+
Sub: DropdownMenuSub,
|
|
2186
|
+
SubTrigger: DropdownMenuSubTrigger,
|
|
2187
|
+
SubContent: DropdownMenuSubContent
|
|
2187
2188
|
};
|
|
2189
|
+
var useDropdownMenuMenuScope = useMenuScope;
|
|
2188
2190
|
|
|
2189
2191
|
// packages/ui/react-ui/src/components/Message/Message.tsx
|
|
2190
2192
|
import { createContext as createContext11 } from "@radix-ui/react-context";
|