@dxos/react-ui 0.7.5-main.499c70c → 0.7.5-main.937ce75

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.
@@ -572,7 +572,7 @@ var ButtonGroup = /* @__PURE__ */ forwardRef7(({ children, elevation: propsEleva
572
572
  ButtonGroup.displayName = BUTTON_GROUP_NAME;
573
573
 
574
574
  // packages/ui/react-ui/src/components/Buttons/IconButton.tsx
575
- import React10, { forwardRef as forwardRef9 } from "react";
575
+ import React10, { forwardRef as forwardRef9, useState as useState3 } from "react";
576
576
 
577
577
  // packages/ui/react-ui/src/components/Tooltip/Tooltip.tsx
578
578
  import { Provider as TooltipProviderPrimitive, Root as TooltipRootPrimitive, TooltipContent as TooltipContentPrimitive, TooltipTrigger as TooltipTriggerPrimitive, TooltipPortal as TooltipPortalPrimitive, TooltipArrow as TooltipArrowPrimitive } from "@radix-ui/react-tooltip";
@@ -612,20 +612,31 @@ var Tooltip = {
612
612
  };
613
613
 
614
614
  // packages/ui/react-ui/src/components/Buttons/IconButton.tsx
615
- var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex, ...props }, forwardedRef) => {
615
+ var IconOnlyButton = /* @__PURE__ */ forwardRef9(({ tooltipPortal = true, tooltipZIndex: zIndex, suppressNextTooltip, ...props }, forwardedRef) => {
616
+ const [triggerTooltipOpen, setTriggerTooltipOpen] = useState3(false);
616
617
  const content = /* @__PURE__ */ React10.createElement(Tooltip.Content, zIndex && {
617
618
  style: {
618
619
  zIndex
619
620
  }
620
621
  }, props.label, /* @__PURE__ */ React10.createElement(Tooltip.Arrow, null));
621
- return /* @__PURE__ */ React10.createElement(Tooltip.Root, null, /* @__PURE__ */ React10.createElement(Tooltip.Trigger, {
622
+ return /* @__PURE__ */ React10.createElement(Tooltip.Root, {
623
+ open: triggerTooltipOpen,
624
+ onOpenChange: (nextOpen) => {
625
+ if (suppressNextTooltip?.current) {
626
+ setTriggerTooltipOpen(false);
627
+ suppressNextTooltip.current = false;
628
+ } else {
629
+ setTriggerTooltipOpen(nextOpen);
630
+ }
631
+ }
632
+ }, /* @__PURE__ */ React10.createElement(Tooltip.Trigger, {
622
633
  asChild: true
623
634
  }, /* @__PURE__ */ React10.createElement(LabelledIconButton, {
624
635
  ...props,
625
636
  ref: forwardedRef
626
637
  })), tooltipPortal ? /* @__PURE__ */ React10.createElement(Tooltip.Portal, null, content) : content);
627
638
  });
628
- var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, ...props }, forwardedRef) => {
639
+ var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, ...props }, forwardedRef) => {
629
640
  const { tx } = useThemeContext();
630
641
  return /* @__PURE__ */ React10.createElement(Button, {
631
642
  ...props,
@@ -637,7 +648,10 @@ var LabelledIconButton = /* @__PURE__ */ forwardRef9(({ icon, size, iconOnly, la
637
648
  classNames: iconClassNames
638
649
  }), /* @__PURE__ */ React10.createElement("span", {
639
650
  className: iconOnly ? "sr-only" : void 0
640
- }, label));
651
+ }, label), caretDown && /* @__PURE__ */ React10.createElement(Icon, {
652
+ size: 3,
653
+ icon: "ph--caret-down--bold"
654
+ }));
641
655
  });
