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