@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
@@ -275,7 +275,7 @@ import React6, { forwardRef as forwardRef5 } from "react";
275
275
  // src/components/Icon/Icon.tsx
276
276
  import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
277
277
  import React4, { forwardRef as forwardRef3, memo } from "react";
278
- var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef3(({ icon, classNames, size, ...props }, forwardedRef) => {
278
+ var Icon = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef3(({ icon, classNames, size = 4, ...props }, forwardedRef) => {
279
279
  var _effect = _useSignals4();
280
280
  try {
281
281
  const { tx } = useThemeContext();
@@ -1105,7 +1105,21 @@ var Tooltip = {
1105
1105
  };
1106
1106
 
1107
1107
  // src/components/Buttons/IconButton.tsx
1108
- var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipPortal = true, tooltipSide, ...props }, forwardedRef) => {
1108
+ var IconButton = /* @__PURE__ */ forwardRef8((props, forwardedRef) => {
1109
+ var _effect = _useSignals9();
1110
+ try {
1111
+ return props.iconOnly ? /* @__PURE__ */ React9.createElement(IconOnlyButton, {
1112
+ ...props,
1113
+ ref: forwardedRef
1114
+ }) : /* @__PURE__ */ React9.createElement(LabelledIconButton, {
1115
+ ...props,
1116
+ ref: forwardedRef
1117
+ });
1118
+ } finally {
1119
+ _effect.f();
1120
+ }
1121
+ });
1122
+ var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipSide, ...props }, forwardedRef) => {
1109
1123
  var _effect = _useSignals9();
1110
1124
  try {
1111
1125
  if (noTooltip) {
@@ -1126,7 +1140,7 @@ var IconOnlyButton = /* @__PURE__ */ forwardRef8(({ noTooltip, tooltipPortal = t
1126
1140
  _effect.f();
1127
1141
  }
1128
1142
  });
1129
- var LabelledIconButton = /* @__PURE__ */ forwardRef8(({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, ...props }, forwardedRef) => {
1143
+ var LabelledIconButton = /* @__PURE__ */ forwardRef8(({ icon, size = 5, iconOnly, label, classNames, iconClassNames, caretDown, ...props }, forwardedRef) => {
1130
1144
  var _effect = _useSignals9();
1131
1145
  try {
1132
1146
  const { tx } = useThemeContext();
@@ -1150,20 +1164,6 @@ var LabelledIconButton = /* @__PURE__ */ forwardRef8(({ icon, size, iconOnly, la
1150
1164
  _effect.f();
1151
1165
  }
1152
1166
  });
1153
- var IconButton = /* @__PURE__ */ forwardRef8((props, forwardedRef) => {
1154
- var _effect = _useSignals9();
1155
- try {
1156
- return props.iconOnly ? /* @__PURE__ */ React9.createElement(IconOnlyButton, {
1157
- ...props,
1158
- ref: forwardedRef
1159
- }) : /* @__PURE__ */ React9.createElement(LabelledIconButton, {
1160
- ...props,
1161
- ref: forwardedRef
1162
- });
1163
- } finally {
1164
- _effect.f();
1165
- }
1166
- });
1167
1167
 
1168
1168
  // src/components/Buttons/Toggle.tsx
1169
1169
  import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
@@ -1284,23 +1284,14 @@ import React15, { createContext as createContext7, useEffect as useEffect4, useM
1284
1284
 
1285
1285
  // src/util/domino.ts
1286
1286
  import { mx as mx2 } from "@dxos/react-ui-theme";
1287
- function _define_property(obj, key, value) {
1288
- if (key in obj) {
1289
- Object.defineProperty(obj, key, {
1290
- value,
1291
- enumerable: true,
1292
- configurable: true,
1293
- writable: true
1294
- });
1295
- } else {
1296
- obj[key] = value;
1297
- }
1298
- return obj;
1299
- }
1300
1287
  var Domino = class _Domino {
1301
1288
  static of(tag) {
1302
1289
  return new _Domino(tag);
1303
1290
  }
1291
+ _el;
1292
+ constructor(tag) {
1293
+ this._el = document.createElement(tag);
1294
+ }
1304
1295
  classNames(...classNames) {
1305
1296
  this._el.className = mx2(classNames);
1306
1297
  return this;
@@ -1332,10 +1323,6 @@ var Domino = class _Domino {
1332
1323
  build() {
1333
1324
  return this._el;
1334
1325
  }
1335
- constructor(tag) {
1336
- _define_property(this, "_el", void 0);
1337
- this._el = document.createElement(tag);
1338
- }
1339
1326
  };
1340
1327
 
1341
1328
  // src/util/hasIosKeyboard.ts
@@ -2483,10 +2470,10 @@ var useSwipeToDismiss = (ref, {
2483
2470
 
2484
2471
  // src/components/Main/Main.tsx
2485
2472
  var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui/src/components/Main/Main.tsx";
2473
+ var MAIN_NAME = "Main";
2486
2474
  var MAIN_ROOT_NAME = "MainRoot";
2487
2475
  var NAVIGATION_SIDEBAR_NAME = "NavigationSidebar";
2488
2476
  var COMPLEMENTARY_SIDEBAR_NAME = "ComplementarySidebar";
2489
- var MAIN_NAME = "Main";
2490
2477
  var GENERIC_CONSUMER_NAME = "GenericConsumer";
2491
2478
  var landmarkAttr = "data-main-landmark";
2492
2479
  var useLandmarkMover = (propsOnKeyDown, landmark) => {
@@ -2915,7 +2902,7 @@ import { createMenuScope } from "@radix-ui/react-menu";
2915
2902
  import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
2916
2903
  import { Slot as Slot10 } from "@radix-ui/react-slot";
2917
2904
  import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
2918
- import React27, { forwardRef as forwardRef19, useCallback as useCallback10, useEffect as useEffect7, useRef as useRef3 } from "react";
2905
+ import React27, { forwardRef as forwardRef19, useCallback as useCallback10, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef3 } from "react";
2919
2906
  var DROPDOWN_MENU_NAME = "DropdownMenu";
2920
2907
  var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope3(DROPDOWN_MENU_NAME, [
2921
2908
  createMenuScope
@@ -3067,18 +3054,35 @@ var CONTENT_NAME2 = "DropdownMenuContent";
3067
3054
  var DropdownMenuContent = /* @__PURE__ */ forwardRef19((props, forwardedRef) => {
3068
3055
  var _effect = _useSignals27();
3069
3056
  try {
3070
- const { __scopeDropdownMenu, classNames, collisionPadding = 8, ...contentProps } = props;
3057
+ const { __scopeDropdownMenu, classNames, collisionPadding = 8, collisionBoundary, ...contentProps } = props;
3071
3058
  const { tx } = useThemeContext();
3072
3059
  const context = useDropdownMenuContext(CONTENT_NAME2, __scopeDropdownMenu);
3073
3060
  const elevation = useElevationContext();
3074
3061
  const menuScope = useMenuScope(__scopeDropdownMenu);
3075
3062
  const hasInteractedOutsideRef = useRef3(false);
3076
3063
  const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
3064
+ const computedCollisionBoundary = useMemo5(() => {
3065
+ const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
3066
+ return closestBoundary ? Array.isArray(collisionBoundary) ? [
3067
+ closestBoundary,
3068
+ ...collisionBoundary
3069
+ ] : collisionBoundary ? [
3070
+ closestBoundary,
3071
+ collisionBoundary
3072
+ ] : [
3073
+ closestBoundary
3074
+ ] : collisionBoundary;
3075
+ }, [
3076
+ context.open,
3077
+ collisionBoundary,
3078
+ context.triggerRef.current
3079
+ ]);
3077
3080
  return /* @__PURE__ */ React27.createElement(MenuPrimitive.Content, {
3078
3081
  id: context.contentId,
3079
3082
  "aria-labelledby": context.triggerId,
3080
3083
  ...menuScope,
3081
3084
  ...contentProps,
3085
+ collisionBoundary: computedCollisionBoundary,
3082
3086
  collisionPadding: safeCollisionPadding,
3083
3087
  ref: forwardedRef,
3084
3088
  onCloseAutoFocus: composeEventHandlers2(props.onCloseAutoFocus, (event) => {
@@ -3467,7 +3471,7 @@ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
3467
3471
  import { Slot as Slot12 } from "@radix-ui/react-slot";
3468
3472
  import { useControllableState as useControllableState6 } from "@radix-ui/react-use-controllable-state";
3469
3473
  import { hideOthers } from "aria-hidden";
3470
- import React29, { forwardRef as forwardRef21, useCallback as useCallback11, useEffect as useEffect8, useRef as useRef4, useState as useState9 } from "react";
3474
+ import React29, { forwardRef as forwardRef21, useCallback as useCallback11, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef4, useState as useState9 } from "react";
3471
3475
  import { RemoveScroll } from "react-remove-scroll";
3472
3476
  var POPOVER_NAME = "Popover";
3473
3477
  var [createPopoverContext, createPopoverScope] = createContextScope4(POPOVER_NAME, [
@@ -3717,13 +3721,29 @@ var PopoverContentNonModal = /* @__PURE__ */ forwardRef21((props, forwardedRef)
3717
3721
  var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
3718
3722
  var _effect = _useSignals29();
3719
3723
  try {
3720
- const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, classNames, ...contentProps } = props;
3724
+ const { __scopePopover, trapFocus, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, collisionPadding = 8, collisionBoundary, classNames, ...contentProps } = props;
3721
3725
  const context = usePopoverContext(CONTENT_NAME3, __scopePopover);
3722
3726
  const popperScope = usePopperScope2(__scopePopover);
3723
3727
  const { tx } = useThemeContext();
3724
3728
  const elevation = useElevationContext();
3725
3729
  const safeCollisionPadding = useSafeCollisionPadding(collisionPadding);
3726
3730
  useFocusGuards();
3731
+ const computedCollisionBoundary = useMemo6(() => {
3732
+ const closestBoundary = context.triggerRef.current?.closest("[data-popover-collision-boundary]");
3733
+ return closestBoundary ? Array.isArray(collisionBoundary) ? [
3734
+ closestBoundary,
3735
+ ...collisionBoundary
3736
+ ] : collisionBoundary ? [
3737
+ closestBoundary,
3738
+ collisionBoundary
3739
+ ] : [
3740
+ closestBoundary
3741
+ ] : collisionBoundary;
3742
+ }, [
3743
+ context.open,
3744
+ collisionBoundary,
3745
+ context.triggerRef.current
3746
+ ]);
3727
3747
  return /* @__PURE__ */ React29.createElement(FocusScope, {
3728
3748
  asChild: true,
3729
3749
  loop: true,
@@ -3745,6 +3765,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
3745
3765
  ...popperScope,
3746
3766
  ...contentProps,
3747
3767
  collisionPadding: safeCollisionPadding,
3768
+ collisionBoundary: computedCollisionBoundary,
3748
3769
  className: tx("popover.content", "popover", {
3749
3770
  elevation
3750
3771
  }, classNames),
@@ -4021,7 +4042,7 @@ var SelectScrollDownButton2 = /* @__PURE__ */ forwardRef24(({ classNames, childr
4021
4042
  _effect.f();
4022
4043
  }
4023
4044
  });
4024
- var SelectViewport2 = /* @__PURE__ */ forwardRef24(({ classNames, asChild, children, ...props }, forwardedRef) => {
4045
+ var SelectViewport2 = /* @__PURE__ */ forwardRef24(({ classNames, children, ...props }, forwardedRef) => {
4025
4046
  var _effect = _useSignals32();
4026
4047
  try {
4027
4048
  const { tx } = useThemeContext();
@@ -4280,12 +4301,12 @@ var Toast = {
4280
4301
  import { useSignals as _useSignals36 } from "@preact-signals/safe-react/tracking";
4281
4302
  import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
4282
4303
  import React36, { Fragment, forwardRef as forwardRef28 } from "react";
4283
- var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, layoutManaged, textBlockWidth: wrapContents, ...props }, forwardedRef) => {
4304
+ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, layoutManaged, textBlockWidth: textBlockWidthParam, disabled, ...props }, forwardedRef) => {
4284
4305
  var _effect = _useSignals36();
4285
4306
  try {
4286
4307
  const { tx } = useThemeContext();
4287
- const InnerRoot = wrapContents ? "div" : Fragment;
4288
- const innerRootProps = wrapContents ? {
4308
+ const InnerRoot = textBlockWidthParam ? "div" : Fragment;
4309
+ const innerRootProps = textBlockWidthParam ? {
4289
4310
  role: "none",
4290
4311
  className: tx("toolbar.inner", "toolbar", {
4291
4312
  layoutManaged
@@ -4295,7 +4316,8 @@ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, layoutMa
4295
4316
  ...props,
4296
4317
  "data-arrow-keys": props.orientation === "vertical" ? "up down" : "left right",
4297
4318
  className: tx("toolbar.root", "toolbar", {
4298
- layoutManaged
4319
+ layoutManaged,
4320
+ disabled
4299
4321
  }, classNames),
4300
4322
  ref: forwardedRef
4301
4323
  }, /* @__PURE__ */ React36.createElement(InnerRoot, innerRootProps, children));
@@ -4518,4 +4540,4 @@ export {
4518
4540
  Toast,
4519
4541
  Toolbar
4520
4542
  };
4521
- //# sourceMappingURL=chunk-KX5JDELJ.mjs.map
4543
+ //# sourceMappingURL=chunk-YG7RAH7A.mjs.map