@dxos/react-ui 0.8.4-main.406dc2a → 0.8.4-main.548089c

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.
Files changed (40) hide show
  1. package/dist/lib/browser/{chunk-KX5JDELJ.mjs → chunk-YG7RAH7A.mjs} +67 -45
  2. package/dist/lib/browser/chunk-YG7RAH7A.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +2 -2
  6. package/dist/lib/browser/testing/index.mjs.map +2 -2
  7. package/dist/lib/node-esm/{chunk-3HDQYL5S.mjs → chunk-FL2ZT5KB.mjs} +67 -45
  8. package/dist/lib/node-esm/chunk-FL2ZT5KB.mjs.map +7 -0
  9. package/dist/lib/node-esm/index.mjs +1 -1
  10. package/dist/lib/node-esm/meta.json +1 -1
  11. package/dist/lib/node-esm/testing/index.mjs +2 -2
  12. package/dist/lib/node-esm/testing/index.mjs.map +2 -2
  13. package/dist/types/src/components/Buttons/IconButton.d.ts +0 -1
  14. package/dist/types/src/components/Buttons/IconButton.d.ts.map +1 -1
  15. package/dist/types/src/components/Icon/Icon.stories.d.ts +17 -0
  16. package/dist/types/src/components/Icon/Icon.stories.d.ts.map +1 -0
  17. package/dist/types/src/components/Main/Main.d.ts +8 -8
  18. package/dist/types/src/components/Main/Main.d.ts.map +1 -1
  19. package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
  20. package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
  21. package/dist/types/src/components/Toolbar/Toolbar.d.ts +4 -2
  22. package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
  23. package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
  24. package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
  25. package/dist/types/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +15 -14
  27. package/src/components/Buttons/IconButton.tsx +11 -11
  28. package/src/components/Icon/Icon.stories.tsx +113 -0
  29. package/src/components/Icon/Icon.tsx +1 -1
  30. package/src/components/Lists/List.stories.tsx +1 -1
  31. package/src/components/Main/Main.tsx +13 -13
  32. package/src/components/Menus/DropdownMenu.tsx +18 -1
  33. package/src/components/Popover/Popover.tsx +17 -0
  34. package/src/components/Select/Select.tsx +1 -1
  35. package/src/components/Toolbar/Toolbar.stories.tsx +1 -3
  36. package/src/components/Toolbar/Toolbar.tsx +6 -5
  37. package/src/playground/Custom.stories.tsx +6 -8
  38. package/src/testing/decorators/withSurfaceVariantsLayout.tsx +1 -1
  39. package/dist/lib/browser/chunk-KX5JDELJ.mjs.map +0 -7
  40. package/dist/lib/node-esm/chunk-3HDQYL5S.mjs.map +0 -7
@@ -277,7 +277,7 @@ import React6, { forwardRef as forwardRef5 } from "react";
277
277
  // src/components/Icon/Icon.tsx
278
278
  import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
279
279
  import React4, { forwardRef as forwardRef3, memo } from "react";
