@dxos/react-ui-list 0.8.4-main.d05539e30a → 0.8.4-main.d9fc60f731
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/index.mjs +33 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +33 -12
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/src/components/List/testing.d.ts +2 -2
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeContext.d.ts +4 -0
- package/dist/types/src/components/Tree/TreeContext.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItem.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItemHeading.d.ts +4 -0
- package/dist/types/src/components/Tree/TreeItemHeading.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -18
- package/src/components/Combobox/Combobox.tsx +2 -1
- package/src/components/RowList/RowList.tsx +1 -1
- package/src/components/Tree/Tree.stories.tsx +4 -1
- package/src/components/Tree/Tree.tsx +1 -1
- package/src/components/Tree/TreeContext.tsx +4 -0
- package/src/components/Tree/TreeItem.tsx +4 -0
- package/src/components/Tree/TreeItemHeading.tsx +34 -7
- package/src/components/Tree/TreeItemToggle.tsx +1 -1
|
@@ -72,7 +72,8 @@ import { createContext as createContext4 } from "@radix-ui/react-context";
|
|
|
72
72
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
73
73
|
import React4, { forwardRef as forwardRef2, useCallback as useCallback2 } from "react";
|
|
74
74
|
import { Button, Icon as Icon2, Popover, ScrollArea, useId } from "@dxos/react-ui";
|
|
75
|
-
import { composable, composableProps
|
|
75
|
+
import { composable, composableProps } from "@dxos/react-ui";
|
|
76
|
+
import { mx as mx4 } from "@dxos/ui-theme";
|
|
76
77
|
|
|
77
78
|
// src/components/Picker/Picker.tsx
|
|
78
79
|
import { Slot } from "@radix-ui/react-slot";
|
|
@@ -799,7 +800,7 @@ import { useControllableState as useControllableState2 } from "@radix-ui/react-u
|
|
|
799
800
|
import React7, { useCallback as useCallback4 } from "react";
|
|
800
801
|
import { List as List2, ListItem as ListItem2 } from "@dxos/react-list";
|
|
801
802
|
import { ScrollArea as ScrollArea2 } from "@dxos/react-ui";
|
|
802
|
-
import { composable as composable2, composableProps as composableProps2 } from "@dxos/ui
|
|
803
|
+
import { composable as composable2, composableProps as composableProps2 } from "@dxos/react-ui";
|
|
803
804
|
var ROW_LIST_NAME = "RowList";
|
|
804
805
|
var ROW_LIST_ROOT_NAME = "RowList.Root";
|
|
805
806
|
var ROW_LIST_VIEWPORT_NAME = "RowList.Viewport";
|
|
@@ -1036,10 +1037,10 @@ var paddingIndentation = (level, indentation = DEFAULT_INDENTATION) => ({
|
|
|
1036
1037
|
|
|
1037
1038
|
// src/components/Tree/TreeItemHeading.tsx
|
|
1038
1039
|
import React9, { forwardRef as forwardRef4, memo, useCallback as useCallback5 } from "react";
|
|
1039
|
-
import { Button as Button2, Icon as Icon4, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
1040
|
+
import { Button as Button2, Icon as Icon4, Tag, toLocalizedString, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
1040
1041
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
1041
1042
|
import { getStyles } from "@dxos/ui-theme";
|
|
1042
|
-
var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef4(({ label, className, icon, iconHue, disabled, current, onSelect }, forwardedRef) => {
|
|
1043
|
+
var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef4(({ label, className, icon, iconHue, disabled, current, count, modifiedCount, onSelect }, forwardedRef) => {
|
|
1043
1044
|
const { t } = useTranslation2();
|
|
1044
1045
|
const styles = iconHue ? getStyles(iconHue) : void 0;
|
|
1045
1046
|
const handleSelect = useCallback5((event) => {
|
|
@@ -1067,7 +1068,7 @@ var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef4(({ label,
|
|
|
1067
1068
|
"data-testid": "treeItem.heading",
|
|
1068
1069
|
variant: "ghost",
|
|
1069
1070
|
classNames: [
|
|
1070
|
-
"grow gap-2 ps-0.5 hover:bg-transparent dark:hover:bg-transparent",
|
|
1071
|
+
"grow shrink min-w-0 justify-start gap-2 ps-0.5 hover:bg-transparent dark:hover:bg-transparent",
|
|
1071
1072
|
"disabled:cursor-default disabled:opacity-100",
|
|
1072
1073
|
className
|
|
1073
1074
|
],
|
|
@@ -1079,16 +1080,34 @@ var TreeItemHeading = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef4(({ label,
|
|
|
1079
1080
|
}
|
|
1080
1081
|
}, icon && /* @__PURE__ */ React9.createElement(Icon4, {
|
|
1081
1082
|
size: 5,
|
|
1082
|
-
icon: icon ?? "ph--
|
|
1083
|
+
icon: icon ?? "ph--circle-dashed--regular",
|
|
1083
1084
|
classNames: [
|
|
1084
1085
|
"my-1",
|
|
1085
|
-
styles?.
|
|
1086
|
+
styles?.text
|
|
1086
1087
|
]
|
|
1087
1088
|
}), /* @__PURE__ */ React9.createElement("span", {
|
|
1088
|
-
className: "
|
|
1089
|
+
className: "min-w-0 truncate text-start font-normal",
|
|
1089
1090
|
"data-tooltip": true
|
|
1090
|
-
}, toLocalizedString(label, t))
|
|
1091
|
+
}, toLocalizedString(label, t)), /* @__PURE__ */ React9.createElement(CountBadge, {
|
|
1092
|
+
count,
|
|
1093
|
+
modifiedCount
|
|
1094
|
+
})));
|
|
1091
1095
|
}));
|
|
1096
|
+
var CountBadge = ({ count, modifiedCount }) => {
|
|
1097
|
+
if (typeof modifiedCount === "number" && modifiedCount > 0) {
|
|
1098
|
+
return /* @__PURE__ */ React9.createElement(Tag, {
|
|
1099
|
+
palette: "rose",
|
|
1100
|
+
classNames: "shrink-0 text-center [min-inline-size:1.5rem] tabular-nums"
|
|
1101
|
+
}, modifiedCount);
|
|
1102
|
+
}
|
|
1103
|
+
if (typeof count === "number") {
|
|
1104
|
+
return /* @__PURE__ */ React9.createElement(Tag, {
|
|
1105
|
+
palette: "neutral",
|
|
1106
|
+
classNames: "shrink-0 text-center [min-inline-size:1.5rem] tabular-nums"
|
|
1107
|
+
}, count);
|
|
1108
|
+
}
|
|
1109
|
+
return null;
|
|
1110
|
+
};
|
|
1092
1111
|
|
|
1093
1112
|
// src/components/Tree/TreeItemToggle.tsx
|
|
1094
1113
|
import React10, { forwardRef as forwardRef5, memo as memo2 } from "react";
|
|
@@ -1099,7 +1118,7 @@ var TreeItemToggle = /* @__PURE__ */ memo2(/* @__PURE__ */ forwardRef5(({ classN
|
|
|
1099
1118
|
"data-testid": "treeItem.toggle",
|
|
1100
1119
|
"aria-expanded": open,
|
|
1101
1120
|
variant: "ghost",
|
|
1102
|
-
density: "
|
|
1121
|
+
density: "md",
|
|
1103
1122
|
classNames: [
|
|
1104
1123
|
"h-full w-6 px-0",
|
|
1105
1124
|
"[&_svg]:transition-transform [&_svg]:duration-200",
|
|
@@ -1142,7 +1161,7 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
1142
1161
|
pathProp,
|
|
1143
1162
|
item.id
|
|
1144
1163
|
]);
|
|
1145
|
-
const { id, parentOf, draggable: itemDraggable, droppable: itemDroppable, label, className, headingClassName, icon, iconHue, disabled, testId } = useAtomValue(itemPropsAtom(path));
|
|
1164
|
+
const { id, parentOf, draggable: itemDraggable, droppable: itemDroppable, label, className, headingClassName, icon, iconHue, disabled, testId, count, modifiedCount } = useAtomValue(itemPropsAtom(path));
|
|
1146
1165
|
const childIds = useAtomValue(childIdsAtom(item.id));
|
|
1147
1166
|
const open = useAtomValue(itemOpenAtom(path));
|
|
1148
1167
|
const current = useAtomValue(itemCurrentAtom(path));
|
|
@@ -1394,6 +1413,8 @@ var RawTreeItem = ({ item, path: pathProp, levelOffset = 2, last, draggable: dra
|
|
|
1394
1413
|
className: headingClassName,
|
|
1395
1414
|
icon,
|
|
1396
1415
|
iconHue,
|
|
1416
|
+
count,
|
|
1417
|
+
modifiedCount,
|
|
1397
1418
|
onSelect: handleSelect,
|
|
1398
1419
|
ref: buttonRef
|
|
1399
1420
|
})), Columns && /* @__PURE__ */ React11.createElement(Columns, {
|
|
@@ -1428,7 +1449,7 @@ var RawTreeItemById = ({ id, ...props }) => {
|
|
|
1428
1449
|
var TreeItemById = /* @__PURE__ */ memo3(RawTreeItemById);
|
|
1429
1450
|
|
|
1430
1451
|
// src/components/Tree/Tree.tsx
|
|
1431
|
-
var Tree = ({ classNames, model, rootId, path, id, draggable: draggable3 = false, gridTemplateColumns = "[tree-row-start] 1fr min-content [tree-row-end]", levelOffset, renderColumns, blockInstruction, canDrop, canSelect, onOpenChange, onSelect, onItemHover }) => {
|
|
1452
|
+
var Tree = ({ classNames, model, rootId, path, id, draggable: draggable3 = false, gridTemplateColumns = "[tree-row-start] minmax(0, 1fr) min-content [tree-row-end]", levelOffset, renderColumns, blockInstruction, canDrop, canSelect, onOpenChange, onSelect, onItemHover }) => {
|
|
1432
1453
|
const childIds = useAtomValue2(model.childIds(rootId));
|
|
1433
1454
|
const treePath = useMemo3(() => path ? [
|
|
1434
1455
|
...path,
|