@dxos/react-ui-table 0.7.0 → 0.7.1-staging.8709ba7

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.
@@ -76,7 +76,7 @@ var ColumnActionsMenu = ({ model }) => {
76
76
  import React2, { useCallback, useEffect, useMemo, useState } from "react";
77
77
  import { getSpace } from "@dxos/react-client/echo";
78
78
  import { DropdownMenu as DropdownMenu2 } from "@dxos/react-ui";
79
- import { FieldEditor } from "@dxos/react-ui-data";
79
+ import { FieldEditor } from "@dxos/react-ui-form";
80
80
  var ColumnSettings = ({ model }) => {
81
81
  const [newField, setNewField] = useState();
82
82
  const state = model?.modalController.state.value;
@@ -468,13 +468,13 @@ var frozen = {
468
468
  frozenColsStart: 1,
469
469
  frozenColsEnd: 1
470
470
  };
471
- var TableRoot = ({ children }) => {
471
+ var TableRoot = ({ children, role }) => {
472
472
  return /* @__PURE__ */ React5.createElement("div", {
473
473
  role: "none",
474
- className: "relative flex flex-col"
474
+ className: mx("relative border-bs !border-separator", role === "section" ? "attention-surface overflow-hidden [&_.dx-grid]:max-is-max" : "flex flex-col [&_.dx-grid]:grow [&_.dx-grid]:max-is-max [&_.dx-grid]:bs-0 [&_.dx-grid]:max-bs-max")
475
475
  }, children);
476
476
  };
477
- var TableMain = /* @__PURE__ */ forwardRef(({ model }, forwardedRef) => {
477
+ var TableMain = /* @__PURE__ */ forwardRef(({ model, ignoreAttention }, forwardedRef) => {
478
478
  const [dxGrid, setDxGrid] = useState2(null);
479
479
  const { hasAttention } = useAttention(model?.table ? fullyQualifiedId(model.table) : "table");
480
480
  useImperativeHandle(forwardedRef, () => {
@@ -529,18 +529,19 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model }, forwardedRef) => {
529
529
  model
530
530
  ]);
531
531
  const handleWheel = useCallback3((event) => {
532
- if (!hasAttention) {
532
+ if (!ignoreAttention && !hasAttention) {
533
533
  event.stopPropagation();
534
534
  }
535
535
  }, [
536
- hasAttention
536
+ hasAttention,
537
+ ignoreAttention
537
538
  ]);
538
539
  const handleQuery = useCallback3(async ({ field, props }, _text) => {
539
540
  if (model && props.referenceSchema && field.referencePath) {
540
541
  const space = getSpace2(model.table);
541
542
  invariant2(space, void 0, {
542
543
  F: __dxlog_file3,
543
- L: 149,
544
+ L: 158,
544
545
  S: void 0,
545
546
  A: [
546
547
  "space",
@@ -581,7 +582,7 @@ var TableMain = /* @__PURE__ */ forwardRef(({ model }, forwardedRef) => {
581
582
  onQuery: handleQuery
582
583
  }), /* @__PURE__ */ React5.createElement(Grid.Content, {
583
584
  onWheelCapture: handleWheel,
584
- className: mx("[--dx-grid-base:var(--surface-bg)] [&_.dx-grid]:grow [&_.dx-grid]:max-is-max [&_.dx-grid]:bs-0 [&_.dx-grid]:max-bs-max", inlineEndLine, blockEndLine),
585
+ className: mx("[--dx-grid-base:var(--surface-bg)]", inlineEndLine, blockEndLine),
585
586
  frozen,
586
587
  columns: model.columnMeta.value,
587
588
  limitRows: model.getRowCount() ?? 0,
@@ -605,16 +606,13 @@ var Table = {
605
606
  };
606
607
 
607
608
  // packages/ui/react-ui-table/src/components/Toolbar/Toolbar.tsx
608
- import { ChatText, RowsPlusBottom } from "@phosphor-icons/react";
609
609
  import { createContext } from "@radix-ui/react-context";
610
610
  import React7 from "react";
611
611
  import { Toolbar as NaturalToolbar2, useTranslation as useTranslation3 } from "@dxos/react-ui";
612
612
 
613
613
  // packages/ui/react-ui-table/src/components/Toolbar/common.tsx
614
614
  import React6 from "react";
615
- import { Toolbar as NaturalToolbar, Tooltip } from "@dxos/react-ui";
616
- import { getSize } from "@dxos/react-ui-theme";
617
- var iconStyles = getSize(5);
615
+ import { Icon, Toolbar as NaturalToolbar, Tooltip } from "@dxos/react-ui";
618
616
  var buttonStyles = "min-bs-0 p-2";
619
617
  var tooltipProps = {
620
618
  side: "top",
@@ -624,7 +622,7 @@ var ToolbarSeparator = () => /* @__PURE__ */ React6.createElement("div", {
624
622
  role: "separator",
625
623
  className: "grow"
626
624
  });
627
- var ToolbarButton = ({ Icon, children, ...props }) => {
625
+ var ToolbarButton = ({ icon, children, ...props }) => {
628
626
  return /* @__PURE__ */ React6.createElement(Tooltip.Root, null, /* @__PURE__ */ React6.createElement(Tooltip.Trigger, {
629
627
  asChild: true
630
628
  }, /* @__PURE__ */ React6.createElement(NaturalToolbar.Button, {
@@ -632,7 +630,8 @@ var ToolbarButton = ({ Icon, children, ...props }) => {
632
630
  ...props,
633
631
  classNames: buttonStyles
634
632
  }, /* @__PURE__ */ React6.createElement(Icon, {
635
- className: iconStyles
633
+ icon,
634
+ size: 5
636
635
  }), /* @__PURE__ */ React6.createElement("span", {
637
636
  className: "sr-only"
638
637
  }, children))), /* @__PURE__ */ React6.createElement(Tooltip.Portal, null, /* @__PURE__ */ React6.createElement(Tooltip.Content, tooltipProps, children, /* @__PURE__ */ React6.createElement(Tooltip.Arrow, null))));
@@ -645,7 +644,7 @@ var ToolbarRoot = ({ classNames, children, onAction }) => {
645
644
  onAction
646
645
  }, /* @__PURE__ */ React7.createElement(NaturalToolbar2.Root, {
647
646
  classNames: [
648
- "is-full shrink-0 overflow-x-auto overflow-y-hidden p-1",
647
+ "is-full shrink-0 overflow-x-auto overflow-y-hidden p-1 attention-surface",
649
648
  classNames
650
649
  ]
651
650
  }, children));
@@ -655,7 +654,7 @@ var Editing = () => {
655
654
  const { t } = useTranslation3(translationKey);
656
655
  return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(ToolbarButton, {
657
656
  value: "add-row",
658
- Icon: RowsPlusBottom,
657
+ icon: "ph--plus--regular",
659
658
  "data-testid": "table.toolbar.add-row",
660
659
  onClick: () => onAction?.({
661
660
  type: "add-row"
@@ -667,7 +666,7 @@ var Actions = () => {
667
666
  const { t } = useTranslation3(translationKey);
668
667
  return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(ToolbarButton, {
669
668
  value: "comment",
670
- Icon: ChatText,
669
+ icon: "ph--chat-text--regular",
671
670
  "data-testid": "table.toolbar.comment",
672
671
  onClick: () => onAction?.({
673
672
  type: "comment"
@@ -691,7 +690,7 @@ import { Resource as Resource2 } from "@dxos/context";
691
690
  import { getValue as getValue2, setValue, FormatEnum as FormatEnum3 } from "@dxos/echo-schema";
692
691
  import { invariant as invariant3 } from "@dxos/invariant";
693
692
  import { PublicKey as PublicKey2 } from "@dxos/react-client";
694
- import { cellClassesForFieldType, cellClassesForRowSelection, formatForDisplay, formatForEditing, parseValue } from "@dxos/react-ui-data";
693
+ import { cellClassesForFieldType, cellClassesForRowSelection, formatForDisplay, formatForEditing, parseValue } from "@dxos/react-ui-form";
695
694
  import { mx as mx2 } from "@dxos/react-ui-theme";
696
695
  import { VIEW_FIELD_LIMIT } from "@dxos/schema";
697
696
 
@@ -792,7 +791,7 @@ var SelectionModel = class extends Resource {
792
791
  if (rows.length === 0) {
793
792
  return false;
794
793
  }
795
- return rows.length !== 0 || rows.every((row) => this._selection.value.has(row.id));
794
+ return rows.every((row) => this._selection.value.has(row.id));
796
795
  });
797
796
  this.getSelectedRows = () => {
798
797
  const selectedIds = this._validSelectedIds.value;
@@ -846,7 +845,7 @@ var checkboxAttributes = {
846
845
  header: "data-table-header"
847
846
  };
848
847
  var renderCheckbox = ({ rowIndex, header = false, checked = false, disabled = false }) => {
849
- const baseClasses = "absolute inset-block-[6px] inline-end-[6px]";
848
+ const baseClasses = "absolute inset-block-[6px] inline-end-[6px] ch-checkbox";
850
849
  const { attributes } = tableControls.checkbox;
851
850
  return `<input type="checkbox" class="${baseClasses}" ${attributes.checkbox}="${rowIndex}" ${header ? attributes.header : ""} ${checked ? "checked" : ""} ${disabled ? "disabled" : ""}/>`;
852
851
  };