280
- var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef3(({ icon, classNames, size, ...props }, forwardedRef) => {
280
+ var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef3(({ icon, classNames, size = 4, ...props }, forwardedRef) => {
281
281
  var _effect = _useSignals4();
282
282
  try {
283
283
  const { tx } = useThemeContext();
@@ -1107,7 +1107,21 @@ var Tooltip = {
1107
1107
  };
1108
1108
 
1109
1109
  // src/components/Buttons/IconButton.tsx
1110
- var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipPortal = true, tooltipSide, ...props }, forwardedRef) => {
1110
+ var IconButton = /* @__PURE__ */ forwardRef8((props, forwardedRef) => {
1111
+ var _effect = _useSignals9();
1112
+ try {
1113
+ return props.iconOnly ? /* @__PURE__ */ React9.createElement(IconOnlyButton, {
1114
+ ...props,
1115
+ ref: forwardedRef
1116
+ }) : /* @__PURE__ */ React9.createElement(LabelledIconButton, {
1117
+ ...props,
1118
+ ref: forwardedRef
1119
+ });
1120
+ } finally {
1121
+ _effect.f();
1122
+ }
1123
+ });
1124
+ var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipSide, ...props }, forwardedRef) => {
1111
1125
  var _effect = _useSignals9();
1112
1126
  try {
1113
1127
  if (noTooltip) {
@@ -1128,7 +1142,7 @@ var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipPortal = t
1128
1142
  _effect.f();
1129
1143
  }
1130
1144
  });
1131
- var LabelledIconButton = /* @__PURE__ */ forwardRef8(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, ...props }, forwardedRef) => {
1145
+ var LabelledIconButton = /* @__PURE__ */ forwardRef8(({ icon, size = 5, iconOnly, label, classNames, iconClassNames, caretDown, ...props }, forwardedRef) => {
1132
1146
  var _effect = _useSignals9();
1133
1147
  try {
1134
1148
  const { tx } = useThemeContext();
@@ -1152,20 +1166,6 @@ var LabelledIconButton = /* @__PURE__ */ forwardRef8(({ icon, size, iconOnly, la
1152
1166
  _effect.f();
1153
1167
  }
1154
1168
  });
1155
- var IconButton = /* @__PURE__ */ forwardRef8((props, forwardedRef) => {
1156
- var _effect = _useSignals9();
1157
- try {
1158
- return props.iconOnly ? /* @__PURE__ */ React9.createElement(IconOnlyButton, {
1159
- ...props,
1160
- ref: forwardedRef
1161
- }) : /* @__PURE__ */ React9.createElement(LabelledIconButton, {
1162
- ...props,
1163
- ref: forwardedRef
1164
- });
1165
- } finally {
1166
- _effect.f();
1167
- }
1168
- });
1169
1169
 
1170
1170
  // src/components/Buttons/Toggle.tsx
1171
1171
  import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
@@ -1286,23 +1286,14 @@ import React15, { createContext as createContext7, useEffect as useEffect4, useM
1286
1286
 
1287
1287
  // src/util/domino.ts
1288
1288
  import { mx as mx2 } from "@dxos/react-ui-theme";
1289
- function _define_property(obj, key, value) {
1290
- if (key in obj) {
1291
- Object.defineProperty(obj, key, {
1292
- value,
1293
- enumerable: true,
1294
- configurable: true,
1295
- writable: true
1296
- });
1297
- } else {
1298
- obj[key] = value;
1299
- }
1300
- return obj;
1301
- }
1302
1289
  var Domino = class _Domino {
1303
1290
  static of(tag) {
1304
1291
  return new _Domino(tag);
1305
1292
  }
1293
+ _el;
1294
+ constructor(tag) {
1295
+ this._el = document.createElement(tag);
1296
+ }
1306
1297
  classNames(...classNames) {
1307
1298
  this._el.className = mx2(classNames);
1308
1299
  return this;
@@ -1334,10 +1325,6 @@ var Domino = class _Domino {
1334
1325
  build() {
1335
1326
  return this._el;
1336
1327
  }
1337
- constructor(tag) {
1338
- _define_property(this, "_el", void 0);
1339
- this._el = document.createElement(tag);
1340
- }
1341
1328
  };
1342
1329
 
1343
1330
  // src/util/hasIosKeyboard.ts
@@ -2485,10 +2472,10 @@ var useSwipeToDismiss = (ref, {
2485
2472
 
2486
2473
  // src/components/Main/Main.tsx
2487
2474
  var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui/src/components/Main/Main.tsx";
2475
+ var MAIN_NAME = "Main";
2488
2476
  var MAIN_ROOT_NAME = "MainRoot";
2489
2477
  var NAVIGATION_SIDEBAR_NAME = "NavigationSidebar";
2490
2478
  var COMPLEMENTARY_SIDEBAR_NAME = "ComplementarySidebar";
2491
- var MAIN_NAME = "Main";
2492
2479
  var GENERIC_CONSUMER_NAME = "GenericConsumer";
2493
2480
  var landmarkAttr = "data-main-landmark";
2494
2481
  var useLandmarkMover = (propsOnKeyDown, landmark) => {
@@ -2917,7 +2904,7 @@ import { createMenuScope } from "@radix-ui/react-menu";
2917
2904
  import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
2918
2905
  import { Slot as Slot10 } from "@radix-ui/react-slot";
2919
2906
  import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
2920
- import React27, { forwardRef as forwardRef19, useCallback as useCallback10, useEffect as useEffect7, useRef as useRef3 } from "react";
2907
+ import React27, { forwardRef as forwardRef19, useCallback as useCallback10, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef3 } from "react";
2921
2908
  var DROPDOWN_MENU_NAME = "DropdownMenu";
2922
2909
  var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope3(DROPDOWN_MENU_NAME, [
2923
2910
  createMenuScope
@@ -3069,18 +3056,35 @@ var CONTENT_NAME2 = "DropdownMenuContent";
3069
3056
  var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
3070
3057
  var _effect = _useSignals27();
3071
3058
  try {
3072
- const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
3059
+ const { __scopeDropdownMenu, classNames, collisionPadding = 8, collisionBoundary, ...contentProps } = props;
3073
3060
  const { tx } = useThemeContext();
3074
3061
  const context = useDropdownMenuContext(CONTENT_NAME2, __scopeDropdownMenu);
3075
3062
  const elevation = useElevationContext();
3076
3063
  const menuScope = useMenuScope(__scopeDropdownMenu);
3077
3064
  const hasInteractedOutsideRef = useRef3(false);
3078
3065
  const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
3066
+ const computedCollisionBoundary = useMemo5(() => {
3067
+ const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
3068
+ return closestBoundary ? Array.isArray(collisionBoundary) ? [
3069
+ closestBoundary,
3070
+ ...collisionBoundary
3071
+ ] : collisionBoundary ? [
3072
+ closestBoundary,
3073
+ collisionBoundary
3074
+ ] : [
3075
+ closestBoundary
3076
+ ] : collisionBoundary;
3077
+ }, [
3078
+ context.open,
3079
+ collisionBoundary,
3080
+ context.triggerRef.current
3081
+ ]);
3079
3082
  return /* @__PURE__ */ React27.createElement(MenuPrimitive.Content, {
3080
3083
  id: context.contentId,
3081
3084
  "aria-labelledby": context.triggerId,
3082
3085
  ...menuScope,
3083
3086
  ...contentProps,
3087
+ collisionBoundary: computedCollisionBoundary,
3084
3088
  collisionPadding: safeCollisionPadding,
3085
3089
  ref: forwardedRef,
3086
3090
  onCloseAutoFocus: composeEventHandlers2(props.onCloseAutoFocus, (event) => {
@@ -3469,7 +3473,7 @@ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
3469
3473
  import { Slot as Slot12 } from "@radix-ui/react-slot";
3470
3474
  import { useControllableState as useControllableState6 } from "@radix-ui/react-use-controllable-state";
3471
3475
  import { hideOthers } from "aria-hidden";
3472
- import React29, { forwardRef as forwardRef21, useCallback as useCallback11, useEffect as useEffect8, useRef as useRef4, useState as useState9 } from "react";
3476
+ import React29, { forwardRef as forwardRef21, useCallback as useCallback11, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef4, useState as useState9 } from "react";
3473
3477
  import { RemoveScroll } from "react-remove-scroll";
3474
3478
  var POPOVER_NAME = "Popover";
3475
3479
  var [createPopoverContext, createPopoverScope] = createContextScope4(POPOVER_NAME, [
@@ -3719,13 +3723,29 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef21((props, forwardedRef)
3719
3723
  var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
3720
3724
  var _effect = _useSignals29();
3721
3725
  try {
3722
- const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, classNames, ...contentProps } = props;
3726
+ const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, collisionBoundary, classNames, ...contentProps } = props;
3723
3727
  const context = usePopoverContext(CONTENT_NAME3, __scopePopover);
3724
3728
  const popperScope = usePopperScope2(__scopePopover);
3725
3729
  const { tx } = useThemeContext();
3726
3730
  const elevation = useElevationContext();
3727
3731
  const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
3728
3732
  useFocusGuards();
3733
+ const computedCollisionBoundary = useMemo6(() => {
3734
+ const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
3735
+ return closestBoundary ? Array.isArray(collisionBoundary) ? [
3736
+ closestBoundary,
3737
+ ...collisionBoundary
3738
+ ] : collisionBoundary ? [
3739
+ closestBoundary,
3740
+ collisionBoundary
3741
+ ] : [
3742
+ closestBoundary
3743
+ ] : collisionBoundary;
3744
+ }, [
3745
+ context.open,
3746
+ collisionBoundary,
3747
+ context.triggerRef.current
3748
+ ]);
3729
3749
  return /* @__PURE__ */ React29.createElement(FocusScope, {
3730
3750
  asChild: true,
3731
3751
  loop: true,
@@ -3747,6 +3767,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
3747
3767
  ...popperScope,
3748
3768
  ...contentProps,
3749
3769
  collisionPadding: safeCollisionPadding,
3770
+ collisionBoundary: computedCollisionBoundary,
3750
3771
  className: tx("popover.content", "popover", {
3751
3772
  elevation
3752
3773
  }, classNames),
@@ -4023,7 +4044,7 @@ var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef24(({ classNames, childr
4023
4044
  _effect.f();
4024
4045
  }
4025
4046
  });
4026
- var SelectViewport2 = /* @__PURE__ */ forwardRef24(({ classNames, asChild, children, ...props }, forwardedRef) => {
4047
+ var SelectViewport2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
4027
4048
  var _effect = _useSignals32();
4028
4049
  try {
4029
4050
  const { tx } = useThemeContext();
@@ -4282,12 +4303,12 @@ var Toast = {
4282
4303
  import { useSignals as _useSignals36 } from "@preact-signals/safe-react/tracking";
4283
4304
  import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
4284
4305
  import React36, { Fragment, forwardRef as forwardRef28 } from "react";
4285
- var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, layoutManaged, textBlockWidth: wrapContents, ...props }, forwardedRef) => {
4306
+ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, layoutManaged, textBlockWidth: textBlockWidthParam, disabled, ...props }, forwardedRef) => {
4286
4307
  var _effect = _useSignals36();
4287
4308
  try {
4288
4309
  const { tx } = useThemeContext();
4289
- const InnerRoot = wrapContents ? "div" : Fragment;
4290
- const innerRootProps = wrapContents ? {
4310
+ const InnerRoot = textBlockWidthParam ? "div" : Fragment;
4311
+ const innerRootProps = textBlockWidthParam ? {
4291
4312
  role: "none",
4292
4313
  className: tx("toolbar.inner", "toolbar", {
4293
4314
  layoutManaged
@@ -4297,7 +4318,8 @@ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, layoutMa
4297
4318
  ...props,
4298
4319
  "data-arrow-keys": props.orientation === "vertical" ? "up down" : "left right",
4299
4320
  className: tx("toolbar.root", "toolbar", {
4300
- layoutManaged
4321
+ layoutManaged,
4322
+ disabled
4301
4323
  }, classNames),
4302
4324
  ref: forwardedRef
4303
4325
  }, /* @__PURE__ */ React36.createElement(InnerRoot, innerRootProps, children));
@@ -4520,4 +4542,4 @@ export {
4520
4542
  Toast,
4521
4543
  Toolbar
4522
4544
  };
4523
- //# sourceMappingURL=chunk-3HDQYL5S.mjs.map
4545
+ //# sourceMappingURL=chunk-FL2ZT5KB.mjs.map