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