@powerhousedao/design-system 6.0.0-dev.244 → 6.0.0-dev.246
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/{button-DIE3LLBZ.d.ts → button-49Walvwn.d.ts} +1 -1
- package/dist/{button-DIE3LLBZ.d.ts.map → button-49Walvwn.d.ts.map} +1 -1
- package/dist/{character-counter-BZ-4xC7Q.d.ts → character-counter-BcuG4STA.d.ts} +1 -1
- package/dist/{character-counter-BZ-4xC7Q.d.ts.map → character-counter-BcuG4STA.d.ts.map} +1 -1
- package/dist/{checkbox-base-Bh08IVG2.d.ts → checkbox-base-8xXJvAbj.d.ts} +1 -1
- package/dist/{checkbox-base-Bh08IVG2.d.ts.map → checkbox-base-8xXJvAbj.d.ts.map} +1 -1
- package/dist/{checkbox-BgS8z46p.d.ts → checkbox-dqrYEK5V.d.ts} +3 -3
- package/dist/{checkbox-BgS8z46p.d.ts.map → checkbox-dqrYEK5V.d.ts.map} +1 -1
- package/dist/{command-BSatjrNa.d.ts → command-DGaoIDsI.d.ts} +8 -8
- package/dist/{command-BSatjrNa.d.ts.map → command-DGaoIDsI.d.ts.map} +1 -1
- package/dist/connect/components/toast/toast.js +1 -1
- package/dist/connect/index.d.ts +345 -41
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +739 -200
- package/dist/connect/index.js.map +1 -1
- package/dist/{content-ZWaCzypo.d.ts → content-OpXUtrTe.d.ts} +2 -2
- package/dist/{content-ZWaCzypo.d.ts.map → content-OpXUtrTe.d.ts.map} +1 -1
- package/dist/{enum-field-CU6jo1T9.d.ts → enum-field-BTc0P4W0.d.ts} +4 -4
- package/dist/{enum-field-CU6jo1T9.d.ts.map → enum-field-BTc0P4W0.d.ts.map} +1 -1
- package/dist/{form-6Lmx7pU_.d.ts → form-B9JNvrH6.d.ts} +1 -1
- package/dist/{form-6Lmx7pU_.d.ts.map → form-B9JNvrH6.d.ts.map} +1 -1
- package/dist/{form-description-Bsurk7mm.d.ts → form-description-BpST5Ww-.d.ts} +1 -1
- package/dist/{form-description-Bsurk7mm.d.ts.map → form-description-BpST5Ww-.d.ts.map} +1 -1
- package/dist/{form-group-B092xF-f.d.ts → form-group-BauWlFkQ.d.ts} +1 -1
- package/dist/form-group-BauWlFkQ.d.ts.map +1 -0
- package/dist/{form-label-CURXUfpb.d.ts → form-label-Cz_gcj-B.d.ts} +1 -1
- package/dist/{form-label-CURXUfpb.d.ts.map → form-label-Cz_gcj-B.d.ts.map} +1 -1
- package/dist/{form-message-BeAVBzjc.d.ts → form-message-BPqNM4gG.d.ts} +1 -1
- package/dist/{form-message-BeAVBzjc.d.ts.map → form-message-BPqNM4gG.d.ts.map} +1 -1
- package/dist/{form-server-error-message-CbKMtocn.d.ts → form-server-error-message-CzMQQ8ru.d.ts} +1 -1
- package/dist/{form-server-error-message-CbKMtocn.d.ts.map → form-server-error-message-CzMQQ8ru.d.ts.map} +1 -1
- package/dist/{id-autocomplete-input-container-DefHskQg.d.ts → id-autocomplete-input-container-NIuWfCB_.d.ts} +2 -2
- package/dist/{id-autocomplete-input-container-DefHskQg.d.ts.map → id-autocomplete-input-container-NIuWfCB_.d.ts.map} +1 -1
- package/dist/{id-autocomplete-DGTfhFRw.d.ts → id-autocomplete-jkaREmPP.d.ts} +2 -2
- package/dist/{id-autocomplete-DGTfhFRw.d.ts.map → id-autocomplete-jkaREmPP.d.ts.map} +1 -1
- package/dist/{id-autocomplete-list-C5uiH5nJ.d.ts → id-autocomplete-list-Bi2IXdXg.d.ts} +2 -2
- package/dist/{id-autocomplete-list-C5uiH5nJ.d.ts.map → id-autocomplete-list-Bi2IXdXg.d.ts.map} +1 -1
- package/dist/{id-autocomplete-list-option-CyF3v8IB.d.ts → id-autocomplete-list-option-CA9HIqEh.d.ts} +2 -2
- package/dist/{id-autocomplete-list-option-CyF3v8IB.d.ts.map → id-autocomplete-list-option-CA9HIqEh.d.ts.map} +1 -1
- package/dist/{index-DoFR9kRM.d.ts → index-DtPJq-vz.d.ts} +1 -1
- package/dist/{index-DoFR9kRM.d.ts.map → index-DtPJq-vz.d.ts.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{input-BMf1G8BP.d.ts → input-D11GgWGm.d.ts} +1 -1
- package/dist/{input-BMf1G8BP.d.ts.map → input-D11GgWGm.d.ts.map} +1 -1
- package/dist/{json-viewer-DD7b-PP2.d.ts → json-viewer-vWp8vOvz.d.ts} +1 -1
- package/dist/{json-viewer-DD7b-PP2.d.ts.map → json-viewer-vWp8vOvz.d.ts.map} +1 -1
- package/dist/{message-list-DDi6OrSM.d.ts → message-list-aysvo-xf.d.ts} +2 -2
- package/dist/{message-list-DDi6OrSM.d.ts.map → message-list-aysvo-xf.d.ts.map} +1 -1
- package/dist/{popover-BXlVJZZW.d.ts → popover-glLRVxPS.d.ts} +1 -1
- package/dist/{popover-BXlVJZZW.d.ts.map → popover-glLRVxPS.d.ts.map} +1 -1
- package/dist/{radio-YzIhzpRk.d.ts → radio-DZ4xl9oz.d.ts} +1 -1
- package/dist/{radio-YzIhzpRk.d.ts.map → radio-DZ4xl9oz.d.ts.map} +1 -1
- package/dist/{radio-group-D2NSfihe.d.ts → radio-group-DjJbcDzB.d.ts} +1 -1
- package/dist/{radio-group-D2NSfihe.d.ts.map → radio-group-DjJbcDzB.d.ts.map} +1 -1
- package/dist/{radio-group-field-maxYxQ6A.d.ts → radio-group-field-CY2UGZp_.d.ts} +3 -3
- package/dist/{radio-group-field-maxYxQ6A.d.ts.map → radio-group-field-CY2UGZp_.d.ts.map} +1 -1
- package/dist/{search-autocomplete-CfSjqceY.d.ts → search-autocomplete-OeZbE-VN.d.ts} +2 -2
- package/dist/{search-autocomplete-CfSjqceY.d.ts.map → search-autocomplete-OeZbE-VN.d.ts.map} +1 -1
- package/dist/{select-field-U8KSDxbg.d.ts → select-field-BClhLm83.d.ts} +2 -2
- package/dist/{select-field-U8KSDxbg.d.ts.map → select-field-BClhLm83.d.ts.map} +1 -1
- package/dist/{selected-content-iwV6vmSI.d.ts → selected-content-q33DjCYy.d.ts} +2 -2
- package/dist/{selected-content-iwV6vmSI.d.ts.map → selected-content-q33DjCYy.d.ts.map} +1 -1
- package/dist/{splitted-input-diff-DSME-KaQ.d.ts → splitted-input-diff-Ch6IKdEa.d.ts} +2 -2
- package/dist/{splitted-input-diff-DSME-KaQ.d.ts.map → splitted-input-diff-Ch6IKdEa.d.ts.map} +1 -1
- package/dist/{src-DTHkTkyy.js → src-D4e3Wkrz.js} +1 -1
- package/dist/{src-DTHkTkyy.js.map → src-D4e3Wkrz.js.map} +1 -1
- package/dist/style.css +12 -0
- package/dist/{text-field-Cxpz1D2u.d.ts → text-field-Cx-EfZP6.d.ts} +3 -3
- package/dist/{text-field-Cxpz1D2u.d.ts.map → text-field-Cx-EfZP6.d.ts.map} +1 -1
- package/dist/{text-input-t0uGOMAO.d.ts → text-input-DUddj4-C.d.ts} +3 -3
- package/dist/{text-input-t0uGOMAO.d.ts.map → text-input-DUddj4-C.d.ts.map} +1 -1
- package/dist/{text-input-diff-bO84di00.d.ts → text-input-diff-4i2zuulO.d.ts} +2 -2
- package/dist/{text-input-diff-bO84di00.d.ts.map → text-input-diff-4i2zuulO.d.ts.map} +1 -1
- package/dist/{tooltip-Db1dLIxg.d.ts → tooltip-Cf5jSzdt.d.ts} +1 -1
- package/dist/{tooltip-Db1dLIxg.d.ts.map → tooltip-Cf5jSzdt.d.ts.map} +1 -1
- package/dist/{types-BDeBOEOj.d.ts → types-9JRQnd7a.d.ts} +1 -1
- package/dist/{types-BDeBOEOj.d.ts.map → types-9JRQnd7a.d.ts.map} +1 -1
- package/dist/{types-BzoMu6VB.d.ts → types-BfmDXMrz.d.ts} +1 -1
- package/dist/{types-BzoMu6VB.d.ts.map → types-BfmDXMrz.d.ts.map} +1 -1
- package/dist/{types-BLss8ZBX.d.ts → types-tThrTH_c.d.ts} +1 -1
- package/dist/{types-BLss8ZBX.d.ts.map → types-tThrTH_c.d.ts.map} +1 -1
- package/dist/ui/components/button/button.d.ts +1 -1
- package/dist/ui/components/button/button.js +1 -1
- package/dist/ui/components/character-counter/character-counter.d.ts +1 -1
- package/dist/ui/components/checkbox/checkbox-base.d.ts +1 -1
- package/dist/ui/components/checkbox/checkbox-base.js +1 -1
- package/dist/ui/components/checkbox/checkbox.d.ts +1 -1
- package/dist/ui/components/checkbox/checkbox.js +1 -1
- package/dist/ui/components/command/command.d.ts +1 -1
- package/dist/ui/components/command/command.js +1 -1
- package/dist/ui/components/enum-field/enum-field.d.ts +1 -1
- package/dist/ui/components/enum-field/types.d.ts +1 -1
- package/dist/ui/components/form/form.d.ts +1 -1
- package/dist/ui/components/form-description/form-description.d.ts +1 -1
- package/dist/ui/components/form-description/form-description.js +1 -1
- package/dist/ui/components/form-group/form-group.d.ts +1 -1
- package/dist/ui/components/form-label/form-label.d.ts +1 -1
- package/dist/ui/components/form-label/form-label.js +1 -1
- package/dist/ui/components/form-message/form-message.d.ts +1 -1
- package/dist/ui/components/form-message/form-message.js +1 -1
- package/dist/ui/components/form-message/form-server-error-message.d.ts +1 -1
- package/dist/ui/components/form-message/message-list.d.ts +1 -1
- package/dist/ui/components/form-message/message-list.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-input-container.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list-option.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete-list.js +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/id-autocomplete.js +1 -1
- package/dist/ui/components/id-autocomplete/types.d.ts +1 -1
- package/dist/ui/components/id-autocomplete/use-id-autocomplete.d.ts +1 -1
- package/dist/ui/components/index.d.ts +36 -36
- package/dist/ui/components/input/input.d.ts +1 -1
- package/dist/ui/components/input/splitted-input-diff.d.ts +1 -1
- package/dist/ui/components/input/splitted-input-diff.js +1 -1
- package/dist/ui/components/input/subcomponent/input-diff.js +1 -1
- package/dist/ui/components/input/subcomponent/text-diff.d.ts +1 -1
- package/dist/ui/components/input/subcomponent/text-diff.js +1 -1
- package/dist/ui/components/json-viewer/json-viewer.d.ts +1 -1
- package/dist/ui/components/popover/popover.d.ts +1 -1
- package/dist/ui/components/popover/popover.js +1 -1
- package/dist/ui/components/radio-group-field/radio-group-field.d.ts +1 -1
- package/dist/ui/components/radio-group-field/radio-group-field.js +1 -1
- package/dist/ui/components/radio-group-field/radio-group.d.ts +1 -1
- package/dist/ui/components/radio-group-field/radio.d.ts +1 -1
- package/dist/ui/components/radio-group-field/radio.js +1 -1
- package/dist/ui/components/search-autocomplete/index.d.ts +3 -3
- package/dist/ui/components/search-autocomplete/search-autocomplete.d.ts +1 -1
- package/dist/ui/components/search-autocomplete/search-autocomplete.js +1 -1
- package/dist/ui/components/search-autocomplete/types.d.ts +1 -1
- package/dist/ui/components/search-autocomplete/use-search-autocomplete.d.ts +1 -1
- package/dist/ui/components/select-field/content.d.ts +1 -1
- package/dist/ui/components/select-field/content.js +1 -1
- package/dist/ui/components/select-field/select-field.d.ts +1 -1
- package/dist/ui/components/select-field/select-field.js +1 -1
- package/dist/ui/components/select-field/selected-content.d.ts +1 -1
- package/dist/ui/components/select-field/selected-content.js +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.d.ts +1 -1
- package/dist/ui/components/select-field/subcomponents/CommandItemList.js +1 -1
- package/dist/ui/components/select-field/use-select-field.d.ts +1 -1
- package/dist/ui/components/text-field/text-field.d.ts +1 -1
- package/dist/ui/components/text-input/text-input-diff.d.ts +1 -1
- package/dist/ui/components/text-input/text-input.d.ts +1 -1
- package/dist/ui/components/text-input/text-input.js +1 -1
- package/dist/ui/components/text-input/types.d.ts +1 -1
- package/dist/ui/components/tooltip/tooltip.d.ts +1 -1
- package/dist/ui/components/tooltip/tooltip.js +1 -1
- package/dist/ui/components/types.d.ts +1 -1
- package/dist/ui/components/value-transformer/value-transformer.d.ts +1 -1
- package/dist/ui/components/with-field-validation/with-field-validation.d.ts +1 -1
- package/dist/ui/index.d.ts +38 -38
- package/dist/ui/lib/date-picker.d.ts +1 -1
- package/dist/ui/lib/shared-value-transformers.d.ts +1 -1
- package/dist/ui/lib/types.d.ts +1 -1
- package/dist/ui/types.d.ts +2 -2
- package/dist/{use-id-autocomplete-BRzpIF4U.d.ts → use-id-autocomplete-BPHVmVE8.d.ts} +2 -2
- package/dist/{use-id-autocomplete-BRzpIF4U.d.ts.map → use-id-autocomplete-BPHVmVE8.d.ts.map} +1 -1
- package/dist/{use-search-autocomplete-ZLxfAC6X.d.ts → use-search-autocomplete-Xf7shCtk.d.ts} +2 -2
- package/dist/{use-search-autocomplete-ZLxfAC6X.d.ts.map → use-search-autocomplete-Xf7shCtk.d.ts.map} +1 -1
- package/dist/{value-transformer-MGhQTCdM.d.ts → value-transformer-DCiU65Qa.d.ts} +2 -2
- package/dist/{value-transformer-MGhQTCdM.d.ts.map → value-transformer-DCiU65Qa.d.ts.map} +1 -1
- package/dist/{with-field-validation-DWMigXJz.d.ts → with-field-validation-vt0l1Sp7.d.ts} +2 -2
- package/dist/{with-field-validation-DWMigXJz.d.ts.map → with-field-validation-vt0l1Sp7.d.ts.map} +1 -1
- package/package.json +5 -4
- package/dist/document-timeline-BTTeXWMa.js +0 -288
- package/dist/document-timeline-BTTeXWMa.js.map +0 -1
- package/dist/form-group-B092xF-f.d.ts.map +0 -1
- /package/dist/{index-BN8Gwmlj.d.ts → index-CWsYGvaO.d.ts} +0 -0
- /package/dist/{index-Dw5cCt-A.d.ts → index-uQcTfU6c.d.ts} +0 -0
package/dist/connect/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as DropdownMenuTrigger, b as DropdownMenuContent, c as SidebarFooter, d as Pagination, f as mergeClassNameProps, g as getDimensions, h as Icon, l as SidebarHeader, m as Modal, p as PackageAnimation, r as usePagination, s as Sidebar, t as cn, u as SidebarPanel, w as PowerhouseButton, x as DropdownMenuItem, y as DropdownMenu } from "../src-DTHkTkyy.js";
|
|
1
|
+
import { C as DropdownMenuTrigger, b as DropdownMenuContent, c as SidebarFooter, d as Pagination, f as mergeClassNameProps, g as getDimensions, h as Icon, l as SidebarHeader, m as Modal, p as PackageAnimation, r as usePagination, s as Sidebar, t as cn, u as SidebarPanel, w as PowerhouseButton, x as DropdownMenuItem, y as DropdownMenu } from "../src-D4e3Wkrz.js";
|
|
3
2
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/components/popover/popover.js";
|
|
4
3
|
import { SelectFieldRaw } from "../ui/components/select-field/select-field.js";
|
|
5
4
|
import { Input } from "../ui/components/input/input.js";
|
|
6
5
|
import { JsonViewer } from "../ui/components/json-viewer/json-viewer.js";
|
|
7
6
|
import { SearchAutocomplete } from "../ui/components/search-autocomplete/search-autocomplete.js";
|
|
8
|
-
import React, { Fragment,
|
|
7
|
+
import React, { Fragment, createElement, forwardRef, memo, useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
9
8
|
import { twJoin, twMerge } from "tailwind-merge";
|
|
10
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Content, Portal, Provider, Root, Trigger } from "@radix-ui/react-tooltip";
|
|
11
11
|
import { Controller, useForm } from "react-hook-form";
|
|
12
|
-
import { Anchor, Content, Portal, Root, Trigger } from "@radix-ui/react-popover";
|
|
13
|
-
import { format } from "date-fns";
|
|
12
|
+
import { Anchor, Content as Content$1, Portal as Portal$1, Root as Root$1, Trigger as Trigger$1 } from "@radix-ui/react-popover";
|
|
13
|
+
import { format, formatDistanceToNow, parseISO } from "date-fns";
|
|
14
14
|
import { useCopyToClipboard, useDebounceValue, useEventListener, useOnClickOutside } from "usehooks-ts";
|
|
15
|
-
import { SyncOperationStatus, addFolder, getSyncStatusSync, setSelectedDrive, setSelectedNode,
|
|
15
|
+
import { SyncOperationStatus, addFolder, getSyncStatusSync, setSelectedDrive, setSelectedNode, showDeleteNodeModal, showPHModal, showRevisionHistory, useDocumentById, useDownloadDocument, useDragNode, useDropFile, useDropNode, useGetSwitchboardLink, useIsDragAndDropEnabled, useNodeActions, useNodeById, useNodeParentFolderById, useOnDropFile, useSelectedDocumentSafe, useSelectedDriveId, useSelectedDriveSafe, useSelectedNodePath, useUserPermissions } from "@powerhousedao/reactor-browser";
|
|
16
16
|
import Select, { components } from "react-select";
|
|
17
|
-
import { Content as Content$
|
|
17
|
+
import { Content as Content$2, List, Root as Root$2, Trigger as Trigger$2 } from "@radix-ui/react-tabs";
|
|
18
|
+
import { addProp, defaultTo, entries, filter, funnel, hasAtLeast, isArray, isDefined, isIncludedIn, isStrictEqual, isString, isTruthy, keys, map, pipe, prop, values } from "remeda";
|
|
18
19
|
import { garbageCollect, redo, sortOperations, undo } from "@powerhousedao/shared/document-model";
|
|
19
|
-
import { addProp, entries, funnel, isStrictEqual, isString, map, pipe } from "remeda";
|
|
20
20
|
import { JsonView } from "@uiw/react-json-view";
|
|
21
21
|
import { isValidName } from "@powerhousedao/shared/document-drive";
|
|
22
22
|
import { capitalCase } from "change-case";
|
|
@@ -1485,7 +1485,7 @@ function TabContent(props) {
|
|
|
1485
1485
|
//#endregion
|
|
1486
1486
|
//#region src/connect/components/tabs/tabs.tsx
|
|
1487
1487
|
function Tabs({ children, defaultValue }) {
|
|
1488
|
-
return /* @__PURE__ */ jsxs(Root$
|
|
1488
|
+
return /* @__PURE__ */ jsxs(Root$2, {
|
|
1489
1489
|
defaultValue,
|
|
1490
1490
|
className: "flex min-h-0 flex-1 flex-col gap-2",
|
|
1491
1491
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -1495,7 +1495,7 @@ function Tabs({ children, defaultValue }) {
|
|
|
1495
1495
|
children: React.Children.map(children, (child, i) => {
|
|
1496
1496
|
if (!/* @__PURE__ */ React.isValidElement(child)) return;
|
|
1497
1497
|
const { label, disabled } = child.props;
|
|
1498
|
-
return /* @__PURE__ */ jsx(Trigger$
|
|
1498
|
+
return /* @__PURE__ */ jsx(Trigger$2, {
|
|
1499
1499
|
className: "data-[state='active']:tab-shadow ata-disabled:cursor-not-allowed data-disabled:text-gray-400 flex h-7 flex-1 items-center justify-center rounded-lg transition duration-300 data-[state='active']:bg-gray-50 data-[state='active']:text-gray-900",
|
|
1500
1500
|
value: label,
|
|
1501
1501
|
disabled: disabled ?? false,
|
|
@@ -1508,7 +1508,7 @@ function Tabs({ children, defaultValue }) {
|
|
|
1508
1508
|
children: React.Children.map(children, (child, i) => {
|
|
1509
1509
|
if (!/* @__PURE__ */ React.isValidElement(child)) return;
|
|
1510
1510
|
const { label } = child.props;
|
|
1511
|
-
return /* @__PURE__ */ jsx(Content$
|
|
1511
|
+
return /* @__PURE__ */ jsx(Content$2, {
|
|
1512
1512
|
className: "h-full",
|
|
1513
1513
|
value: label,
|
|
1514
1514
|
children: child
|
|
@@ -1543,204 +1543,743 @@ function DocumentStateViewer({ state, ignoredScopes = ["auth", "document"], defa
|
|
|
1543
1543
|
});
|
|
1544
1544
|
}
|
|
1545
1545
|
//#endregion
|
|
1546
|
-
//#region src/connect/components/
|
|
1547
|
-
function
|
|
1548
|
-
const
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1546
|
+
//#region src/connect/components/tooltip/tooltip.tsx
|
|
1547
|
+
function ConnectTooltip(props) {
|
|
1548
|
+
const { children, content, open, defaultOpen, onOpenChange, className, side = "top", sideOffset = 5, delayDuration, ...rest } = props;
|
|
1549
|
+
return /* @__PURE__ */ jsxs(Root, {
|
|
1550
|
+
defaultOpen,
|
|
1551
|
+
delayDuration,
|
|
1552
|
+
onOpenChange,
|
|
1553
|
+
open,
|
|
1554
|
+
children: [/* @__PURE__ */ jsx(Trigger, {
|
|
1555
|
+
asChild: true,
|
|
1556
|
+
children
|
|
1557
|
+
}), /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, {
|
|
1558
|
+
...rest,
|
|
1559
|
+
side,
|
|
1560
|
+
sideOffset,
|
|
1561
|
+
className: twMerge("shadow-tooltip z-50 rounded-lg border border-gray-200 bg-white p-2 text-xs", className),
|
|
1562
|
+
children: content
|
|
1563
|
+
}) })]
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
const ConnectTooltipProvider = Provider;
|
|
1567
|
+
//#endregion
|
|
1568
|
+
//#region src/connect/components/document-timeline/components/h-divider.tsx
|
|
1569
|
+
const HDivider = (props) => {
|
|
1570
|
+
const { className, timestampUtcMs: timestamp, title, subtitle, onClick, isSelected = false } = props;
|
|
1571
|
+
const [open, setOpen] = useState(false);
|
|
1572
|
+
const hasContent = !!title || !!subtitle || !!timestamp;
|
|
1573
|
+
useEffect(() => {
|
|
1574
|
+
if (open) {
|
|
1575
|
+
setOpen(false);
|
|
1576
|
+
setTimeout(() => hasContent && setOpen(true), 50);
|
|
1577
|
+
}
|
|
1578
|
+
}, [
|
|
1579
|
+
title,
|
|
1580
|
+
subtitle,
|
|
1581
|
+
timestamp,
|
|
1582
|
+
hasContent
|
|
1583
|
+
]);
|
|
1584
|
+
const formatTimestamp = (isoString) => {
|
|
1585
|
+
if (!isoString) return "";
|
|
1586
|
+
try {
|
|
1587
|
+
return formatDistanceToNow(new Date(isoString), { addSuffix: true });
|
|
1588
|
+
} catch {
|
|
1589
|
+
return isoString;
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
const tooltipContent = /* @__PURE__ */ jsxs("div", {
|
|
1593
|
+
className: "flex flex-col text-xs",
|
|
1594
|
+
children: [
|
|
1595
|
+
!!title && /* @__PURE__ */ jsx("div", { children: title }),
|
|
1596
|
+
!!subtitle && /* @__PURE__ */ jsx("div", {
|
|
1597
|
+
className: "text-gray-300",
|
|
1598
|
+
children: subtitle
|
|
1599
|
+
}),
|
|
1600
|
+
!!timestamp && /* @__PURE__ */ jsx("div", { children: formatTimestamp(timestamp) })
|
|
1601
|
+
]
|
|
1602
|
+
});
|
|
1603
|
+
const handleMouseEnter = () => {
|
|
1604
|
+
if (hasContent) setOpen(true);
|
|
1555
1605
|
};
|
|
1556
|
-
const
|
|
1557
|
-
|
|
1606
|
+
const handleMouseLeave = () => {
|
|
1607
|
+
setOpen(false);
|
|
1608
|
+
};
|
|
1609
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1610
|
+
className: "relative",
|
|
1611
|
+
onMouseEnter: handleMouseEnter,
|
|
1612
|
+
onMouseLeave: handleMouseLeave,
|
|
1613
|
+
children: [isSelected && /* @__PURE__ */ jsx(Icon, {
|
|
1614
|
+
name: "TimelineCaret",
|
|
1615
|
+
color: "#4EA9FF",
|
|
1616
|
+
size: 10,
|
|
1617
|
+
className: "absolute top-[-11px] z-40"
|
|
1618
|
+
}), /* @__PURE__ */ jsx(ConnectTooltip, {
|
|
1619
|
+
className: "rounded-md bg-gray-900 text-white",
|
|
1620
|
+
content: tooltipContent,
|
|
1621
|
+
open: open && hasContent,
|
|
1622
|
+
onOpenChange: setOpen,
|
|
1623
|
+
delayDuration: 0,
|
|
1624
|
+
side: "bottom",
|
|
1625
|
+
sideOffset: 5,
|
|
1626
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1627
|
+
className: twMerge("mx-0.5 flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:bg-blue-300", isSelected && "bg-blue-300", className),
|
|
1628
|
+
onClick,
|
|
1629
|
+
"data-title": title,
|
|
1630
|
+
"data-subtitle": subtitle,
|
|
1631
|
+
"data-timestamp": timestamp,
|
|
1632
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-0.5 w-1 rounded-full bg-gray-500" })
|
|
1633
|
+
})
|
|
1634
|
+
})]
|
|
1635
|
+
});
|
|
1636
|
+
};
|
|
1637
|
+
//#endregion
|
|
1638
|
+
//#region src/connect/components/document-timeline/components/timeline-bar.tsx
|
|
1639
|
+
const getBarHeight = (size = 0) => {
|
|
1640
|
+
switch (true) {
|
|
1641
|
+
case size <= 0: return "h-[1px]";
|
|
1642
|
+
case size === 1: return "h-[3px]";
|
|
1643
|
+
case size === 2: return "h-[6px]";
|
|
1644
|
+
case size === 3: return "h-[9px]";
|
|
1645
|
+
case size >= 4: return "h-[12px]";
|
|
1646
|
+
default: return "h-[1px]";
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
const formatTimestamp$1 = (isoString) => {
|
|
1650
|
+
if (!isoString) return "";
|
|
1651
|
+
try {
|
|
1652
|
+
return format(parseISO(isoString), "HH:mm, dd, MMMM");
|
|
1653
|
+
} catch {
|
|
1654
|
+
return isoString;
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
const TimelineBar = ({ onClick, className, timestampUtcMs: timestamp, additions, deletions, addSize = 0, delSize = 0, isSelected = false }) => {
|
|
1658
|
+
const [open, setOpen] = useState(false);
|
|
1659
|
+
const noChanges = addSize === 0 && delSize === 0;
|
|
1660
|
+
const addBarHeight = getBarHeight(addSize);
|
|
1661
|
+
const delBarHeight = getBarHeight(delSize);
|
|
1662
|
+
const tooltipContent = /* @__PURE__ */ jsxs("div", {
|
|
1663
|
+
className: "flex flex-col text-xs",
|
|
1664
|
+
children: [
|
|
1665
|
+
/* @__PURE__ */ jsx("div", { children: formatTimestamp$1(timestamp) }),
|
|
1666
|
+
/* @__PURE__ */ jsx("div", {
|
|
1667
|
+
className: "text-green-900",
|
|
1668
|
+
children: `${additions} additions +`
|
|
1669
|
+
}),
|
|
1670
|
+
/* @__PURE__ */ jsx("div", {
|
|
1671
|
+
className: "text-red-700",
|
|
1672
|
+
children: `${deletions} deletions -`
|
|
1673
|
+
})
|
|
1674
|
+
]
|
|
1675
|
+
});
|
|
1676
|
+
const handleMouseEnter = () => {
|
|
1677
|
+
if (!noChanges) setOpen(true);
|
|
1678
|
+
};
|
|
1679
|
+
const handleMouseLeave = () => {
|
|
1680
|
+
setOpen(false);
|
|
1681
|
+
};
|
|
1682
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1683
|
+
className: "relative",
|
|
1684
|
+
onMouseEnter: handleMouseEnter,
|
|
1685
|
+
onMouseLeave: handleMouseLeave,
|
|
1686
|
+
children: [isSelected && /* @__PURE__ */ jsx(Icon, {
|
|
1687
|
+
name: "TimelineCaret",
|
|
1688
|
+
color: "#4EA9FF",
|
|
1689
|
+
size: 10,
|
|
1690
|
+
className: "absolute left-[-2px] top-[-11px] z-40"
|
|
1691
|
+
}), noChanges ? /* @__PURE__ */ jsx("div", {
|
|
1692
|
+
className: twMerge("flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:bg-blue-300", className),
|
|
1693
|
+
"data-timestamp": timestamp,
|
|
1694
|
+
onClick,
|
|
1695
|
+
children: /* @__PURE__ */ jsx("div", { className: "size-[3px] rounded-full bg-gray-500" })
|
|
1696
|
+
}) : /* @__PURE__ */ jsx(ConnectTooltip, {
|
|
1697
|
+
className: "rounded-md bg-gray-900 text-white",
|
|
1698
|
+
content: tooltipContent,
|
|
1699
|
+
open,
|
|
1700
|
+
onOpenChange: setOpen,
|
|
1701
|
+
delayDuration: 0,
|
|
1702
|
+
side: "bottom",
|
|
1703
|
+
sideOffset: 5,
|
|
1704
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1705
|
+
className: twMerge("flex h-[25px] w-1.5 cursor-pointer flex-col items-center justify-center rounded-[2px] hover:bg-blue-300", className, isSelected && "bg-blue-300"),
|
|
1706
|
+
"data-timestamp": timestamp,
|
|
1707
|
+
onClick,
|
|
1708
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1709
|
+
className: "flex h-3 w-0.5 items-end",
|
|
1710
|
+
children: /* @__PURE__ */ jsx("div", { className: twMerge("h-3 w-0.5 rounded-t-full bg-green-600", addBarHeight) })
|
|
1711
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1712
|
+
className: "flex h-3 w-0.5 items-start",
|
|
1713
|
+
children: /* @__PURE__ */ jsx("div", { className: twMerge("h-3 w-0.5 rounded-b-full bg-red-600", delBarHeight) })
|
|
1714
|
+
})]
|
|
1715
|
+
})
|
|
1716
|
+
})]
|
|
1717
|
+
});
|
|
1718
|
+
};
|
|
1719
|
+
//#endregion
|
|
1720
|
+
//#region src/connect/components/document-timeline/document-timeline.tsx
|
|
1721
|
+
const defaultTimeLineItem = {
|
|
1722
|
+
id: "default",
|
|
1723
|
+
type: "bar",
|
|
1724
|
+
addSize: 0,
|
|
1725
|
+
delSize: 0
|
|
1726
|
+
};
|
|
1727
|
+
const DocumentTimeline = (props) => {
|
|
1728
|
+
const { timeline = [], onItemClick } = props;
|
|
1729
|
+
const [selectedItem, setSelectedItem] = useState(null);
|
|
1730
|
+
const scrollContainerRef = useRef(null);
|
|
1731
|
+
const handleClick = (item) => {
|
|
1732
|
+
if (item.id === selectedItem || item.id === defaultTimeLineItem.id) {
|
|
1733
|
+
onItemClick?.(null);
|
|
1734
|
+
setSelectedItem(null);
|
|
1735
|
+
} else {
|
|
1736
|
+
onItemClick?.(item);
|
|
1737
|
+
setSelectedItem(item.id);
|
|
1738
|
+
}
|
|
1739
|
+
};
|
|
1740
|
+
const mergedTimelineItems = [...timeline, defaultTimeLineItem];
|
|
1741
|
+
const [unselectedItems, selectedItems] = useMemo(() => {
|
|
1742
|
+
const indexSelected = mergedTimelineItems.findIndex((item) => item.id === selectedItem);
|
|
1743
|
+
return indexSelected === -1 ? [mergedTimelineItems, []] : [mergedTimelineItems.slice(0, indexSelected), mergedTimelineItems.slice(indexSelected)];
|
|
1744
|
+
}, [mergedTimelineItems, selectedItem]);
|
|
1745
|
+
const renderTimelineItems = useCallback((items) => {
|
|
1746
|
+
return items.map((item) => {
|
|
1747
|
+
if (item.type === "divider") {
|
|
1748
|
+
const { timestampUtcMs, title, subtitle } = item;
|
|
1749
|
+
return /* @__PURE__ */ jsx(HDivider, {
|
|
1750
|
+
timestampUtcMs,
|
|
1751
|
+
title,
|
|
1752
|
+
subtitle,
|
|
1753
|
+
onClick: () => handleClick(item),
|
|
1754
|
+
isSelected: item.id === selectedItem
|
|
1755
|
+
}, item.id);
|
|
1756
|
+
}
|
|
1757
|
+
return /* @__PURE__ */ jsx(TimelineBar, {
|
|
1758
|
+
timestampUtcMs: item.timestampUtcMs,
|
|
1759
|
+
addSize: item.addSize,
|
|
1760
|
+
delSize: item.delSize,
|
|
1761
|
+
additions: item.additions,
|
|
1762
|
+
deletions: item.deletions,
|
|
1763
|
+
isSelected: item.id === selectedItem,
|
|
1764
|
+
onClick: () => handleClick(item)
|
|
1765
|
+
}, item.id);
|
|
1766
|
+
});
|
|
1767
|
+
}, [handleClick, selectedItem]);
|
|
1768
|
+
const unselectedContent = useMemo(() => renderTimelineItems(unselectedItems), [unselectedItems, renderTimelineItems]);
|
|
1769
|
+
const selectedContent = useMemo(() => renderTimelineItems(selectedItems), [selectedItems, renderTimelineItems]);
|
|
1770
|
+
useEffect(() => {
|
|
1771
|
+
if (scrollContainerRef.current) scrollContainerRef.current.scrollLeft = scrollContainerRef.current.scrollWidth;
|
|
1772
|
+
}, []);
|
|
1773
|
+
return /* @__PURE__ */ jsx(ConnectTooltipProvider, {
|
|
1774
|
+
delayDuration: 0,
|
|
1775
|
+
skipDelayDuration: 0,
|
|
1776
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1777
|
+
className: "relative h-[36px] w-full",
|
|
1778
|
+
children: [
|
|
1779
|
+
/* @__PURE__ */ jsx("div", {
|
|
1780
|
+
className: "absolute left-[0px] z-[20] h-[17px] w-[6px] bg-white",
|
|
1781
|
+
children: /* @__PURE__ */ jsx("div", { className: "mt-[11px] h-[6px] w-[6px] rounded-tl-md bg-slate-50" })
|
|
1782
|
+
}),
|
|
1783
|
+
/* @__PURE__ */ jsx("div", {
|
|
1784
|
+
className: "absolute right-[0px] top-[11px] z-[20] h-[6px] w-[6px] bg-white",
|
|
1785
|
+
children: /* @__PURE__ */ jsx("div", { className: "h-[6px] w-[6px] rounded-tr-md bg-slate-50" })
|
|
1786
|
+
}),
|
|
1787
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-x-0 bottom-0 h-[25px] rounded-md bg-slate-50" }),
|
|
1788
|
+
/* @__PURE__ */ jsx("div", {
|
|
1789
|
+
className: "absolute inset-x-0 bottom-0 h-[36px]",
|
|
1790
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1791
|
+
ref: scrollContainerRef,
|
|
1792
|
+
className: "h-full overflow-x-auto rounded-md",
|
|
1793
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1794
|
+
className: "ml-auto flex h-[36px] w-max items-end px-2 pb-0",
|
|
1795
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1796
|
+
className: "flex",
|
|
1797
|
+
children: unselectedContent
|
|
1798
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1799
|
+
className: "flex rounded-sm bg-blue-200",
|
|
1800
|
+
children: selectedContent
|
|
1801
|
+
})]
|
|
1802
|
+
})
|
|
1803
|
+
})
|
|
1804
|
+
}),
|
|
1805
|
+
/* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute bottom-0 left-0 z-10 h-[25px] w-2 rounded-l-md bg-slate-50" }),
|
|
1806
|
+
/* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute bottom-0 right-0 z-10 h-[25px] w-2 rounded-r-md bg-slate-50" })
|
|
1807
|
+
]
|
|
1808
|
+
})
|
|
1809
|
+
});
|
|
1810
|
+
};
|
|
1811
|
+
//#endregion
|
|
1812
|
+
//#region src/connect/components/document-toolbar/containers.tsx
|
|
1813
|
+
/**
|
|
1814
|
+
* Default outer container for `DocumentToolbar`.
|
|
1815
|
+
*
|
|
1816
|
+
* This component provides the toolbar's base layout and visual styling while
|
|
1817
|
+
* still accepting standard `div` props. Pass a custom container to
|
|
1818
|
+
* `DocumentToolbar` when you need to replace this wrapper.
|
|
1819
|
+
*/
|
|
1820
|
+
function ToolbarContainer(props) {
|
|
1821
|
+
const { children, className, ...rest } = props;
|
|
1822
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1823
|
+
...rest,
|
|
1824
|
+
className: twMerge("flex h-12 w-full items-center justify-between rounded-xl border border-gray-200 bg-slate-50 px-4", className),
|
|
1825
|
+
children
|
|
1826
|
+
});
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* Default container for a group of toolbar controls.
|
|
1830
|
+
*
|
|
1831
|
+
* `DocumentToolbar` renders one controls container per toolbar slot. This
|
|
1832
|
+
* component provides the default horizontal layout for the controls in that
|
|
1833
|
+
* slot while still accepting standard `div` props.
|
|
1834
|
+
*/
|
|
1835
|
+
function ToolbarControlsContainer(props) {
|
|
1836
|
+
const { children, className, ...rest } = props;
|
|
1837
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1838
|
+
className: twMerge("flex items-center gap-x-2", className),
|
|
1839
|
+
...rest,
|
|
1840
|
+
children
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
//#endregion
|
|
1844
|
+
//#region src/connect/components/document-toolbar/use-document-undo-redo.ts
|
|
1845
|
+
/**
|
|
1846
|
+
* Checks whether a document has at least one non-zero revision count.
|
|
1847
|
+
*
|
|
1848
|
+
* Revision scopes are dynamic document-model keys, so this checks the values of
|
|
1849
|
+
* the document's revision object instead of relying on a fixed list of scope
|
|
1850
|
+
* names.
|
|
1851
|
+
*/
|
|
1852
|
+
function hasRevisions(document) {
|
|
1853
|
+
return pipe(prop(document, "header", "revision"), defaultTo({}), values(), filter(isTruthy), hasAtLeast(1));
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Returns undo state and an undo dispatcher for a document.
|
|
1857
|
+
*
|
|
1858
|
+
* `canUndo` is true when the document has at least one non-zero revision count
|
|
1859
|
+
* across any revision scope.
|
|
1860
|
+
*/
|
|
1861
|
+
function useUndo(documentId) {
|
|
1862
|
+
const [document, dispatch] = useDocumentById(documentId);
|
|
1863
|
+
return {
|
|
1864
|
+
canUndo: hasRevisions(document),
|
|
1865
|
+
undo: () => dispatch(undo())
|
|
1558
1866
|
};
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* Returns redo state and a redo dispatcher for a document.
|
|
1870
|
+
*
|
|
1871
|
+
* `canRedo` is true when the document clipboard contains at least one operation
|
|
1872
|
+
* that can be reapplied.
|
|
1873
|
+
*/
|
|
1874
|
+
function useRedo(documentId) {
|
|
1875
|
+
const [document, dispatch] = useDocumentById(documentId);
|
|
1559
1876
|
return {
|
|
1560
|
-
|
|
1561
|
-
redo:
|
|
1562
|
-
canUndo,
|
|
1563
|
-
canRedo
|
|
1877
|
+
canRedo: hasAtLeast(document?.clipboard ?? [], 1),
|
|
1878
|
+
redo: () => dispatch(redo())
|
|
1564
1879
|
};
|
|
1565
1880
|
}
|
|
1566
1881
|
//#endregion
|
|
1567
|
-
//#region src/connect/components/document-toolbar/
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1882
|
+
//#region src/connect/components/document-toolbar/toolbar-button.tsx
|
|
1883
|
+
/**
|
|
1884
|
+
* Base button component used by the built-in toolbar controls.
|
|
1885
|
+
*
|
|
1886
|
+
* This component provides the default toolbar button styling and disabled-state
|
|
1887
|
+
* behavior while accepting standard `button` props.
|
|
1888
|
+
*/
|
|
1889
|
+
function ToolbarButton(props) {
|
|
1890
|
+
const { className, children, disabled, ...rest } = props;
|
|
1891
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1892
|
+
...rest,
|
|
1893
|
+
disabled,
|
|
1894
|
+
className: twMerge("grid size-fit place-items-center rounded-lg border border-gray-200 bg-white p-1 text-gray-900", disabled ? "cursor-not-allowed text-gray-500" : "cursor-pointer active:opacity-70", className),
|
|
1895
|
+
children
|
|
1896
|
+
});
|
|
1571
1897
|
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
const document =
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
const
|
|
1585
|
-
const
|
|
1586
|
-
const
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1898
|
+
/**
|
|
1899
|
+
* Toolbar control for undoing the latest document revision.
|
|
1900
|
+
*
|
|
1901
|
+
* The button is disabled when there are no revisions available to undo.
|
|
1902
|
+
* Provide `children` to replace the default icon, or `onClick` to override the
|
|
1903
|
+
* default undo behavior.
|
|
1904
|
+
*/
|
|
1905
|
+
function ToolbarUndoButton(props) {
|
|
1906
|
+
const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
|
|
1907
|
+
name: "ArrowCouterclockwise",
|
|
1908
|
+
size: 16
|
|
1909
|
+
}) } = props;
|
|
1910
|
+
const { undo, canUndo } = useUndo(document?.header.id);
|
|
1911
|
+
const disabled = !canUndo;
|
|
1912
|
+
const onClick = makeOnClick(document, onClickOverride, undo);
|
|
1913
|
+
return /* @__PURE__ */ jsx(ToolbarButton, {
|
|
1914
|
+
"data-testid": "toolbar-undo-button",
|
|
1915
|
+
"aria-label": "Undo",
|
|
1916
|
+
className,
|
|
1917
|
+
disabled,
|
|
1918
|
+
onClick,
|
|
1919
|
+
children
|
|
1920
|
+
});
|
|
1921
|
+
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Toolbar control for redoing the latest undone document revision.
|
|
1924
|
+
*
|
|
1925
|
+
* The button is disabled when there are no revisions available to redo.
|
|
1926
|
+
* Provide `children` to replace the default icon, or `onClick` to override the
|
|
1927
|
+
* default redo behavior.
|
|
1928
|
+
*/
|
|
1929
|
+
function ToolbarRedoButton(props) {
|
|
1930
|
+
const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
|
|
1931
|
+
name: "ArrowCouterclockwise",
|
|
1932
|
+
className: "-scale-x-100",
|
|
1933
|
+
size: 16
|
|
1934
|
+
}) } = props;
|
|
1935
|
+
const { redo, canRedo } = useRedo(document?.header.id);
|
|
1936
|
+
const onClick = makeOnClick(document, onClickOverride, redo);
|
|
1937
|
+
const disabled = !canRedo;
|
|
1938
|
+
return /* @__PURE__ */ jsx(ToolbarButton, {
|
|
1939
|
+
"data-testid": "toolbar-redo-button",
|
|
1940
|
+
"aria-label": "Redo",
|
|
1941
|
+
className,
|
|
1942
|
+
disabled,
|
|
1943
|
+
onClick,
|
|
1944
|
+
children
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Toolbar control for downloading the current document.
|
|
1949
|
+
*
|
|
1950
|
+
* Provide `children` to replace the default label, or `onClick` to override the
|
|
1951
|
+
* default download behavior.
|
|
1952
|
+
*/
|
|
1953
|
+
function ToolbarDownloadButton(props) {
|
|
1954
|
+
const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx("span", {
|
|
1955
|
+
className: "px-1 text-xs",
|
|
1956
|
+
children: "Download"
|
|
1957
|
+
}) } = props;
|
|
1958
|
+
const onClick = makeOnClick(document, onClickOverride, useDownloadDocument(document?.header.id));
|
|
1959
|
+
return /* @__PURE__ */ jsx(ToolbarButton, {
|
|
1960
|
+
"data-testid": "toolbar-download-button",
|
|
1961
|
+
"aria-label": "Download",
|
|
1962
|
+
className,
|
|
1963
|
+
onClick,
|
|
1964
|
+
children
|
|
1965
|
+
});
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Toolbar control for opening the current document in Switchboard.
|
|
1969
|
+
*
|
|
1970
|
+
* Provide `children` to replace the default icon, or `onClick` to override the
|
|
1971
|
+
* default behavior.
|
|
1972
|
+
*/
|
|
1973
|
+
function ToolbarSwitchboardButton(props) {
|
|
1974
|
+
const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
|
|
1975
|
+
name: "Drive",
|
|
1976
|
+
size: 16
|
|
1977
|
+
}) } = props;
|
|
1592
1978
|
const getSwitchboardLink = useGetSwitchboardLink(document);
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1979
|
+
const onClick = makeOnClick(document, onClickOverride, () => {
|
|
1980
|
+
getSwitchboardLink?.().then((url) => window.open(url, "_blank")).catch((error) => console.error("Error opening switchboard link:", error));
|
|
1981
|
+
});
|
|
1982
|
+
return /* @__PURE__ */ jsx(ToolbarButton, {
|
|
1983
|
+
"data-testid": "toolbar-switchboard-button",
|
|
1984
|
+
"aria-label": "Open link in Switchboard",
|
|
1985
|
+
className,
|
|
1986
|
+
onClick,
|
|
1987
|
+
children
|
|
1988
|
+
});
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* Toolbar control for showing the current document's revision history.
|
|
1992
|
+
*
|
|
1993
|
+
* Provide `children` to replace the default icon, or `onClick` to override the
|
|
1994
|
+
* default revision-history behavior.
|
|
1995
|
+
*/
|
|
1996
|
+
function ToolbarHistoryButton(props) {
|
|
1997
|
+
const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
|
|
1998
|
+
name: "History",
|
|
1999
|
+
size: 16
|
|
2000
|
+
}) } = props;
|
|
2001
|
+
const onClick = makeOnClick(document, onClickOverride, showRevisionHistory);
|
|
2002
|
+
return /* @__PURE__ */ jsx(ToolbarButton, {
|
|
2003
|
+
"data-testid": "toolbar-history-button",
|
|
2004
|
+
"aria-label": "Open document revision history",
|
|
2005
|
+
className,
|
|
2006
|
+
onClick,
|
|
2007
|
+
children
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
/**
|
|
2011
|
+
* Toolbar control for closing the current document view.
|
|
2012
|
+
*
|
|
2013
|
+
* By default, this selects the current document's parent folder. Provide
|
|
2014
|
+
* `children` to replace the default icon, or `onClick` to override the default
|
|
2015
|
+
* close behavior.
|
|
2016
|
+
*/
|
|
2017
|
+
function ToolbarCloseButton(props) {
|
|
2018
|
+
const { className, onClick: onClickOverride, document, children = /* @__PURE__ */ jsx(Icon, {
|
|
2019
|
+
name: "XmarkLight",
|
|
2020
|
+
size: 16
|
|
2021
|
+
}) } = props;
|
|
2022
|
+
const parentFolder = useNodeParentFolderById(document?.header.id);
|
|
2023
|
+
const onClick = makeOnClick(document, onClickOverride, () => setSelectedNode(parentFolder));
|
|
2024
|
+
return /* @__PURE__ */ jsx(ToolbarButton, {
|
|
2025
|
+
"data-testid": "toolbar-close-button",
|
|
2026
|
+
"aria-label": "Close document",
|
|
2027
|
+
className,
|
|
2028
|
+
onClick,
|
|
2029
|
+
children
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
/**
|
|
2033
|
+
* Creates a toolbar button click handler.
|
|
2034
|
+
*
|
|
2035
|
+
* If an override is provided, it is called with the current document. Otherwise,
|
|
2036
|
+
* the built-in handler is called with the current document.
|
|
2037
|
+
*/
|
|
2038
|
+
function makeOnClick(document, onClickOverride, defaultOnClick) {
|
|
2039
|
+
if (isDefined(onClickOverride)) return () => onClickOverride(document);
|
|
2040
|
+
return () => defaultOnClick(document);
|
|
2041
|
+
}
|
|
2042
|
+
//#endregion
|
|
2043
|
+
//#region src/connect/components/document-toolbar/toolbar-input.tsx
|
|
2044
|
+
/**
|
|
2045
|
+
* Text input styled for use inside a toolbar.
|
|
2046
|
+
*
|
|
2047
|
+
* This wraps `NodeInput` with toolbar-specific text styling. Use it for inline
|
|
2048
|
+
* toolbar editing flows where the user can submit a value or cancel editing.
|
|
2049
|
+
*/
|
|
2050
|
+
function ToolbarInput(props) {
|
|
2051
|
+
const { defaultValue, className, onSubmit, onCancel, "aria-label": ariaLabel } = props;
|
|
2052
|
+
return /* @__PURE__ */ jsx(NodeInput, {
|
|
2053
|
+
defaultValue,
|
|
2054
|
+
className: twMerge("text-center text-sm font-medium text-gray-500", className),
|
|
2055
|
+
"aria-label": ariaLabel,
|
|
2056
|
+
onCancel,
|
|
2057
|
+
onSubmit
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
//#endregion
|
|
2061
|
+
//#region src/connect/components/document-toolbar/toolbar-name.tsx
|
|
2062
|
+
/**
|
|
2063
|
+
* Toolbar control for displaying and renaming the current document.
|
|
2064
|
+
*
|
|
2065
|
+
* By default, the component renders the document name as a clickable heading.
|
|
2066
|
+
* When clicked, it switches to an inline input. Submitting the input renames
|
|
2067
|
+
* both the node and the corresponding drive node entry.
|
|
2068
|
+
*/
|
|
2069
|
+
function ToolbarName(props) {
|
|
2070
|
+
const { document, inputClassName, titleClassName } = props;
|
|
2071
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
2072
|
+
const node = useNodeById(document?.header.id);
|
|
2073
|
+
const { onRenameNode, onRenameDriveNodes } = useNodeActions();
|
|
2074
|
+
const documentName = document?.header.name;
|
|
2075
|
+
const documentId = document?.header.id;
|
|
2076
|
+
const activateEditing = () => setIsEditing(true);
|
|
2077
|
+
const cancelEditing = () => setIsEditing(false);
|
|
2078
|
+
const onSubmit = (newName) => {
|
|
2079
|
+
cancelEditing();
|
|
2080
|
+
if (!documentId || !node) return;
|
|
2081
|
+
Promise.all([onRenameNode(newName, node), onRenameDriveNodes(newName, documentId)]).catch(console.error);
|
|
1604
2082
|
};
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
2083
|
+
if (!documentName) return null;
|
|
2084
|
+
if (isEditing) return /* @__PURE__ */ jsx(ToolbarInput, {
|
|
2085
|
+
className: inputClassName,
|
|
2086
|
+
onSubmit,
|
|
2087
|
+
onCancel: cancelEditing,
|
|
2088
|
+
defaultValue: documentName,
|
|
2089
|
+
"aria-label": "Document name"
|
|
2090
|
+
});
|
|
2091
|
+
return /* @__PURE__ */ jsx("h1", {
|
|
2092
|
+
className: twMerge("cursor-pointer text-sm font-medium text-gray-500 hover:text-gray-700", titleClassName),
|
|
2093
|
+
onClick: activateEditing,
|
|
2094
|
+
title: "Click to edit",
|
|
2095
|
+
children: documentName
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
//#endregion
|
|
2099
|
+
//#region src/connect/components/document-toolbar/constants.ts
|
|
2100
|
+
/**
|
|
2101
|
+
* Default slot layout for the built-in document toolbar controls.
|
|
2102
|
+
*
|
|
2103
|
+
* The toolbar is divided into three control groups:
|
|
2104
|
+
*
|
|
2105
|
+
* - `first`: primary document actions.
|
|
2106
|
+
* - `second`: document identity/display controls.
|
|
2107
|
+
* - `third`: secondary document actions.
|
|
2108
|
+
*/
|
|
2109
|
+
const defaultControlSlots = {
|
|
2110
|
+
first: [
|
|
2111
|
+
"undo",
|
|
2112
|
+
"redo",
|
|
2113
|
+
"download"
|
|
2114
|
+
],
|
|
2115
|
+
second: ["name"],
|
|
2116
|
+
third: [
|
|
2117
|
+
"history",
|
|
2118
|
+
"switchboard",
|
|
2119
|
+
"close"
|
|
2120
|
+
]
|
|
2121
|
+
};
|
|
2122
|
+
/**
|
|
2123
|
+
* Ordered list of toolbar slot names.
|
|
2124
|
+
*/
|
|
2125
|
+
const controlSlots = keys(defaultControlSlots);
|
|
2126
|
+
/**
|
|
2127
|
+
* Ordered list of all built-in document toolbar control names.
|
|
2128
|
+
*
|
|
2129
|
+
* The order is derived from `defaultControlSlots`.
|
|
2130
|
+
*/
|
|
2131
|
+
const documentToolbarControls = [
|
|
2132
|
+
...defaultControlSlots.first,
|
|
2133
|
+
...defaultControlSlots.second,
|
|
2134
|
+
...defaultControlSlots.third
|
|
2135
|
+
];
|
|
2136
|
+
/**
|
|
2137
|
+
* Default component implementation for each built-in toolbar control.
|
|
2138
|
+
*
|
|
2139
|
+
* These components are used unless a matching entry is provided through
|
|
2140
|
+
* `componentOverrides`.
|
|
2141
|
+
*/
|
|
2142
|
+
const defaultControlComponents = {
|
|
2143
|
+
undo: ToolbarUndoButton,
|
|
2144
|
+
redo: ToolbarRedoButton,
|
|
2145
|
+
download: ToolbarDownloadButton,
|
|
2146
|
+
name: ToolbarName,
|
|
2147
|
+
switchboard: ToolbarSwitchboardButton,
|
|
2148
|
+
history: ToolbarHistoryButton,
|
|
2149
|
+
close: ToolbarCloseButton
|
|
2150
|
+
};
|
|
2151
|
+
//#endregion
|
|
2152
|
+
//#region src/connect/components/document-toolbar/utils.tsx
|
|
2153
|
+
/**
|
|
2154
|
+
* Creates a predicate for checking whether a built-in toolbar control should render.
|
|
2155
|
+
*
|
|
2156
|
+
* A control renders when it is included in `enabledControls` and absent from
|
|
2157
|
+
* `disabledControls`. When `enabledControls` is omitted, all built-in controls
|
|
2158
|
+
* are considered enabled. When a control appears in both lists,
|
|
2159
|
+
* `disabledControls` takes precedence.
|
|
2160
|
+
*/
|
|
2161
|
+
function makeIsEnabledChecker(args) {
|
|
2162
|
+
const { enabledControls = documentToolbarControls, disabledControls = [] } = args;
|
|
2163
|
+
return (control) => isIncludedIn(control, enabledControls) && !isIncludedIn(control, disabledControls);
|
|
2164
|
+
}
|
|
2165
|
+
/**
|
|
2166
|
+
* Creates a getter for rendering the built-in toolbar controls in a slot.
|
|
2167
|
+
*
|
|
2168
|
+
* The returned function resolves the controls assigned to a slot, filters them
|
|
2169
|
+
* through the enabled/disabled control lists, applies any component overrides,
|
|
2170
|
+
* and renders each control with the current document.
|
|
2171
|
+
*/
|
|
2172
|
+
function makeToolbarControlsRenderer(args) {
|
|
2173
|
+
const { document, enabledControls, disabledControls, componentOverrides } = args;
|
|
2174
|
+
const checkIsEnabled = makeIsEnabledChecker({
|
|
2175
|
+
enabledControls,
|
|
2176
|
+
disabledControls
|
|
2177
|
+
});
|
|
2178
|
+
const renderComponent = (control) => pipe(prop(componentOverrides, control), defaultTo(prop(defaultControlComponents, control)), (Component) => /* @__PURE__ */ jsx(Component, { document }, control));
|
|
2179
|
+
return (slot) => pipe(prop(defaultControlSlots, slot), filter(checkIsEnabled), map(renderComponent));
|
|
2180
|
+
}
|
|
2181
|
+
/**
|
|
2182
|
+
* Checks whether a custom control should render in the requested position.
|
|
2183
|
+
*
|
|
2184
|
+
* Controls without an explicit position are treated as `"start"`.
|
|
2185
|
+
*/
|
|
2186
|
+
function isControlInPosition(control, position) {
|
|
2187
|
+
return defaultTo(control.position, "start") === position;
|
|
2188
|
+
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Creates a getter for rendering custom controls in a slot and position.
|
|
2191
|
+
*
|
|
2192
|
+
* The returned function resolves the custom control or controls assigned to a
|
|
2193
|
+
* slot, then renders only the controls that belong in the requested position.
|
|
2194
|
+
*/
|
|
2195
|
+
function makeCustomControlsRenderer(args) {
|
|
2196
|
+
const { document, customControls = {} } = args;
|
|
2197
|
+
return (slot, pos) => {
|
|
2198
|
+
const controlOrControlList = prop(customControls, slot);
|
|
2199
|
+
if (!isDefined(controlOrControlList)) return null;
|
|
2200
|
+
if (isArray(controlOrControlList)) return renderCustomControlList(controlOrControlList, pos, document);
|
|
2201
|
+
return renderCustomControl(controlOrControlList, pos, document);
|
|
1615
2202
|
};
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
2203
|
+
}
|
|
2204
|
+
/**
|
|
2205
|
+
* Renders a single custom control when it belongs in the requested position.
|
|
2206
|
+
*/
|
|
2207
|
+
function renderCustomControl(control, pos, document) {
|
|
2208
|
+
if (!isControlInPosition(control, pos)) return null;
|
|
2209
|
+
const Component = control.component;
|
|
2210
|
+
return /* @__PURE__ */ jsx(Component, { document });
|
|
2211
|
+
}
|
|
2212
|
+
/**
|
|
2213
|
+
* Renders a list of custom controls for the requested position.
|
|
2214
|
+
*
|
|
2215
|
+
* Returns `null` when no controls in the list belong in that position.
|
|
2216
|
+
*/
|
|
2217
|
+
function renderCustomControlList(controls, pos, document) {
|
|
2218
|
+
const controlsInPosition = filter(controls, (control) => isControlInPosition(control, pos));
|
|
2219
|
+
if (!hasAtLeast(controlsInPosition, 1)) return null;
|
|
2220
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: map(controlsInPosition, ({ component: Component, key }) => /* @__PURE__ */ jsx(Component, { document }, key)) });
|
|
2221
|
+
}
|
|
2222
|
+
//#endregion
|
|
2223
|
+
//#region src/connect/components/document-toolbar/document-toolbar.tsx
|
|
2224
|
+
/**
|
|
2225
|
+
* Renders a document toolbar.
|
|
2226
|
+
*
|
|
2227
|
+
* By default, the toolbar renders the built-in document controls grouped into
|
|
2228
|
+
* toolbar slots. The controls operate on the provided `document`, or on the
|
|
2229
|
+
* currently selected document when no document is provided.
|
|
2230
|
+
*
|
|
2231
|
+
* Use `enabledControls` and `disabledControls` to control which built-in
|
|
2232
|
+
* controls are shown. Use `componentOverrides` to replace individual built-in
|
|
2233
|
+
* controls while keeping the default toolbar layout. Use `customControls` to
|
|
2234
|
+
* insert additional controls before or after the built-in controls in a slot.
|
|
2235
|
+
*
|
|
2236
|
+
* To take over the toolbar contents completely, pass `children`.
|
|
2237
|
+
*/
|
|
2238
|
+
function DocumentToolbar(props) {
|
|
2239
|
+
const [selectedDocument] = useSelectedDocumentSafe();
|
|
2240
|
+
const { toolbarClassName, document = selectedDocument, toolbarContainer: Container = ToolbarContainer } = props;
|
|
2241
|
+
if ("children" in props) return /* @__PURE__ */ jsx(Container, {
|
|
2242
|
+
className: toolbarClassName,
|
|
2243
|
+
children: props.children
|
|
2244
|
+
});
|
|
2245
|
+
return /* @__PURE__ */ jsx(Container, {
|
|
2246
|
+
className: toolbarClassName,
|
|
2247
|
+
children: map(controlSlots, (slot) => /* @__PURE__ */ createElement(ControlsContainerSlot, {
|
|
2248
|
+
...props,
|
|
2249
|
+
document,
|
|
2250
|
+
slot,
|
|
2251
|
+
key: slot
|
|
2252
|
+
}))
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Renders one toolbar controls slot.
|
|
2257
|
+
*
|
|
2258
|
+
* Custom controls with position `"start"` are rendered before the built-in
|
|
2259
|
+
* controls for the slot. Custom controls with position `"end"` are rendered
|
|
2260
|
+
* after them.
|
|
2261
|
+
*/
|
|
2262
|
+
function ControlsContainerSlot(props) {
|
|
2263
|
+
const { slot, document, controlsContainerClassName, enabledControls, disabledControls, componentOverrides, customControls, controlsContainer: ControlsContainer = ToolbarControlsContainer } = props;
|
|
2264
|
+
const renderToolbarControls = makeToolbarControlsRenderer({
|
|
2265
|
+
document,
|
|
2266
|
+
enabledControls,
|
|
2267
|
+
disabledControls,
|
|
2268
|
+
componentOverrides
|
|
2269
|
+
});
|
|
2270
|
+
const renderCustomControls = makeCustomControlsRenderer({
|
|
2271
|
+
document,
|
|
2272
|
+
customControls
|
|
2273
|
+
});
|
|
2274
|
+
return /* @__PURE__ */ jsxs(ControlsContainer, {
|
|
2275
|
+
className: controlsContainerClassName,
|
|
1619
2276
|
children: [
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1624
|
-
className: "flex items-center gap-x-2",
|
|
1625
|
-
children: [
|
|
1626
|
-
enabledControls.includes("undo") && /* @__PURE__ */ jsx("button", {
|
|
1627
|
-
className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", isUndoDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
|
|
1628
|
-
onClick: documentUndoRedo.undo,
|
|
1629
|
-
disabled: isUndoDisabled,
|
|
1630
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
1631
|
-
name: "ArrowCouterclockwise",
|
|
1632
|
-
size: 16,
|
|
1633
|
-
className: isUndoDisabled ? "text-gray-500" : "text-gray-900"
|
|
1634
|
-
})
|
|
1635
|
-
}),
|
|
1636
|
-
enabledControls.includes("redo") && /* @__PURE__ */ jsx("button", {
|
|
1637
|
-
className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", isRedoDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
|
|
1638
|
-
onClick: documentUndoRedo.redo,
|
|
1639
|
-
disabled: isRedoDisabled,
|
|
1640
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
1641
|
-
className: "-scale-x-100",
|
|
1642
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
1643
|
-
name: "ArrowCouterclockwise",
|
|
1644
|
-
size: 16,
|
|
1645
|
-
className: isRedoDisabled ? "text-gray-500" : "text-gray-900"
|
|
1646
|
-
})
|
|
1647
|
-
})
|
|
1648
|
-
}),
|
|
1649
|
-
enabledControls.includes("export") && /* @__PURE__ */ jsx("button", {
|
|
1650
|
-
className: twMerge("flex h-8 items-center rounded-lg border border-gray-200 bg-white px-3 text-sm", isDownloadDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
|
|
1651
|
-
onClick: handleDownloadDocument,
|
|
1652
|
-
disabled: isDownloadDisabled,
|
|
1653
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
1654
|
-
className: isDownloadDisabled ? "text-gray-500" : "text-gray-900",
|
|
1655
|
-
children: "Download"
|
|
1656
|
-
})
|
|
1657
|
-
})
|
|
1658
|
-
]
|
|
1659
|
-
}),
|
|
1660
|
-
/* @__PURE__ */ jsx("div", {
|
|
1661
|
-
className: "flex items-center",
|
|
1662
|
-
children: isEditingName && document ? /* @__PURE__ */ jsx(NodeInput, {
|
|
1663
|
-
defaultValue: documentName,
|
|
1664
|
-
className: "text-center text-sm font-medium text-gray-500",
|
|
1665
|
-
"aria-label": "Document name",
|
|
1666
|
-
onCancel: () => setIsEditingName(false),
|
|
1667
|
-
onSubmit: (newName) => {
|
|
1668
|
-
const node = { id: document.header.id };
|
|
1669
|
-
Promise.all([onRenameNode(newName, node), onRenameDriveNodes(newName, document.header.id)]).then(() => setIsEditingName(false)).catch((error) => {
|
|
1670
|
-
console.error("Failed to rename document:", error);
|
|
1671
|
-
setIsEditingName(false);
|
|
1672
|
-
});
|
|
1673
|
-
}
|
|
1674
|
-
}) : /* @__PURE__ */ jsx("h1", {
|
|
1675
|
-
className: twMerge("text-sm font-medium text-gray-500", document && "cursor-pointer hover:text-gray-700"),
|
|
1676
|
-
onDoubleClick: document ? () => setIsEditingName(true) : void 0,
|
|
1677
|
-
title: document ? "Double-click to edit" : void 0,
|
|
1678
|
-
children: documentName
|
|
1679
|
-
})
|
|
1680
|
-
}),
|
|
1681
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1682
|
-
className: "flex items-center gap-x-2",
|
|
1683
|
-
children: [
|
|
1684
|
-
!isSwitchboardLinkDisabled && /* @__PURE__ */ jsx("button", {
|
|
1685
|
-
className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", "cursor-pointer active:opacity-70"),
|
|
1686
|
-
onClick: resolvedSwitchboardHandler,
|
|
1687
|
-
disabled: isSwitchboardLinkDisabled,
|
|
1688
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
1689
|
-
name: "Drive",
|
|
1690
|
-
size: 16,
|
|
1691
|
-
className: "text-gray-900"
|
|
1692
|
-
})
|
|
1693
|
-
}),
|
|
1694
|
-
enabledControls.includes("history") && /* @__PURE__ */ jsx("button", {
|
|
1695
|
-
className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", disableRevisionHistory ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
|
|
1696
|
-
onClick: showRevisionHistory,
|
|
1697
|
-
disabled: disableRevisionHistory,
|
|
1698
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
1699
|
-
name: "History",
|
|
1700
|
-
size: 16,
|
|
1701
|
-
className: disableRevisionHistory ? "text-gray-500" : "text-gray-900"
|
|
1702
|
-
})
|
|
1703
|
-
}),
|
|
1704
|
-
enabledControls.includes("timeline") && defaultTimelineVisible && /* @__PURE__ */ jsx("button", {
|
|
1705
|
-
className: twMerge("grid size-8 place-items-center rounded-lg border border-gray-200 bg-white", isTimelineDisabled ? "cursor-not-allowed" : "cursor-pointer active:opacity-70"),
|
|
1706
|
-
onClick: handleTimelineToggle,
|
|
1707
|
-
disabled: isTimelineDisabled,
|
|
1708
|
-
"aria-pressed": showTimeline,
|
|
1709
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
1710
|
-
name: "Timeline",
|
|
1711
|
-
size: 16,
|
|
1712
|
-
className: twMerge("text-gray-900", isTimelineDisabled && "opacity-50", showTimeline && "text-blue-600")
|
|
1713
|
-
})
|
|
1714
|
-
}),
|
|
1715
|
-
/* @__PURE__ */ jsx("button", {
|
|
1716
|
-
id: "close-document-button",
|
|
1717
|
-
"aria-label": "Close document",
|
|
1718
|
-
className: "grid size-8 cursor-pointer place-items-center rounded-lg border border-gray-200 bg-white active:opacity-70",
|
|
1719
|
-
onClick: handleClose,
|
|
1720
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
1721
|
-
name: "XmarkLight",
|
|
1722
|
-
size: 16,
|
|
1723
|
-
className: "text-gray-900"
|
|
1724
|
-
})
|
|
1725
|
-
})
|
|
1726
|
-
]
|
|
1727
|
-
})
|
|
1728
|
-
]
|
|
1729
|
-
}),
|
|
1730
|
-
showTimeline && /* @__PURE__ */ jsx("div", {
|
|
1731
|
-
className: "mt-2 w-full",
|
|
1732
|
-
children: /* @__PURE__ */ jsx(Suspense, {
|
|
1733
|
-
fallback: null,
|
|
1734
|
-
children: /* @__PURE__ */ jsx(DocumentTimeline$1, {
|
|
1735
|
-
timeline: timelineItemsData,
|
|
1736
|
-
onItemClick: setSelectedTimelineItem
|
|
1737
|
-
})
|
|
1738
|
-
})
|
|
1739
|
-
}),
|
|
1740
|
-
children
|
|
2277
|
+
renderCustomControls(slot, "start"),
|
|
2278
|
+
renderToolbarControls(slot),
|
|
2279
|
+
renderCustomControls(slot, "end")
|
|
1741
2280
|
]
|
|
1742
2281
|
});
|
|
1743
|
-
}
|
|
2282
|
+
}
|
|
1744
2283
|
//#endregion
|
|
1745
2284
|
//#region src/connect/components/modal/replace-duplicate-modal.tsx
|
|
1746
2285
|
const buttonStyles$4 = "min-h-[48px] min-w-[142px] text-base font-semibold py-3 px-6 rounded-xl outline-none active:opacity-75 hover:scale-105 transform transition-all";
|
|
@@ -7367,11 +7906,11 @@ function CodePopover(props) {
|
|
|
7367
7906
|
opener.cancel();
|
|
7368
7907
|
closer.call();
|
|
7369
7908
|
}
|
|
7370
|
-
return /* @__PURE__ */ jsxs(Root, {
|
|
7909
|
+
return /* @__PURE__ */ jsxs(Root$1, {
|
|
7371
7910
|
open: isOpen,
|
|
7372
7911
|
onOpenChange: (changedIsOpen) => changedIsOpen ? open() : close(),
|
|
7373
7912
|
children: [
|
|
7374
|
-
/* @__PURE__ */ jsx(Trigger, {
|
|
7913
|
+
/* @__PURE__ */ jsx(Trigger$1, {
|
|
7375
7914
|
onMouseEnter: open,
|
|
7376
7915
|
children: trigger
|
|
7377
7916
|
}),
|
|
@@ -7379,7 +7918,7 @@ function CodePopover(props) {
|
|
|
7379
7918
|
asChild: true,
|
|
7380
7919
|
children: anchor
|
|
7381
7920
|
}),
|
|
7382
|
-
/* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Content, {
|
|
7921
|
+
/* @__PURE__ */ jsx(Portal$1, { children: /* @__PURE__ */ jsx(Content$1, {
|
|
7383
7922
|
forceMount: true,
|
|
7384
7923
|
onMouseLeave: close,
|
|
7385
7924
|
sideOffset: -28,
|
|
@@ -8189,6 +8728,6 @@ const removeSuccessFiles = (files) => {
|
|
|
8189
8728
|
return files.filter((file) => file.status !== "SUCCESS");
|
|
8190
8729
|
};
|
|
8191
8730
|
//#endregion
|
|
8192
|
-
export { About, AccountPopover, AddDriveModal, AddLocalDriveForm, AddLocalDriveModal, AddRemoteDriveForm, AddRemoteDriveModal, AnimatedLoader, Breadcrumb, Breadcrumbs, CONFLICT, ChannelInspector, ClearStorageSettingsRow, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, IntegrityInspector, LoadingScreen, MISSING, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageManager, PackageManagerInput, PackageManagerList, PackageManagerListItem, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SettingsModalOld, SettingsRow, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, Toggle, UploadFileItem, UploadFileList, UploadFileListContainer, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, getFolderStatus, locationInfoByLocation, nodeOptions, normalNodeOptions, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
|
|
8731
|
+
export { About, AccountPopover, AddDriveModal, AddLocalDriveForm, AddLocalDriveModal, AddRemoteDriveForm, AddRemoteDriveModal, AnimatedLoader, Breadcrumb, Breadcrumbs, CONFLICT, ChannelInspector, ClearStorageSettingsRow, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, IntegrityInspector, LoadingScreen, MISSING, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageManager, PackageManagerInput, PackageManagerList, PackageManagerListItem, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SettingsModalOld, SettingsRow, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, getFolderStatus, locationInfoByLocation, nodeOptions, normalNodeOptions, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
|
|
8193
8732
|
|
|
8194
8733
|
//# sourceMappingURL=index.js.map
|