@dxos/react-ui-editor 0.4.8 → 0.4.9-main.2d20855

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.
@@ -17,7 +17,10 @@ var translations_default = [
17
17
  "comment label": "Create comment",
18
18
  "image label": "Insert image",
19
19
  "heading label": "Heading level",
20
- "table label": "Create table"
20
+ "table label": "Create table",
21
+ "heading level label_zero": "Paragraph",
22
+ "heading level label_one": "Heading level {{count}}",
23
+ "heading level label_other": "Heading level {{count}}"
21
24
  }
22
25
  }
23
26
  }
@@ -4485,11 +4488,11 @@ var TextEditor = /* @__PURE__ */ forwardRef(({ id, doc, selection, extensions, c
4485
4488
  });
4486
4489
 
4487
4490
  // packages/ui/react-ui-editor/src/components/Toolbar/Toolbar.tsx
4488
- import { ChatText, Code, CodeBlock, Image, Link, ListBullets, ListChecks, ListNumbers, Paragraph, Quotes, TextStrikethrough, Table as Table2, TextB, TextHOne, TextHTwo, TextHThree, TextHFour, TextHFive, TextHSix, TextItalic } from "@phosphor-icons/react";
4491
+ import { ChatText, Code, CodeBlock, Image, Link, ListBullets, ListChecks, ListNumbers, Paragraph, Quotes, TextStrikethrough, Table as Table2, TextB, TextHOne, TextHTwo, TextHThree, TextHFour, TextHFive, TextHSix, TextItalic, CaretDown, Check } from "@phosphor-icons/react";
4489
4492
  import { createContext } from "@radix-ui/react-context";
4490
4493
  import React2, { useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
4491
4494
  import { useDropzone } from "react-dropzone";
4492
- import { DensityProvider, ElevationProvider, Select, Toolbar as NaturalToolbar, Tooltip, useTranslation } from "@dxos/react-ui";
4495
+ import { DensityProvider, ElevationProvider, Toolbar as NaturalToolbar, Tooltip, useTranslation, DropdownMenu, Button } from "@dxos/react-ui";
4493
4496
  import { getSize } from "@dxos/react-ui-theme";
4494
4497
  var tooltipProps = {
4495
4498
  side: "top",
@@ -4572,58 +4575,48 @@ var MarkdownHeading = () => {
4572
4575
  return setTooltipOpen(nextOpen);
4573
4576
  }
4574
4577
  }
4575
- }, /* @__PURE__ */ React2.createElement(Select.Root, {
4576
- disabled: value === null,
4577
- value: value ?? "0",
4578
+ }, /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
4578
4579
  open: selectOpen,
4579
4580
  onOpenChange: (nextOpen) => {
4580
4581
  if (!nextOpen) {
4581
4582
  suppressNextTooltip.current = true;
4582
4583
  }
4583
4584
  return setSelectOpen(nextOpen);
4584
- },
4585
- onValueChange: (value2) => onAction?.({
4586
- type: "heading",
4587
- data: parseInt(value2)
4588
- })
4585
+ }
4589
4586
  }, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
4590
4587
  asChild: true
4591
4588
  }, /* @__PURE__ */ React2.createElement(NaturalToolbar.Button, {
4592
4589
  asChild: true
4593
- }, /* @__PURE__ */ React2.createElement(Select.TriggerButton, {
4590
+ }, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
4591
+ asChild: true
4592
+ }, /* @__PURE__ */ React2.createElement(Button, {
4594
4593
  variant: "ghost",
4595
- classNames: buttonStyles
4594
+ classNames: buttonStyles,
4595
+ disabled: value === null
4596
4596
  }, /* @__PURE__ */ React2.createElement("span", {
4597
4597
  className: "sr-only"
4598
4598
  }, t("heading label")), /* @__PURE__ */ React2.createElement(HeadingIcon, {
4599
4599
  className: iconStyles
4600
- })))), /* @__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, {
4601
- value: "0"
4602
- }, /* @__PURE__ */ React2.createElement(Paragraph, {
4603
- className: iconStyles
4604
- })), [
4605
- 1,
4606
- 2,
4607
- 3,
4608
- 4,
4609
- 5,
4610
- 6
4611
- ].map((level) => /* @__PURE__ */ React2.createElement(Select.Option, {
4612
- key: level,
4613
- value: String(level)
4614
- }, level === 1 && /* @__PURE__ */ React2.createElement(TextHOne, {
4615
- className: iconStyles
4616
- }), level === 2 && /* @__PURE__ */ React2.createElement(TextHTwo, {
4617
- className: iconStyles
4618
- }), level === 3 && /* @__PURE__ */ React2.createElement(TextHThree, {
4619
- className: iconStyles
4620
- }), level === 4 && /* @__PURE__ */ React2.createElement(TextHFour, {
4621
- className: iconStyles
4622
- }), level === 5 && /* @__PURE__ */ React2.createElement(TextHFive, {
4623
- className: iconStyles
4624
- }), level === 6 && /* @__PURE__ */ React2.createElement(TextHSix, {
4625
- className: iconStyles
4626
- })))), /* @__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))));
4600
+ }), /* @__PURE__ */ React2.createElement(CaretDown, null))))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
4601
+ classNames: "is-min md:is-min",
4602
+ onCloseAutoFocus: (e) => e.preventDefault()
4603
+ }, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, Object.keys(HeadingIcons).map((level) => {
4604
+ const Icon = HeadingIcons[level];
4605
+ return /* @__PURE__ */ React2.createElement(DropdownMenu.CheckboxItem, {
4606
+ key: level,
4607
+ checked: value === level,
4608
+ onClick: () => onAction?.({
4609
+ type: "heading",
4610
+ data: level
4611
+ })
4612
+ }, /* @__PURE__ */ React2.createElement("span", {
4613
+ className: "sr-only"
4614
+ }, t("heading level label", {
4615
+ count: parseInt(level)
4616
+ })), /* @__PURE__ */ React2.createElement(Icon, {
4617
+ className: iconStyles
4618
+ }), /* @__PURE__ */ React2.createElement(DropdownMenu.ItemIndicator, null, /* @__PURE__ */ React2.createElement(Check, null)));
4619
+ })), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null)))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, tooltipProps, t("heading label"), /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null))));
4627
4620
  };
4628
4621
  var markdownStyles = [
4629
4622
  {