@dxos/react-ui-editor 0.4.5-main.f10c180 → 0.4.5-next.ea4f804

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.
@@ -1,3 +1,27 @@
1
+ // packages/ui/react-ui-editor/src/translations.ts
2
+ var translationKey = "react-ui-editor";
3
+ var translations_default = [
4
+ {
5
+ "en-US": {
6
+ [translationKey]: {
7
+ "strong label": "Bold",
8
+ "emphasis label": "Italics",
9
+ "strikethrough label": "Strikethrough",
10
+ "code label": "Code",
11
+ "link label": "Link",
12
+ "list-bullet label": "Bullet list",
13
+ "list-ordered label": "Numbered list",
14
+ "list-task label": "Task list",
15
+ "blockquote label": "Block quote",
16
+ "codeblock label": "Code block",
17
+ "comment label": "Create comment",
18
+ "heading label": "Heading level",
19
+ "table label": "Create table"
20
+ }
21
+ }
22
+ }
23
+ ];
24
+
1
25
  // packages/ui/react-ui-editor/src/index.ts
2
26
  import { keymap as keymap8 } from "@codemirror/view";
3
27
  import { TextKind } from "@dxos/protocols/proto/dxos/echo/model/text";
@@ -3979,32 +4003,12 @@ var defaultMarkdownSlots = {
3979
4003
  import { ChatText, Code, CodeBlock, Link, ListBullets, ListChecks, ListNumbers, Paragraph, TextStrikethrough, Table as Table2, TextB, TextHOne, TextHTwo, TextHThree, TextHFour, TextHFive, TextHSix, TextItalic, Quotes } from "@phosphor-icons/react";
3980
4004
  import { createContext } from "@radix-ui/react-context";
3981
4005
  import React2 from "react";
3982
- import { DensityProvider, ElevationProvider, Select, Toolbar as NaturalToolbar, useTranslation } from "@dxos/react-ui";
4006
+ import { DensityProvider, ElevationProvider, Select, Toolbar as NaturalToolbar, Tooltip, useTranslation } from "@dxos/react-ui";
3983
4007
  import { getSize } from "@dxos/react-ui-theme";
3984
-
3985
- // packages/ui/react-ui-editor/src/translations.ts
3986
- var translationKey = "react-ui-editor";
3987
- var translations_default = [
3988
- {
3989
- "en-US": {
3990
- [translationKey]: {
3991
- "strong label": "Strong",
3992
- "emphasis label": "Emphasis",
3993
- "strikethrough label": "Strike-through",
3994
- "code label": "Code",
3995
- "list-bullet label": "Bullet list",
3996
- "list-ordered label": "Numbered list",
3997
- "list-task label": "Task list",
3998
- "blockquote label": "Block quote",
3999
- "codeblock label": "Code block",
4000
- "comment label": "Create comment",
4001
- "heading label": "Heading level"
4002
- }
4003
- }
4004
- }
4005
- ];
4006
-
4007
- // packages/ui/react-ui-editor/src/components/Toolbar/Toolbar.tsx
4008
+ var tooltipProps = {
4009
+ side: "top",
4010
+ classNames: "z-10"
4011
+ };
4008
4012
  var HeadingIcons = {
4009
4013
  "0": Paragraph,
4010
4014
  "1": TextHOne,
@@ -4033,7 +4037,9 @@ var ToolbarRoot = ({ children, onAction, classNames, state }) => {
4033
4037
  var buttonStyles = "min-bs-0 p-2";
4034
4038
  var iconStyles = getSize(5);
4035
4039
  var ToolbarButton = ({ Icon, children, ...props }) => {
4036
- return /* @__PURE__ */ React2.createElement(NaturalToolbar.ToggleGroupItem, {
4040
+ return /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
4041
+ asChild: true
4042
+ }, /* @__PURE__ */ React2.createElement(NaturalToolbar.ToggleGroupItem, {
4037
4043
  variant: "ghost",
4038
4044
  ...props,
4039
4045
  classNames: buttonStyles
@@ -4041,7 +4047,7 @@ var ToolbarButton = ({ Icon, children, ...props }) => {
4041
4047
  className: iconStyles
4042
4048
  }), /* @__PURE__ */ React2.createElement("span", {
4043
4049
  className: "sr-only"
4044
- }, children));
4050
+ }, children))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, tooltipProps, children, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null))));
4045
4051
  };
