@dxos/react-ui 0.8.2-main.12df754 → 0.8.2-main.36232bc

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