@dxos/react-ui 0.8.4-main.e098934 → 0.8.4-main.ead640a
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.
- package/dist/lib/browser/{chunk-Y4PW3CX2.mjs → chunk-24AWTFTZ.mjs} +219 -100
- package/dist/lib/browser/chunk-24AWTFTZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +54 -26
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/{chunk-L6LIOSFT.mjs → chunk-MPRFBTTQ.mjs} +219 -100
- package/dist/lib/node-esm/chunk-MPRFBTTQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5 -1
- package/dist/lib/node-esm/index.mjs.map +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +54 -26
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts +0 -6
- package/dist/types/src/components/Avatars/Avatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts +0 -6
- package/dist/types/src/components/Avatars/AvatarGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts +0 -6
- package/dist/types/src/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Button.d.ts +1 -1
- package/dist/types/src/components/Buttons/Button.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Button.stories.d.ts +1 -7
- package/dist/types/src/components/Buttons/Button.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts +0 -6
- package/dist/types/src/components/Buttons/IconButton.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts +0 -6
- package/dist/types/src/components/Buttons/Toggle.stories.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts +2 -6
- package/dist/types/src/components/Buttons/ToggleGroup.d.ts.map +1 -1
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts +2 -12
- package/dist/types/src/components/Buttons/ToggleGroup.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts +0 -6
- package/dist/types/src/components/Dialogs/AlertDialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts +0 -1
- package/dist/types/src/components/Dialogs/Dialog.stories.d.ts.map +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts +1 -1
- package/dist/types/src/components/Icon/Icon.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.d.ts +0 -2
- package/dist/types/src/components/Input/Input.d.ts.map +1 -1
- package/dist/types/src/components/Input/Input.stories.d.ts +0 -6
- package/dist/types/src/components/Input/Input.stories.d.ts.map +1 -1
- package/dist/types/src/components/Link/Link.stories.d.ts +0 -6
- package/dist/types/src/components/Link/Link.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/List.stories.d.ts +0 -6
- package/dist/types/src/components/Lists/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Tree.stories.d.ts +0 -6
- package/dist/types/src/components/Lists/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Lists/Treegrid.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.d.ts +1 -10
- package/dist/types/src/components/Main/Main.d.ts.map +1 -1
- package/dist/types/src/components/Main/Main.stories.d.ts +1 -2
- package/dist/types/src/components/Main/Main.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts +0 -6
- package/dist/types/src/components/Menus/ContextMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.d.ts.map +1 -1
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts +0 -6
- package/dist/types/src/components/Menus/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/Message/Message.stories.d.ts +0 -1
- package/dist/types/src/components/Message/Message.stories.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts +1 -1
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/Popover/Popover.stories.d.ts +0 -6
- package/dist/types/src/components/Popover/Popover.stories.d.ts.map +1 -1
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts +0 -6
- package/dist/types/src/components/ScrollArea/ScrollArea.stories.d.ts.map +1 -1
- package/dist/types/src/components/Select/Select.stories.d.ts +0 -6
- package/dist/types/src/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/src/components/Status/Status.stories.d.ts +0 -6
- package/dist/types/src/components/Status/Status.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tag/Tag.stories.d.ts +8 -8
- package/dist/types/src/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toast/Toast.stories.d.ts +0 -6
- package/dist/types/src/components/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +9 -11
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts +0 -6
- package/dist/types/src/components/Toolbar/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +1 -3
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts +0 -6
- package/dist/types/src/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/useSafeArea.d.ts.map +1 -1
- package/dist/types/src/hooks/useVisualViewport.d.ts +2 -2
- package/dist/types/src/hooks/useVisualViewport.d.ts.map +1 -1
- package/dist/types/src/playground/Controls.stories.d.ts +0 -6
- package/dist/types/src/playground/Controls.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Custom.stories.d.ts +1 -2
- package/dist/types/src/playground/Custom.stories.d.ts.map +1 -1
- package/dist/types/src/playground/Typography.stories.d.ts +0 -6
- package/dist/types/src/playground/Typography.stories.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/index.d.ts +2 -1
- package/dist/types/src/testing/decorators/index.d.ts.map +1 -1
- package/dist/types/src/testing/decorators/withLayout.d.ts +15 -0
- package/dist/types/src/testing/decorators/withLayout.d.ts.map +1 -0
- package/dist/types/src/testing/decorators/withTheme.d.ts +3 -0
- package/dist/types/src/testing/decorators/withTheme.d.ts.map +1 -1
- package/dist/types/src/util/domino.d.ts +18 -0
- package/dist/types/src/util/domino.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/usePx.d.ts +8 -0
- package/dist/types/src/util/usePx.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -22
- package/src/components/Avatars/Avatar.stories.tsx +0 -2
- package/src/components/Avatars/AvatarGroup.stories.tsx +0 -3
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +0 -3
- package/src/components/Buttons/Button.stories.tsx +3 -5
- package/src/components/Buttons/IconButton.stories.tsx +0 -3
- package/src/components/Buttons/Toggle.stories.tsx +0 -3
- package/src/components/Buttons/ToggleGroup.stories.tsx +0 -3
- package/src/components/Dialogs/AlertDialog.stories.tsx +0 -3
- package/src/components/Dialogs/Dialog.stories.tsx +5 -3
- package/src/components/Icon/Icon.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +0 -3
- package/src/components/Input/Input.tsx +3 -3
- package/src/components/Link/Link.stories.tsx +0 -3
- package/src/components/Lists/List.stories.tsx +2 -6
- package/src/components/Lists/Tree.stories.tsx +0 -3
- package/src/components/Lists/Treegrid.tsx +57 -16
- package/src/components/Main/Main.stories.tsx +3 -3
- package/src/components/Main/Main.tsx +17 -8
- package/src/components/Menus/ContextMenu.stories.tsx +0 -3
- package/src/components/Menus/DropdownMenu.stories.tsx +0 -3
- package/src/components/Menus/DropdownMenu.tsx +2 -2
- package/src/components/Message/Message.stories.tsx +0 -2
- package/src/components/Popover/Popover.stories.tsx +0 -3
- package/src/components/Popover/Popover.tsx +5 -5
- package/src/components/ScrollArea/ScrollArea.stories.tsx +0 -3
- package/src/components/Select/Select.stories.tsx +3 -5
- package/src/components/Status/Status.stories.tsx +0 -3
- package/src/components/Tag/Tag.stories.tsx +8 -7
- package/src/components/Toast/Toast.stories.tsx +0 -3
- package/src/components/Toolbar/Toolbar.stories.tsx +0 -3
- package/src/components/Toolbar/Toolbar.tsx +14 -4
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -3
- package/src/components/Tooltip/Tooltip.tsx +2 -1
- package/src/hooks/useSafeArea.ts +3 -2
- package/src/hooks/useVisualViewport.ts +4 -4
- package/src/playground/Controls.stories.tsx +3 -5
- package/src/playground/Custom.stories.tsx +3 -12
- package/src/playground/Typography.stories.tsx +0 -3
- package/src/testing/decorators/index.ts +2 -1
- package/src/testing/decorators/withLayout.tsx +56 -0
- package/src/testing/decorators/withTheme.tsx +31 -0
- package/src/util/domino.ts +53 -0
- package/src/util/index.ts +2 -0
- package/src/util/usePx.ts +61 -0
- package/dist/lib/browser/chunk-Y4PW3CX2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-L6LIOSFT.mjs.map +0 -7
- package/src/testing/decorators/withTheme.ts +0 -25
|
@@ -31,7 +31,7 @@ var useIconHref = (icon) => {
|
|
|
31
31
|
|
|
32
32
|
// src/hooks/useSafeArea.ts
|
|
33
33
|
import { useCallback, useState } from "react";
|
|
34
|
-
import {
|
|
34
|
+
import { useViewportResize } from "@dxos/react-hooks";
|
|
35
35
|
var initialSafeArea = {
|
|
36
36
|
top: NaN,
|
|
37
37
|
right: NaN,
|
|
@@ -48,7 +48,7 @@ var useSafeArea = () => {
|
|
|
48
48
|
left: parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--safe-area-left"))
|
|
49
49
|
});
|
|
50
50
|
}, []);
|
|
51
|
-
|
|
51
|
+
useViewportResize(handleResize);
|
|
52
52
|
return padding;
|
|
53
53
|
};
|
|
54
54
|
|
|
@@ -130,7 +130,7 @@ var useTranslationsContext = () => useContext4(TranslationsContext);
|
|
|
130
130
|
|
|
131
131
|
// src/hooks/useVisualViewport.ts
|
|
132
132
|
import { useCallback as useCallback2, useState as useState3 } from "react";
|
|
133
|
-
import {
|
|
133
|
+
import { useViewportResize as useViewportResize2 } from "@dxos/react-hooks";
|
|
134
134
|
var useVisualViewport = (deps) => {
|
|
135
135
|
const [width, setWidth] = useState3(null);
|
|
136
136
|
const [height, setHeight] = useState3(null);
|
|
@@ -140,7 +140,7 @@ var useVisualViewport = (deps) => {
|
|
|
140
140
|
setHeight(window.visualViewport.height);
|
|
141
141
|
}
|
|
142
142
|
}, []);
|
|
143
|
-
|
|
143
|
+
useViewportResize2(handleResize, deps);
|
|
144
144
|
return {
|
|
145
145
|
width,
|
|
146
146
|
height
|
|
@@ -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();
|
|
@@ -1277,18 +1277,116 @@ var ClipboardProvider = ({ children }) => {
|
|
|
1277
1277
|
// src/components/Clipboard/CopyButton.tsx
|
|
1278
1278
|
import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
|
|
1279
1279
|
import React16 from "react";
|
|
1280
|
-
import { mx as
|
|
1280
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
1281
1281
|
|
|
1282
1282
|
// src/components/ThemeProvider/ThemeProvider.tsx
|
|
1283
1283
|
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
1284
1284
|
import { createKeyborg } from "keyborg";
|
|
1285
|
-
import React15, { createContext as createContext7, useEffect as
|
|
1285
|
+
import React15, { createContext as createContext7, useEffect as useEffect4, useMemo as useMemo3 } from "react";
|
|
1286
|
+
|
|
1287
|
+
// src/util/domino.ts
|
|
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
|
+
var Domino = class _Domino {
|
|
1303
|
+
static of(tag) {
|
|
1304
|
+
return new _Domino(tag);
|
|
1305
|
+
}
|
|
1306
|
+
classNames(...classNames) {
|
|
1307
|
+
this._el.className = mx2(classNames);
|
|
1308
|
+
return this;
|
|
1309
|
+
}
|
|
1310
|
+
text(value) {
|
|
1311
|
+
this._el.textContent = value;
|
|
1312
|
+
return this;
|
|
1313
|
+
}
|
|
1314
|
+
data(key, value) {
|
|
1315
|
+
this._el.dataset[key] = value;
|
|
1316
|
+
return this;
|
|
1317
|
+
}
|
|
1318
|
+
attributes(attr) {
|
|
1319
|
+
Object.entries(attr).filter(([_, value]) => value !== void 0).map(([key, value]) => this._el.setAttribute(key, value));
|
|
1320
|
+
return this;
|
|
1321
|
+
}
|
|
1322
|
+
style(styles) {
|
|
1323
|
+
Object.assign(this._el.style, styles);
|
|
1324
|
+
return this;
|
|
1325
|
+
}
|
|
1326
|
+
children(...children) {
|
|
1327
|
+
children.forEach((child) => this._el.appendChild(child.build()));
|
|
1328
|
+
return this;
|
|
1329
|
+
}
|
|
1330
|
+
on(event, handler) {
|
|
1331
|
+
this._el.addEventListener(event, handler);
|
|
1332
|
+
return this;
|
|
1333
|
+
}
|
|
1334
|
+
build() {
|
|
1335
|
+
return this._el;
|
|
1336
|
+
}
|
|
1337
|
+
constructor(tag) {
|
|
1338
|
+
_define_property(this, "_el", void 0);
|
|
1339
|
+
this._el = document.createElement(tag);
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1286
1342
|
|
|
1287
1343
|
// src/util/hasIosKeyboard.ts
|
|
1288
1344
|
var hasIosKeyboard = () => {
|
|
1289
1345
|
return !!navigator.userAgent.match(/iP(ad|od|hone).+Safari/);
|
|
1290
1346
|
};
|
|
1291
1347
|
|
|
1348
|
+
// src/util/usePx.ts
|
|
1349
|
+
import { useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo2, useState as useState6 } from "react";
|
|
1350
|
+
var getDocumentElementFontSize = () => parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
1351
|
+
var usePx = (rem) => {
|
|
1352
|
+
const [fontSize, setFontSize] = useState6(() => {
|
|
1353
|
+
if (typeof document !== "undefined") {
|
|
1354
|
+
return getDocumentElementFontSize();
|
|
1355
|
+
}
|
|
1356
|
+
return 16;
|
|
1357
|
+
});
|
|
1358
|
+
const updateFontSize = useCallback5(() => {
|
|
1359
|
+
setFontSize(getDocumentElementFontSize());
|
|
1360
|
+
}, []);
|
|
1361
|
+
useEffect3(() => {
|
|
1362
|
+
if (typeof document === "undefined") {
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
const resizeObserver = new ResizeObserver(updateFontSize);
|
|
1366
|
+
resizeObserver.observe(document.documentElement);
|
|
1367
|
+
const mediaQueryList = window.matchMedia("all");
|
|
1368
|
+
const handleMediaChange = () => {
|
|
1369
|
+
updateFontSize();
|
|
1370
|
+
};
|
|
1371
|
+
if (mediaQueryList.addEventListener) {
|
|
1372
|
+
mediaQueryList.addEventListener("change", handleMediaChange);
|
|
1373
|
+
} else {
|
|
1374
|
+
mediaQueryList.addListener(handleMediaChange);
|
|
1375
|
+
}
|
|
1376
|
+
return () => {
|
|
1377
|
+
resizeObserver.disconnect();
|
|
1378
|
+
if (mediaQueryList.removeEventListener) {
|
|
1379
|
+
mediaQueryList.removeEventListener("change", handleMediaChange);
|
|
1380
|
+
} else {
|
|
1381
|
+
mediaQueryList.removeListener(handleMediaChange);
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
}, []);
|
|
1385
|
+
return useMemo2(() => rem * fontSize, [
|
|
1386
|
+
fontSize
|
|
1387
|
+
]);
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1292
1390
|
// src/components/DensityProvider/DensityProvider.tsx
|
|
1293
1391
|
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1294
1392
|
import React13, { createContext as createContext5 } from "react";
|
|
@@ -1332,7 +1430,7 @@ var ThemeContext = /* @__PURE__ */ createContext7(void 0);
|
|
|
1332
1430
|
var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx = (_path, defaultClassName, _styleProps, ..._options) => defaultClassName, themeMode = "dark", rootDensity = "fine", ...rest }) => {
|
|
1333
1431
|
var _effect = _useSignals15();
|
|
1334
1432
|
try {
|
|
1335
|
-
|
|
1433
|
+
useEffect4(() => {
|
|
1336
1434
|
if (document.defaultView) {
|
|
1337
1435
|
const kb = createKeyborg(document.defaultView);
|
|
1338
1436
|
kb.subscribe(handleInputModalityChange);
|
|
@@ -1340,7 +1438,7 @@ var ThemeProvider = ({ children, fallback = null, resourceExtensions, appNs, tx
|
|
|
1340
1438
|
}
|
|
1341
1439
|
}, []);
|
|
1342
1440
|
const safeAreaPadding = useSafeArea();
|
|
1343
|
-
const contextValue =
|
|
1441
|
+
const contextValue = useMemo3(() => ({
|
|
1344
1442
|
tx,
|
|
1345
1443
|
themeMode,
|
|
1346
1444
|
hasIosKeyboard: hasIosKeyboard(),
|
|
@@ -1393,7 +1491,7 @@ var CopyButton = ({ classNames, value, size = 5, ...props }) => {
|
|
|
1393
1491
|
"data-testid": "copy-invitation"
|
|
1394
1492
|
}, /* @__PURE__ */ React16.createElement("div", {
|
|
1395
1493
|
role: "none",
|
|
1396
|
-
className:
|
|
1494
|
+
className: mx3("flex gap-1 items-center", isCopied && inactiveLabelStyles)
|
|
1397
1495
|
}, /* @__PURE__ */ React16.createElement("span", {
|
|
1398
1496
|
className: "pli-1"
|
|
1399
1497
|
}, t("copy label")), /* @__PURE__ */ React16.createElement(Icon, {
|
|
@@ -1401,7 +1499,7 @@ var CopyButton = ({ classNames, value, size = 5, ...props }) => {
|
|
|
1401
1499
|
size
|
|
1402
1500
|
})), /* @__PURE__ */ React16.createElement("div", {
|
|
1403
1501
|
role: "none",
|
|
1404
|
-
className:
|
|
1502
|
+
className: mx3("flex gap-1 items-center", !isCopied && inactiveLabelStyles)
|
|
1405
1503
|
}, /* @__PURE__ */ React16.createElement("span", {
|
|
1406
1504
|
className: "pli-1"
|
|
1407
1505
|
}, t("copy success label")), /* @__PURE__ */ React16.createElement(Icon, {
|
|
@@ -1648,9 +1746,9 @@ var AlertDialog = {
|
|
|
1648
1746
|
import { useSignals as _useSignals19 } from "@preact-signals/safe-react/tracking";
|
|
1649
1747
|
import { Root as CheckboxPrimitive } from "@radix-ui/react-checkbox";
|
|
1650
1748
|
import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
|
|
1651
|
-
import React19, { forwardRef as forwardRef13, useCallback as
|
|
1749
|
+
import React19, { forwardRef as forwardRef13, useCallback as useCallback6 } from "react";
|
|
1652
1750
|
import { DescriptionAndValidation as DescriptionAndValidationPrimitive, Description as DescriptionPrimitive, INPUT_NAME, InputRoot, Label as LabelPrimitive, PinInput as PinInputPrimitive, TextArea as TextAreaPrimitive, TextInput as TextInputPrimitive, Validation as ValidationPrimitive, useInputContext } from "@dxos/react-input";
|
|
1653
|
-
import { mx as
|
|
1751
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
1654
1752
|
var Label = /* @__PURE__ */ forwardRef13(({ srOnly, classNames, children, ...props }, forwardedRef) => {
|
|
1655
1753
|
var _effect = _useSignals19();
|
|
1656
1754
|
try {
|
|
@@ -1720,7 +1818,7 @@ var PinInput = /* @__PURE__ */ forwardRef13(({ density: propsDensity, elevation:
|
|
|
1720
1818
|
const { tx } = useThemeContext();
|
|
1721
1819
|
const density = useDensityContext(propsDensity);
|
|
1722
1820
|
const elevation = useElevationContext(propsElevation);
|
|
1723
|
-
const segmentClassName =
|
|
1821
|
+
const segmentClassName = useCallback6(({ focused, validationValence }) => tx("input.input", "input--pin-segment", {
|
|
1724
1822
|
variant: "static",
|
|
1725
1823
|
focused,
|
|
1726
1824
|
disabled: props.disabled,
|
|
@@ -1802,7 +1900,7 @@ var TextArea = /* @__PURE__ */ forwardRef13(({ __inputScope, classNames, density
|
|
|
1802
1900
|
_effect.f();
|
|
1803
1901
|
}
|
|
1804
1902
|
});
|
|
1805
|
-
var Checkbox = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size,
|
|
1903
|
+
var Checkbox = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked, defaultChecked: propsDefaultChecked, onCheckedChange: propsOnCheckedChange, size, classNames, ...props }, forwardedRef) => {
|
|
1806
1904
|
var _effect = _useSignals19();
|
|
1807
1905
|
try {
|
|
1808
1906
|
const [checked, onCheckedChange] = useControllableState2({
|
|
@@ -1848,7 +1946,7 @@ var Switch = /* @__PURE__ */ forwardRef13(({ __inputScope, checked: propsChecked
|
|
|
1848
1946
|
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
1849
1947
|
return /* @__PURE__ */ React19.createElement("input", {
|
|
1850
1948
|
type: "checkbox",
|
|
1851
|
-
className:
|
|
1949
|
+
className: mx4("dx-checkbox--switch dx-focus-ring", classNames),
|
|
1852
1950
|
checked,
|
|
1853
1951
|
onChange: (event) => {
|
|
1854
1952
|
onCheckedChange(event.target.checked);
|
|
@@ -2157,12 +2255,12 @@ var TreeItem = {
|
|
|
2157
2255
|
|
|
2158
2256
|
// src/components/Lists/Treegrid.tsx
|
|
2159
2257
|
import { useSignals as _useSignals24 } from "@preact-signals/safe-react/tracking";
|
|
2160
|
-
import {
|
|
2258
|
+
import { useFocusFinders } from "@fluentui/react-tabster";
|
|
2161
2259
|
import { createContextScope as createContextScope2 } from "@radix-ui/react-context";
|
|
2162
2260
|
import { Primitive as Primitive7 } from "@radix-ui/react-primitive";
|
|
2163
2261
|
import { Slot as Slot7 } from "@radix-ui/react-slot";
|
|
2164
2262
|
import { useControllableState as useControllableState3 } from "@radix-ui/react-use-controllable-state";
|
|
2165
|
-
import React24, { forwardRef as forwardRef16 } from "react";
|
|
2263
|
+
import React24, { forwardRef as forwardRef16, useCallback as useCallback7 } from "react";
|
|
2166
2264
|
var TREEGRID_ROW_NAME = "TreegridRow";
|
|
2167
2265
|
var [createTreegridRowContext, createTreegridRowScope] = createContextScope2(TREEGRID_ROW_NAME, []);
|
|
2168
2266
|
var [TreegridRowProvider, useTreegridRowContext] = createTreegridRowContext(TREEGRID_ROW_NAME);
|
|
@@ -2173,14 +2271,43 @@ var TreegridRoot = /* @__PURE__ */ forwardRef16(({ asChild, classNames, children
|
|
|
2173
2271
|
try {
|
|
2174
2272
|
const { tx } = useThemeContext();
|
|
2175
2273
|
const Root7 = asChild ? Slot7 : Primitive7.div;
|
|
2176
|
-
const
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2274
|
+
const { findFirstFocusable } = useFocusFinders();
|
|
2275
|
+
const handleKeyDown = useCallback7((event) => {
|
|
2276
|
+
switch (event.key) {
|
|
2277
|
+
case "ArrowDown":
|
|
2278
|
+
case "ArrowUp": {
|
|
2279
|
+
const direction = event.key === "ArrowDown" ? "down" : "up";
|
|
2280
|
+
const target = event.target;
|
|
2281
|
+
const ancestorWithArrowKeys = target.closest(`[data-arrow-keys*="${direction}"], [data-arrow-keys="all"]`);
|
|
2282
|
+
if (!ancestorWithArrowKeys) {
|
|
2283
|
+
const currentRow = target.closest('[role="row"]');
|
|
2284
|
+
if (currentRow) {
|
|
2285
|
+
const treegrid = currentRow.closest('[role="treegrid"]');
|
|
2286
|
+
if (treegrid) {
|
|
2287
|
+
const rows = Array.from(treegrid.querySelectorAll('[role="row"]'));
|
|
2288
|
+
const currentIndex = rows.indexOf(currentRow);
|
|
2289
|
+
const nextIndex = direction === "down" ? currentIndex + 1 : currentIndex - 1;
|
|
2290
|
+
const targetRow = rows[nextIndex];
|
|
2291
|
+
if (targetRow) {
|
|
2292
|
+
const firstFocusable = findFirstFocusable(targetRow);
|
|
2293
|
+
if (firstFocusable) {
|
|
2294
|
+
event.preventDefault();
|
|
2295
|
+
firstFocusable.focus();
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
break;
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
props.onKeyDown?.(event);
|
|
2305
|
+
}, [
|
|
2306
|
+
findFirstFocusable
|
|
2307
|
+
]);
|
|
2181
2308
|
return /* @__PURE__ */ React24.createElement(Root7, {
|
|
2182
2309
|
role: "treegrid",
|
|
2183
|
-
|
|
2310
|
+
onKeyDown: handleKeyDown,
|
|
2184
2311
|
...props,
|
|
2185
2312
|
className: tx("treegrid.root", "treegrid", {}, classNames),
|
|
2186
2313
|
style: {
|
|
@@ -2205,15 +2332,6 @@ var TreegridRow = /* @__PURE__ */ forwardRef16(({ __treegridRowScope, asChild, c
|
|
|
2205
2332
|
onChange: propsOnOpenChange,
|
|
2206
2333
|
defaultProp: defaultOpen
|
|
2207
2334
|
});
|
|
2208
|
-
const focusableGroupAttrs = useFocusableGroup({
|
|
2209
|
-
tabBehavior: "limited"
|
|
2210
|
-
});
|
|
2211
|
-
const arrowGroupAttrs = useArrowNavigationGroup({
|
|
2212
|
-
axis: "horizontal",
|
|
2213
|
-
tabbable: false,
|
|
2214
|
-
circular: false,
|
|
2215
|
-
memorizeCurrent: false
|
|
2216
|
-
});
|
|
2217
2335
|
return /* @__PURE__ */ React24.createElement(TreegridRowProvider, {
|
|
2218
2336
|
open,
|
|
2219
2337
|
onOpenChange,
|
|
@@ -2228,16 +2346,10 @@ var TreegridRow = /* @__PURE__ */ forwardRef16(({ __treegridRowScope, asChild, c
|
|
|
2228
2346
|
"aria-expanded": open,
|
|
2229
2347
|
"aria-owns": parentOf
|
|
2230
2348
|
},
|
|
2231
|
-
tabIndex: 0,
|
|
2232
|
-
...focusableGroupAttrs,
|
|
2233
2349
|
...props,
|
|
2234
2350
|
id,
|
|
2235
2351
|
ref: forwardedRef
|
|
2236
|
-
},
|
|
2237
|
-
role: "none",
|
|
2238
|
-
className: "contents",
|
|
2239
|
-
...arrowGroupAttrs
|
|
2240
|
-
}, children)));
|
|
2352
|
+
}, children));
|
|
2241
2353
|
} finally {
|
|
2242
2354
|
_effect.f();
|
|
2243
2355
|
}
|
|
@@ -2270,17 +2382,18 @@ var Treegrid = {
|
|
|
2270
2382
|
|
|
2271
2383
|
// src/components/Main/Main.tsx
|
|
2272
2384
|
import { useSignals as _useSignals25 } from "@preact-signals/safe-react/tracking";
|
|
2385
|
+
import { useFocusableGroup } from "@fluentui/react-tabster";
|
|
2273
2386
|
import { createContext as createContext10 } from "@radix-ui/react-context";
|
|
2274
2387
|
import { DialogContent as DialogContent2, Root as DialogRoot2, DialogTitle as DialogTitle2 } from "@radix-ui/react-dialog";
|
|
2275
2388
|
import { Primitive as Primitive8 } from "@radix-ui/react-primitive";
|
|
2276
2389
|
import { Slot as Slot8 } from "@radix-ui/react-slot";
|
|
2277
2390
|
import { useControllableState as useControllableState4 } from "@radix-ui/react-use-controllable-state";
|
|
2278
|
-
import React25, { forwardRef as forwardRef17, useCallback as
|
|
2391
|
+
import React25, { forwardRef as forwardRef17, useCallback as useCallback9, useEffect as useEffect6, useRef as useRef2, useState as useState8 } from "react";
|
|
2279
2392
|
import { log } from "@dxos/log";
|
|
2280
2393
|
import { useForwardedRef, useMediaQuery } from "@dxos/react-hooks";
|
|
2281
2394
|
|
|
2282
2395
|
// src/components/Main/useSwipeToDismiss.ts
|
|
2283
|
-
import { useCallback as
|
|
2396
|
+
import { useCallback as useCallback8, useEffect as useEffect5, useState as useState7 } from "react";
|
|
2284
2397
|
var useSwipeToDismiss = (ref, {
|
|
2285
2398
|
onDismiss,
|
|
2286
2399
|
dismissThreshold = 64,
|
|
@@ -2289,22 +2402,22 @@ var useSwipeToDismiss = (ref, {
|
|
|
2289
2402
|
/* side = 'inline-start' */
|
|
2290
2403
|
}) => {
|
|
2291
2404
|
const $root = ref.current;
|
|
2292
|
-
const [motionState, setMotionState] =
|
|
2293
|
-
const [gestureStartX, setGestureStartX] =
|
|
2294
|
-
const setIdle =
|
|
2405
|
+
const [motionState, setMotionState] = useState7(0);
|
|
2406
|
+
const [gestureStartX, setGestureStartX] = useState7(0);
|
|
2407
|
+
const setIdle = useCallback8(() => {
|
|
2295
2408
|
setMotionState(0);
|
|
2296
2409
|
$root?.style.removeProperty("inset-inline-start");
|
|
2297
2410
|
$root?.style.setProperty("transition-duration", "200ms");
|
|
2298
2411
|
}, [
|
|
2299
2412
|
$root
|
|
2300
2413
|
]);
|
|
2301
|
-
const setFollowing =
|
|
2414
|
+
const setFollowing = useCallback8(() => {
|
|
2302
2415
|
setMotionState(2);
|
|
2303
2416
|
$root?.style.setProperty("transition-duration", "0ms");
|
|
2304
2417
|
}, [
|
|
2305
2418
|
$root
|
|
2306
2419
|
]);
|
|
2307
|
-
const handlePointerDown =
|
|
2420
|
+
const handlePointerDown = useCallback8(({ screenX }) => {
|
|
2308
2421
|
if (motionState === 0) {
|
|
2309
2422
|
setMotionState(1);
|
|
2310
2423
|
setGestureStartX(screenX);
|
|
@@ -2312,7 +2425,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2312
2425
|
}, [
|
|
2313
2426
|
motionState
|
|
2314
2427
|
]);
|
|
2315
|
-
const handlePointerMove =
|
|
2428
|
+
const handlePointerMove = useCallback8(({ screenX }) => {
|
|
2316
2429
|
if ($root) {
|
|
2317
2430
|
const delta = Math.min(screenX - gestureStartX, 0);
|
|
2318
2431
|
switch (motionState) {
|
|
@@ -2336,12 +2449,12 @@ var useSwipeToDismiss = (ref, {
|
|
|
2336
2449
|
motionState,
|
|
2337
2450
|
gestureStartX
|
|
2338
2451
|
]);
|
|
2339
|
-
const handlePointerUp =
|
|
2452
|
+
const handlePointerUp = useCallback8(() => {
|
|
2340
2453
|
setIdle();
|
|
2341
2454
|
}, [
|
|
2342
2455
|
setIdle
|
|
2343
2456
|
]);
|
|
2344
|
-
|
|
2457
|
+
useEffect5(() => {
|
|
2345
2458
|
$root?.addEventListener("pointerdown", handlePointerDown);
|
|
2346
2459
|
return () => {
|
|
2347
2460
|
$root?.removeEventListener("pointerdown", handlePointerDown);
|
|
@@ -2350,7 +2463,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2350
2463
|
$root,
|
|
2351
2464
|
handlePointerDown
|
|
2352
2465
|
]);
|
|
2353
|
-
|
|
2466
|
+
useEffect5(() => {
|
|
2354
2467
|
$root && document.documentElement.addEventListener("pointermove", handlePointerMove);
|
|
2355
2468
|
return () => {
|
|
2356
2469
|
document.documentElement.removeEventListener("pointermove", handlePointerMove);
|
|
@@ -2359,7 +2472,7 @@ var useSwipeToDismiss = (ref, {
|
|
|
2359
2472
|
$root,
|
|
2360
2473
|
handlePointerMove
|
|
2361
2474
|
]);
|
|
2362
|
-
|
|
2475
|
+
useEffect5(() => {
|
|
2363
2476
|
$root && document.documentElement.addEventListener("pointerup", handlePointerUp);
|
|
2364
2477
|
return () => {
|
|
2365
2478
|
document.documentElement.removeEventListener("pointerup", handlePointerUp);
|
|
@@ -2379,7 +2492,7 @@ var MAIN_NAME = "Main";
|
|
|
2379
2492
|
var GENERIC_CONSUMER_NAME = "GenericConsumer";
|
|
2380
2493
|
var landmarkAttr = "data-main-landmark";
|
|
2381
2494
|
var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
2382
|
-
const handleKeyDown =
|
|
2495
|
+
const handleKeyDown = useCallback9((event) => {
|
|
2383
2496
|
const target = event.target;
|
|
2384
2497
|
if (event.target === event.currentTarget && event.key === "Tab" && target.hasAttribute(landmarkAttr)) {
|
|
2385
2498
|
event.preventDefault();
|
|
@@ -2393,12 +2506,12 @@ var useLandmarkMover = (propsOnKeyDown, landmark) => {
|
|
|
2393
2506
|
}, [
|
|
2394
2507
|
propsOnKeyDown
|
|
2395
2508
|
]);
|
|
2396
|
-
const focusableGroupAttrs =
|
|
2509
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
2397
2510
|
tabBehavior: "limited",
|
|
2398
2511
|
ignoreDefaultKeydown: {
|
|
2399
2512
|
Tab: true
|
|
2400
2513
|
}
|
|
2401
|
-
};
|
|
2514
|
+
});
|
|
2402
2515
|
return {
|
|
2403
2516
|
onKeyDown: handleKeyDown,
|
|
2404
2517
|
[landmarkAttr]: landmark,
|
|
@@ -2412,7 +2525,7 @@ var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
|
2412
2525
|
setNavigationSidebarState: (_nextState) => {
|
|
2413
2526
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2414
2527
|
F: __dxlog_file,
|
|
2415
|
-
L:
|
|
2528
|
+
L: 92,
|
|
2416
2529
|
S: void 0,
|
|
2417
2530
|
C: (f, a) => f(...a)
|
|
2418
2531
|
});
|
|
@@ -2421,7 +2534,7 @@ var [MainProvider, useMainContext] = createContext10(MAIN_NAME, {
|
|
|
2421
2534
|
setComplementarySidebarState: (_nextState) => {
|
|
2422
2535
|
log.warn("Attempt to set sidebar state without initializing `MainRoot`", void 0, {
|
|
2423
2536
|
F: __dxlog_file,
|
|
2424
|
-
L:
|
|
2537
|
+
L: 97,
|
|
2425
2538
|
S: void 0,
|
|
2426
2539
|
C: (f, a) => f(...a)
|
|
2427
2540
|
});
|
|
@@ -2432,31 +2545,29 @@ var useSidebars = (consumerName = GENERIC_CONSUMER_NAME) => {
|
|
|
2432
2545
|
return {
|
|
2433
2546
|
navigationSidebarState,
|
|
2434
2547
|
setNavigationSidebarState,
|
|
2435
|
-
toggleNavigationSidebar:
|
|
2548
|
+
toggleNavigationSidebar: useCallback9(() => setNavigationSidebarState(navigationSidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2436
2549
|
navigationSidebarState,
|
|
2437
2550
|
setNavigationSidebarState
|
|
2438
2551
|
]),
|
|
2439
|
-
openNavigationSidebar:
|
|
2440
|
-
collapseNavigationSidebar:
|
|
2441
|
-
closeNavigationSidebar:
|
|
2552
|
+
openNavigationSidebar: useCallback9(() => setNavigationSidebarState("expanded"), []),
|
|
2553
|
+
collapseNavigationSidebar: useCallback9(() => setNavigationSidebarState("collapsed"), []),
|
|
2554
|
+
closeNavigationSidebar: useCallback9(() => setNavigationSidebarState("closed"), []),
|
|
2442
2555
|
complementarySidebarState,
|
|
2443
2556
|
setComplementarySidebarState,
|
|
2444
|
-
toggleComplementarySidebar:
|
|
2557
|
+
toggleComplementarySidebar: useCallback9(() => setComplementarySidebarState(complementarySidebarState === "expanded" ? "closed" : "expanded"), [
|
|
2445
2558
|
complementarySidebarState,
|
|
2446
2559
|
setComplementarySidebarState
|
|
2447
2560
|
]),
|
|
2448
|
-
openComplementarySidebar:
|
|
2449
|
-
collapseComplementarySidebar:
|
|
2450
|
-
closeComplementarySidebar:
|
|
2561
|
+
openComplementarySidebar: useCallback9(() => setComplementarySidebarState("expanded"), []),
|
|
2562
|
+
collapseComplementarySidebar: useCallback9(() => setComplementarySidebarState("collapsed"), []),
|
|
2563
|
+
closeComplementarySidebar: useCallback9(() => setComplementarySidebarState("closed"), [])
|
|
2451
2564
|
};
|
|
2452
2565
|
};
|
|
2453
2566
|
var resizeDebounce = 3e3;
|
|
2454
2567
|
var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNavigationSidebarState, onNavigationSidebarStateChange, complementarySidebarState: propsComplementarySidebarState, defaultComplementarySidebarState, onComplementarySidebarStateChange, children, ...props }) => {
|
|
2455
2568
|
var _effect = _useSignals25();
|
|
2456
2569
|
try {
|
|
2457
|
-
const [isLg] = useMediaQuery("lg"
|
|
2458
|
-
ssr: false
|
|
2459
|
-
});
|
|
2570
|
+
const [isLg] = useMediaQuery("lg");
|
|
2460
2571
|
const [navigationSidebarState = isLg ? "expanded" : "collapsed", setNavigationSidebarState] = useControllableState4({
|
|
2461
2572
|
prop: propsNavigationSidebarState,
|
|
2462
2573
|
defaultProp: defaultNavigationSidebarState,
|
|
@@ -2467,9 +2578,9 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2467
2578
|
defaultProp: defaultComplementarySidebarState,
|
|
2468
2579
|
onChange: onComplementarySidebarStateChange
|
|
2469
2580
|
});
|
|
2470
|
-
const [resizing, setResizing] =
|
|
2581
|
+
const [resizing, setResizing] = useState8(false);
|
|
2471
2582
|
const resizeInterval = useRef2(null);
|
|
2472
|
-
const handleResize =
|
|
2583
|
+
const handleResize = useCallback9(() => {
|
|
2473
2584
|
setResizing(true);
|
|
2474
2585
|
if (resizeInterval.current) {
|
|
2475
2586
|
clearTimeout(resizeInterval.current);
|
|
@@ -2479,7 +2590,7 @@ var MainRoot = ({ navigationSidebarState: propsNavigationSidebarState, defaultNa
|
|
|
2479
2590
|
resizeInterval.current = null;
|
|
2480
2591
|
}, resizeDebounce);
|
|
2481
2592
|
}, []);
|
|
2482
|
-
|
|
2593
|
+
useEffect6(() => {
|
|
2483
2594
|
window.addEventListener("resize", handleResize);
|
|
2484
2595
|
return () => window.removeEventListener("resize", handleResize);
|
|
2485
2596
|
}, [
|
|
@@ -2504,9 +2615,7 @@ var handleOpenAutoFocus = (event) => {
|
|
|
2504
2615
|
var MainSidebar = /* @__PURE__ */ forwardRef17(({ classNames, children, swipeToDismiss, onOpenAutoFocus, state, resizing, onStateChange, side, label, ...props }, forwardedRef) => {
|
|
2505
2616
|
var _effect = _useSignals25();
|
|
2506
2617
|
try {
|
|
2507
|
-
const [isLg] = useMediaQuery("lg"
|
|
2508
|
-
ssr: false
|
|
2509
|
-
});
|
|
2618
|
+
const [isLg] = useMediaQuery("lg");
|
|
2510
2619
|
const { tx } = useThemeContext();
|
|
2511
2620
|
const { t } = useTranslation();
|
|
2512
2621
|
const ref = useForwardedRef(forwardedRef);
|
|
@@ -2514,9 +2623,12 @@ var MainSidebar = /* @__PURE__ */ forwardRef17(({ classNames, children, swipeToD
|
|
|
2514
2623
|
useSwipeToDismiss(swipeToDismiss ? ref : noopRef, {
|
|
2515
2624
|
onDismiss: () => onStateChange?.("closed")
|
|
2516
2625
|
});
|
|
2517
|
-
const handleKeyDown =
|
|
2518
|
-
|
|
2519
|
-
|
|
2626
|
+
const handleKeyDown = useCallback9((event) => {
|
|
2627
|
+
const focusGroupParent = event.target.closest("[data-tabster]");
|
|
2628
|
+
if (event.key === "Escape" && focusGroupParent) {
|
|
2629
|
+
event.preventDefault();
|
|
2630
|
+
event.stopPropagation();
|
|
2631
|
+
focusGroupParent.focus();
|
|
2520
2632
|
}
|
|
2521
2633
|
props.onKeyDown?.(event);
|
|
2522
2634
|
}, [
|
|
@@ -2540,9 +2652,9 @@ var MainSidebar = /* @__PURE__ */ forwardRef17(({ classNames, children, swipeToD
|
|
|
2540
2652
|
"data-state": state,
|
|
2541
2653
|
"data-resizing": resizing ? "true" : "false",
|
|
2542
2654
|
className: tx("main.sidebar", "main__sidebar", {}, classNames),
|
|
2543
|
-
|
|
2655
|
+
onKeyDownCapture: handleKeyDown,
|
|
2544
2656
|
...state === "closed" && {
|
|
2545
|
-
inert:
|
|
2657
|
+
inert: true
|
|
2546
2658
|
},
|
|
2547
2659
|
ref
|
|
2548
2660
|
}, children));
|
|
@@ -2618,9 +2730,7 @@ MainContent.displayName = MAIN_NAME;
|
|
|
2618
2730
|
var MainOverlay = /* @__PURE__ */ forwardRef17(({ classNames, ...props }, forwardedRef) => {
|
|
2619
2731
|
var _effect = _useSignals25();
|
|
2620
2732
|
try {
|
|
2621
|
-
const [isLg] = useMediaQuery("lg"
|
|
2622
|
-
ssr: false
|
|
2623
|
-
});
|
|
2733
|
+
const [isLg] = useMediaQuery("lg");
|
|
2624
2734
|
const { navigationSidebarState, setNavigationSidebarState, complementarySidebarState, setComplementarySidebarState } = useMainContext(MAIN_NAME);
|
|
2625
2735
|
const { tx } = useThemeContext();
|
|
2626
2736
|
return /* @__PURE__ */ React25.createElement("div", {
|
|
@@ -2658,7 +2768,7 @@ import { Slot as Slot9 } from "@radix-ui/react-slot";
|
|
|
2658
2768
|
import React26, { forwardRef as forwardRef18 } from "react";
|
|
2659
2769
|
|
|
2660
2770
|
// src/hooks/useSafeCollisionPadding.ts
|
|
2661
|
-
import { useMemo as
|
|
2771
|
+
import { useMemo as useMemo4 } from "react";
|
|
2662
2772
|
var propIsNumber = (prop) => Number.isFinite(prop);
|
|
2663
2773
|
var propsIsRecord = (prop) => !!(prop && typeof prop === "object");
|
|
2664
2774
|
var safePadding = (propsPadding, safePadding2, side) => {
|
|
@@ -2666,7 +2776,7 @@ var safePadding = (propsPadding, safePadding2, side) => {
|
|
|
2666
2776
|
};
|
|
2667
2777
|
var useSafeCollisionPadding = (collisionPadding) => {
|
|
2668
2778
|
const { safeAreaPadding } = useThemeContext();
|
|
2669
|
-
return
|
|
2779
|
+
return useMemo4(() => ({
|
|
2670
2780
|
top: safePadding(collisionPadding, safeAreaPadding, "top"),
|
|
2671
2781
|
right: safePadding(collisionPadding, safeAreaPadding, "right"),
|
|
2672
2782
|
bottom: safePadding(collisionPadding, safeAreaPadding, "bottom"),
|
|
@@ -2807,7 +2917,7 @@ import { createMenuScope } from "@radix-ui/react-menu";
|
|
|
2807
2917
|
import { Primitive as Primitive10 } from "@radix-ui/react-primitive";
|
|
2808
2918
|
import { Slot as Slot10 } from "@radix-ui/react-slot";
|
|
2809
2919
|
import { useControllableState as useControllableState5 } from "@radix-ui/react-use-controllable-state";
|
|
2810
|
-
import React27, { forwardRef as forwardRef19, useCallback as
|
|
2920
|
+
import React27, { forwardRef as forwardRef19, useCallback as useCallback10, useEffect as useEffect7, useRef as useRef3 } from "react";
|
|
2811
2921
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
2812
2922
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope3(DROPDOWN_MENU_NAME, [
|
|
2813
2923
|
createMenuScope
|
|
@@ -2832,7 +2942,7 @@ var DropdownMenuRoot = (props) => {
|
|
|
2832
2942
|
contentId: useId3(),
|
|
2833
2943
|
open,
|
|
2834
2944
|
onOpenChange: setOpen,
|
|
2835
|
-
onOpenToggle:
|
|
2945
|
+
onOpenToggle: useCallback10(() => setOpen((prevOpen) => !prevOpen), [
|
|
2836
2946
|
setOpen
|
|
2837
2947
|
]),
|
|
2838
2948
|
modal
|
|
@@ -2912,7 +3022,7 @@ var DropdownMenuVirtualTrigger = (props) => {
|
|
|
2912
3022
|
const { __scopeDropdownMenu, virtualRef } = props;
|
|
2913
3023
|
const context = useDropdownMenuContext(VIRTUAL_TRIGGER_NAME, __scopeDropdownMenu);
|
|
2914
3024
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
2915
|
-
|
|
3025
|
+
useEffect7(() => {
|
|
2916
3026
|
if (virtualRef.current) {
|
|
2917
3027
|
context.triggerRef.current = virtualRef.current;
|
|
2918
3028
|
}
|
|
@@ -3359,7 +3469,7 @@ import { Primitive as Primitive12 } from "@radix-ui/react-primitive";
|
|
|
3359
3469
|
import { Slot as Slot12 } from "@radix-ui/react-slot";
|
|
3360
3470
|
import { useControllableState as useControllableState6 } from "@radix-ui/react-use-controllable-state";
|
|
3361
3471
|
import { hideOthers } from "aria-hidden";
|
|
3362
|
-
import React29, { forwardRef as forwardRef21, useCallback as
|
|
3472
|
+
import React29, { forwardRef as forwardRef21, useCallback as useCallback11, useEffect as useEffect8, useRef as useRef4, useState as useState9 } from "react";
|
|
3363
3473
|
import { RemoveScroll } from "react-remove-scroll";
|
|
3364
3474
|
var POPOVER_NAME = "Popover";
|
|
3365
3475
|
var [createPopoverContext, createPopoverScope] = createContextScope4(POPOVER_NAME, [
|
|
@@ -3373,7 +3483,7 @@ var PopoverRoot = (props) => {
|
|
|
3373
3483
|
const { __scopePopover, children, open: openProp, defaultOpen, onOpenChange, modal = false } = props;
|
|
3374
3484
|
const popperScope = usePopperScope2(__scopePopover);
|
|
3375
3485
|
const triggerRef = useRef4(null);
|
|
3376
|
-
const [hasCustomAnchor, setHasCustomAnchor] =
|
|
3486
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState9(false);
|
|
3377
3487
|
const [open = false, setOpen] = useControllableState6({
|
|
3378
3488
|
prop: openProp,
|
|
3379
3489
|
defaultProp: defaultOpen,
|
|
@@ -3385,12 +3495,12 @@ var PopoverRoot = (props) => {
|
|
|
3385
3495
|
triggerRef,
|
|
3386
3496
|
open,
|
|
3387
3497
|
onOpenChange: setOpen,
|
|
3388
|
-
onOpenToggle:
|
|
3498
|
+
onOpenToggle: useCallback11(() => setOpen((prevOpen) => !prevOpen), [
|
|
3389
3499
|
setOpen
|
|
3390
3500
|
]),
|
|
3391
3501
|
hasCustomAnchor,
|
|
3392
|
-
onCustomAnchorAdd:
|
|
3393
|
-
onCustomAnchorRemove:
|
|
3502
|
+
onCustomAnchorAdd: useCallback11(() => setHasCustomAnchor(true), []),
|
|
3503
|
+
onCustomAnchorRemove: useCallback11(() => setHasCustomAnchor(false), []),
|
|
3394
3504
|
modal
|
|
3395
3505
|
}, children));
|
|
3396
3506
|
} finally {
|
|
@@ -3406,7 +3516,7 @@ var PopoverAnchor = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
3406
3516
|
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
|
|
3407
3517
|
const popperScope = usePopperScope2(__scopePopover);
|
|
3408
3518
|
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
|
|
3409
|
-
|
|
3519
|
+
useEffect8(() => {
|
|
3410
3520
|
onCustomAnchorAdd();
|
|
3411
3521
|
return () => onCustomAnchorRemove();
|
|
3412
3522
|
}, [
|
|
@@ -3457,7 +3567,7 @@ var PopoverVirtualTrigger = (props) => {
|
|
|
3457
3567
|
const { __scopePopover, virtualRef } = props;
|
|
3458
3568
|
const context = usePopoverContext(VIRTUAL_TRIGGER_NAME2, __scopePopover);
|
|
3459
3569
|
const popperScope = usePopperScope2(__scopePopover);
|
|
3460
|
-
|
|
3570
|
+
useEffect8(() => {
|
|
3461
3571
|
if (virtualRef.current) {
|
|
3462
3572
|
context.triggerRef.current = virtualRef.current;
|
|
3463
3573
|
}
|
|
@@ -3522,7 +3632,7 @@ var PopoverContentModal = /* @__PURE__ */ forwardRef21((props, forwardedRef) =>
|
|
|
3522
3632
|
const contentRef = useRef4(null);
|
|
3523
3633
|
const composedRefs = useComposedRefs2(forwardedRef, contentRef);
|
|
3524
3634
|
const isRightClickOutsideRef = useRef4(false);
|
|
3525
|
-
|
|
3635
|
+
useEffect8(() => {
|
|
3526
3636
|
const content = contentRef.current;
|
|
3527
3637
|
if (content) {
|
|
3528
3638
|
return hideOthers(content);
|
|
@@ -3643,7 +3753,7 @@ var PopoverContentImpl = /* @__PURE__ */ forwardRef21((props, forwardedRef) => {
|
|
|
3643
3753
|
ref: forwardedRef,
|
|
3644
3754
|
style: {
|
|
3645
3755
|
...contentProps.style,
|
|
3646
|
-
//
|
|
3756
|
+
// Re-namespace exposed content custom properties.
|
|
3647
3757
|
...{
|
|
3648
3758
|
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
3649
3759
|
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
|
|
@@ -4171,11 +4281,18 @@ var Toast = {
|
|
|
4171
4281
|
// src/components/Toolbar/Toolbar.tsx
|
|
4172
4282
|
import { useSignals as _useSignals36 } from "@preact-signals/safe-react/tracking";
|
|
4173
4283
|
import * as ToolbarPrimitive from "@radix-ui/react-toolbar";
|
|
4174
|
-
import React36, { forwardRef as forwardRef28 } from "react";
|
|
4175
|
-
var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, layoutManaged, ...props }, forwardedRef) => {
|
|
4284
|
+
import React36, { Fragment, forwardRef as forwardRef28 } from "react";
|
|
4285
|
+
var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, layoutManaged, textBlockWidth: wrapContents, ...props }, forwardedRef) => {
|
|
4176
4286
|
var _effect = _useSignals36();
|
|
4177
4287
|
try {
|
|
4178
4288
|
const { tx } = useThemeContext();
|
|
4289
|
+
const InnerRoot = wrapContents ? "div" : Fragment;
|
|
4290
|
+
const innerRootProps = wrapContents ? {
|
|
4291
|
+
role: "none",
|
|
4292
|
+
className: tx("toolbar.inner", "toolbar", {
|
|
4293
|
+
layoutManaged
|
|
4294
|
+
}, classNames)
|
|
4295
|
+
} : {};
|
|
4179
4296
|
return /* @__PURE__ */ React36.createElement(ToolbarPrimitive.Root, {
|
|
4180
4297
|
...props,
|
|
4181
4298
|
"data-arrow-keys": props.orientation === "vertical" ? "up down" : "left right",
|
|
@@ -4183,7 +4300,7 @@ var ToolbarRoot = /* @__PURE__ */ forwardRef28(({ classNames, children, layoutMa
|
|
|
4183
4300
|
layoutManaged
|
|
4184
4301
|
}, classNames),
|
|
4185
4302
|
ref: forwardedRef
|
|
4186
|
-
}, children);
|
|
4303
|
+
}, /* @__PURE__ */ React36.createElement(InnerRoot, innerRootProps, children));
|
|
4187
4304
|
} finally {
|
|
4188
4305
|
_effect.f();
|
|
4189
4306
|
}
|
|
@@ -4359,7 +4476,9 @@ export {
|
|
|
4359
4476
|
ToggleGroupItem,
|
|
4360
4477
|
ToggleGroupIconItem,
|
|
4361
4478
|
useClipboard,
|
|
4479
|
+
Domino,
|
|
4362
4480
|
hasIosKeyboard,
|
|
4481
|
+
usePx,
|
|
4363
4482
|
DensityContext,
|
|
4364
4483
|
DensityProvider,
|
|
4365
4484
|
ElevationContext,
|
|
@@ -4401,4 +4520,4 @@ export {
|
|
|
4401
4520
|
Toast,
|
|
4402
4521
|
Toolbar
|
|
4403
4522
|
};
|
|
4404
|
-
//# sourceMappingURL=chunk-
|
|
4523
|
+
//# sourceMappingURL=chunk-MPRFBTTQ.mjs.map
|