4046
4052
  var ToolbarSeparator = () => /* @__PURE__ */ React2.createElement("div", {
4047
4053
  role: "separator",
@@ -4054,13 +4060,15 @@ var MarkdownHeading = () => {
4054
4060
  const header = blockType && /heading(\d)/.exec(blockType);
4055
4061
  const value = header ? header[1] : blockType === "paragraph" || !blockType ? "0" : void 0;
4056
4062
  const HeadingIcon = HeadingIcons[value ?? "0"];
4057
- return /* @__PURE__ */ React2.createElement(Select.Root, {
4063
+ return /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Select.Root, {
4058
4064
  disabled: value === null,
4059
4065
  value: value ?? "0",
4060
4066
  onValueChange: (value2) => onAction?.({
4061
4067
  type: "heading",
4062
4068
  data: parseInt(value2)
4063
4069
  })
4070
+ }, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
4071
+ asChild: true
4064
4072
  }, /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
4065
4073
  asChild: true
4066
4074
  }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
@@ -4070,7 +4078,7 @@ var MarkdownHeading = () => {
4070
4078
  className: "sr-only"
4071
4079
  }, t("heading label")), /* @__PURE__ */ React2.createElement(HeadingIcon, {
4072
4080
  className: iconStyles
4073
- }))), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React2.createElement(Select.Viewport, null, /* @__PURE__ */ React2.createElement(Select.Option, {
4081
+ })))), /* @__PURE__ */ React2.createElement(Select.Portal, null, /* @__PURE__ */ React2.createElement(Select.Content, null, /* @__PURE__ */ React2.createElement(Select.ScrollUpButton, null), /* @__PURE__ */ React2.createElement(Select.Viewport, null, /* @__PURE__ */ React2.createElement(Select.Option, {
4074
4082
  value: "0"
4075
4083
  }, /* @__PURE__ */ React2.createElement(Paragraph, {
4076
4084
  className: iconStyles
@@ -4096,7 +4104,7 @@ var MarkdownHeading = () => {
4096
4104
  className: iconStyles
4097
4105
  }), level === 6 && /* @__PURE__ */ React2.createElement(TextHSix, {
4098
4106
  className: iconStyles
4099
- })))), /* @__PURE__ */ React2.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React2.createElement(Select.Arrow, null))));
4107
+ })))), /* @__PURE__ */ React2.createElement(Select.ScrollDownButton, null), /* @__PURE__ */ React2.createElement(Select.Arrow, null)))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, tooltipProps, t("heading label"), /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null))));
4100
4108
  };
4101
4109
  var markdownStyles = [
4102
4110
  {
@@ -4215,7 +4223,9 @@ var MarkdownStandard = () => /* @__PURE__ */ React2.createElement(React2.Fragmen
4215
4223
  var MarkdownExtended = () => {
4216
4224
  const { onAction } = useToolbarContext("MarkdownStyles");
4217
4225
  const { t } = useTranslation(translationKey);
4218
- return /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
4226
+ return /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
4227
+ asChild: true
4228
+ }, /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
4219
4229
  variant: "ghost",
4220
4230
  "data-testid": "editor.toolbar.comment",
4221
4231
  onClick: () => onAction?.({
@@ -4226,7 +4236,7 @@ var MarkdownExtended = () => {
4226
4236
  className: iconStyles
4227
4237
  }), /* @__PURE__ */ React2.createElement("span", {
4228
4238
  className: "sr-only"
4229
- }, t("comment label")));
4239
+ }, t("comment label")))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, tooltipProps, t("comment label"), /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null))));
4230
4240
  };
4231
4241
  var Toolbar = {
4232
4242
  Root: ToolbarRoot,
@@ -4677,6 +4687,7 @@ export {
4677
4687
  toggleStrikethrough,
4678
4688
  toggleStrong,
4679
4689
  toggleStyle,
4690
+ translations_default as translations,
4680
4691
  typewriter,
4681
4692
  useActionHandler,
4682
4693
  useComments,