642
656
  var IconButton = /* @__PURE__ */ forwardRef9((props, forwardedRef) => props.iconOnly ? /* @__PURE__ */ React10.createElement(IconOnlyButton, {
643
657
  ...props,
@@ -690,7 +704,7 @@ var ToggleGroupItem = /* @__PURE__ */ forwardRef11(({ variant, elevation, densit
690
704
  });
691
705
 
692
706
  // packages/ui/react-ui/src/components/Clipboard/ClipboardProvider.tsx
693
- import React13, { createContext as createContext4, useCallback, useContext as useContext6, useState as useState3 } from "react";
707
+ import React13, { createContext as createContext4, useCallback, useContext as useContext6, useState as useState4 } from "react";
694
708
  var ClipboardContext = /* @__PURE__ */ createContext4({
695
709
  textValue: "",
696
710
  setTextValue: async (_) => {
@@ -698,7 +712,7 @@ var ClipboardContext = /* @__PURE__ */ createContext4({
698
712
  });
699
713
  var useClipboard = () => useContext6(ClipboardContext);
700
714
  var ClipboardProvider = ({ children }) => {
701
- const [textValue, setInternalTextValue] = useState3("");
715
+ const [textValue, setInternalTextValue] = useState4("");
702
716
  const setTextValue = useCallback(async (nextValue) => {
703
717
  await navigator.clipboard.writeText(nextValue);
704
718
  return setInternalTextValue(nextValue);
@@ -712,7 +726,7 @@ var ClipboardProvider = ({ children }) => {
712
726
  };
713
727
 
714
728
  // packages/ui/react-ui/src/components/Clipboard/CopyButton.tsx
715
- import React17, { useState as useState4 } from "react";
729
+ import React17, { useState as useState5 } from "react";
716
730
  import { mx } from "@dxos/react-ui-theme";
717
731
 
718
732
  // packages/ui/react-ui/src/components/ThemeProvider/ThemeProvider.tsx
@@ -820,7 +834,7 @@ var CopyButtonIconOnly = ({ value, classNames, iconProps, variant, ...props }) =
820
834
  const { textValue, setTextValue } = useClipboard();
821
835
  const isCopied = textValue === value;
822
836
  const label = isCopied ? t("copy success label") : t("copy label");
823
- const [open, setOpen] = useState4(false);
837
+ const [open, setOpen] = useState5(false);
824
838
  return /* @__PURE__ */ React17.createElement(Tooltip.Root, {
825
839
  delayDuration: 1500,
826
840
  open,
@@ -1949,12 +1963,12 @@ import { Root as DialogRoot2, DialogContent as DialogContent2 } from "@radix-ui/
1949
1963
  import { Primitive as Primitive9 } from "@radix-ui/react-primitive";
1950
1964
  import { Slot as Slot10 } from "@radix-ui/react-slot";
1951
1965
  import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
1952
- import React28, { forwardRef as forwardRef20, useCallback as useCallback5, useEffect as useEffect6, useRef as useRef2, useState as useState6 } from "react";
1966
+ import React28, { forwardRef as forwardRef20, useCallback as useCallback5, useEffect as useEffect6, useRef as useRef2, useState as useState7 } from "react";
1953
1967
  import { log } from "@dxos/log";
1954
1968
  import { useMediaQuery, useForwardedRef } from "@dxos/react-hooks";
1955
1969
 
1956
1970
  // packages/ui/react-ui/src/components/Main/useSwipeToDismiss.ts
1957
- import { useCallback as useCallback4, useEffect as useEffect5, useState as useState5 } from "react";
1971
+ import { useCallback as useCallback4, useEffect as useEffect5, useState as useState6 } from "react";
1958
1972
  var MotionState;
1959
1973
  (function(MotionState2) {
1960
1974
  MotionState2[MotionState2["IDLE"] = 0] = "IDLE";
@@ -1969,8 +1983,8 @@ var useSwipeToDismiss = (ref, {
1969
1983
  /* side = 'inline-start' */
1970
1984
  }) => {
1971
1985
  const $root = ref.current;
1972
- const [motionState, setMotionState] = useState5(0);
1973
- const [gestureStartX, setGestureStartX] = useState5(0);
1986
+ const [motionState, setMotionState] = useState6(0);
1987
+ const [gestureStartX, setGestureStartX] = useState6(0);
1974
1988
  const setIdle = useCallback4(() => {
1975
1989
  setMotionState(0);
1976
1990
  $root?.style.removeProperty("inset-inline-start");
@@ -2151,7 +2165,7 @@ var MainRoot = ({ navigationSidebarOpen: propsNavigationSidebarOpen, defaultNavi
2151
2165
  defaultProp: defaultComplementarySidebarOpen,
2152
2166
  onChange: onComplementarySidebarOpenChange
2153
2167
  });
2154
- const [resizing, setResizing] = useState6(false);
2168
+ const [resizing, setResizing] = useState7(false);
2155
2169
  const resizeInterval = useRef2(null);
2156
2170
  const handleResize = useCallback5(() => {
2157
2171
  setResizing(true);
@@ -2403,7 +2417,7 @@ import { Primitive as Primitive11 } from "@radix-ui/react-primitive";
2403
2417
  import { Slot as Slot12 } from "@radix-ui/react-slot";
2404
2418
  import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
2405
2419
  import { hideOthers } from "aria-hidden";
2406
- import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as useCallback6, useState as useState7, useEffect as useEffect7 } from "react";
2420
+ import React30, { forwardRef as forwardRef22, useRef as useRef3, useCallback as useCallback6, useState as useState8, useEffect as useEffect7 } from "react";
2407
2421
  import { RemoveScroll } from "react-remove-scroll";
2408
2422
  var POPOVER_NAME = "Popover";
2409
2423
  var [createPopoverContext, createPopoverScope] = createContextScope3(POPOVER_NAME, [
@@ -2415,7 +2429,7 @@ var PopoverRoot = (props) => {
2415
2429
  const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
2416
2430
  const popperScope = usePopperScope(__scopePopover);
2417
2431
  const triggerRef = useRef3(null);
2418
- const [hasCustomAnchor, setHasCustomAnchor] = useState7(false);
2432
+ const [hasCustomAnchor, setHasCustomAnchor] = useState8(false);
2419
2433
  const [open = false, setOpen] = useControllableState5({
2420
2434
  prop: openProp,
2421
2435
  defaultProp: defaultOpen,
@@ -3037,6 +3051,14 @@ var ToolbarButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
3037
3051
  ref: forwardedRef
3038
3052
  }));
3039
3053
  });
3054
+ var ToolbarIconButton = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
3055
+ return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
3056
+ asChild: true
3057
+ }, /* @__PURE__ */ React37.createElement(IconButton, {
3058
+ ...props,
3059
+ ref: forwardedRef
3060
+ }));
3061
+ });
3040
3062
  var ToolbarToggle = /* @__PURE__ */ forwardRef28((props, forwardedRef) => {
3041
3063
  return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Button, {
3042
3064
  asChild: true
@@ -3077,26 +3099,38 @@ var ToolbarToggleGroupItem = /* @__PURE__ */ forwardRef28(({ variant, density, e
3077
3099
  ref: forwardedRef
3078
3100
  }));
3079
3101
  });
3080
- var ToolbarSeparator = (props) => {
3081
- return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Separator, {
3102
+ var ToolbarToggleGroupIconItem = /* @__PURE__ */ forwardRef28(({ variant, density, elevation, classNames, icon, label, iconOnly, ...props }, forwardedRef) => {
3103
+ return /* @__PURE__ */ React37.createElement(ToolbarPrimitive.ToolbarToggleItem, {
3104
+ ...props,
3082
3105
  asChild: true
3083
- }, /* @__PURE__ */ React37.createElement(Separator4, {
3084
- orientation: "vertical",
3085
- ...props
3106
+ }, /* @__PURE__ */ React37.createElement(IconButton, {
3107
+ variant,
3108
+ density,
3109
+ elevation,
3110
+ classNames,
3111
+ icon,
3112
+ label,
3113
+ iconOnly,
3114
+ ref: forwardedRef
3086
3115
  }));
3087
- };
3088
- var ToolbarExpander = () => /* @__PURE__ */ React37.createElement("div", {
3089
- className: "grow"
3090
3116
  });
3117
+ var ToolbarSeparator = ({ variant = "line", ...props }) => {
3118
+ return variant === "line" ? /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Separator, {
3119
+ asChild: true
3120
+ }, /* @__PURE__ */ React37.createElement(Separator4, props)) : /* @__PURE__ */ React37.createElement(ToolbarPrimitive.Separator, {
3121
+ className: "grow"
3122
+ });
3123
+ };
3091
3124
  var Toolbar = {
3092
3125
  Root: ToolbarRoot,
3093
3126
  Button: ToolbarButton,
3127
+ IconButton: ToolbarIconButton,
3094
3128
  Link: ToolbarLink,
3095
3129
  Toggle: ToolbarToggle,
3096
3130
  ToggleGroup: ToolbarToggleGroup2,
3097
3131
  ToggleGroupItem: ToolbarToggleGroupItem,
3098
- Separator: ToolbarSeparator,
3099
- Expander: ToolbarExpander
3132
+ ToggleGroupIconItem: ToolbarToggleGroupIconItem,
3133
+ Separator: ToolbarSeparator
3100
3134
  };
3101
3135
  export {
3102
3136
  AlertDialog,