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