@sustaina/shared-ui 1.9.2 → 1.9.4

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/index.js CHANGED
@@ -4355,7 +4355,7 @@ function DialogContent({
4355
4355
  {
4356
4356
  "data-slot": "dialog-content",
4357
4357
  className: cn(
4358
- "fixed top-1/2 left-1/2 z-50 flex h-[90vh] w-full max-w-[80vw] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg border bg-background shadow-lg duration-200 sm:max-w-7xl",
4358
+ "fixed top-1/2 left-1/2 z-50 flex min-h-0 max-h-[90vh] w-full max-w-[80vw] translate-x-[-50%] translate-y-[-50%] flex-col rounded-lg border bg-background shadow-lg duration-200 sm:max-w-7xl",
4359
4359
  className
4360
4360
  ),
4361
4361
  ...props,
@@ -4807,7 +4807,7 @@ var GridSettingsModal = ({
4807
4807
  }
4808
4808
  }
4809
4809
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-xl border-0 p-0 overflow-hidden", children: [
4810
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col -mx-6 -mt-6", children: [
4810
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
4811
4811
  /* @__PURE__ */ jsxRuntime.jsxs(
4812
4812
  "div",
4813
4813
  {
@@ -4842,7 +4842,7 @@ var GridSettingsModal = ({
4842
4842
  )
4843
4843
  ] }),
4844
4844
  /* @__PURE__ */ jsxRuntime.jsx(Form, { ...form, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "mt-6 flex flex-col justify-between", children: [
4845
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-16 my-10", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 max-h-60 overflow-y-auto pr-4", children: [
4845
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-16 my-10", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 max-h-60 pr-4", children: [
4846
4846
  /* @__PURE__ */ jsxRuntime.jsx(
4847
4847
  SortableRow,
4848
4848
  {
@@ -4900,7 +4900,7 @@ var GridSettingsModal = ({
4900
4900
  }
4901
4901
  ) })
4902
4902
  ] }) }),
4903
- /* @__PURE__ */ jsxRuntime.jsx(DialogFooter, { className: "-mx-6 mt-6 px-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between w-full py-4 border-t-1 border-[#B9B9B9]", children: [
4903
+ /* @__PURE__ */ jsxRuntime.jsx(DialogFooter, { className: "-mx-6 mt-6 px-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex px-4 justify-between w-full", children: [
4904
4904
  /* @__PURE__ */ jsxRuntime.jsx(
4905
4905
  Button,
4906
4906
  {
@@ -5464,7 +5464,6 @@ var theme = {
5464
5464
  var nodes = [richText.HeadingNode, richText.QuoteNode, list.ListNode, list.ListItemNode, link.LinkNode, code.CodeNode, ImageNode];
5465
5465
  var INSERT_IMAGE_COMMAND = lexical.createCommand("INSERT_IMAGE_COMMAND");
5466
5466
  var DEFAULT_IMAGE_ACCEPT = "image/*";
5467
- var defaultPlaceholder = "Start writing\u2026";
5468
5467
  function parseSerializedEditorState(raw) {
5469
5468
  if (!raw) {
5470
5469
  return void 0;
@@ -5512,6 +5511,18 @@ function ToolbarButton({ label, icon: Icon2, onClick, active, disabled }) {
5512
5511
  }
5513
5512
  );
5514
5513
  }
5514
+ function placeCaretAfterImage(imageNode) {
5515
+ const nextSibling = imageNode.getNextSibling();
5516
+ if (!nextSibling || $isImageNode(nextSibling)) {
5517
+ const paragraph = lexical.$createParagraphNode();
5518
+ const textNode = lexical.$createTextNode("");
5519
+ paragraph.append(textNode);
5520
+ imageNode.insertAfter(paragraph);
5521
+ textNode.select(0, 0);
5522
+ return;
5523
+ }
5524
+ imageNode.selectNext(0, 0);
5525
+ }
5515
5526
  function ToolbarPlugin({
5516
5527
  disabled,
5517
5528
  onImageUpload,
@@ -5927,7 +5938,7 @@ function ToolbarPlugin({
5927
5938
  existingNode.setSrc(payload.src);
5928
5939
  existingNode.setAltText(payload.altText ?? "");
5929
5940
  existingNode.setDimensions(payload.width ?? "inherit", payload.height ?? "inherit");
5930
- existingNode.selectNext(0, 0);
5941
+ placeCaretAfterImage(existingNode);
5931
5942
  return;
5932
5943
  }
5933
5944
  }
@@ -5938,7 +5949,7 @@ function ToolbarPlugin({
5938
5949
  } else {
5939
5950
  lexical.$insertNodes([imageNode]);
5940
5951
  }
5941
- imageNode.selectNext(0, 0);
5952
+ placeCaretAfterImage(imageNode);
5942
5953
  });
5943
5954
  closeImageDialog();
5944
5955
  });
@@ -6189,48 +6200,55 @@ function ToolbarPlugin({
6189
6200
  }
6190
6201
  )
6191
6202
  ] }),
6192
- /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isLinkDialogOpen, onOpenChange: handleLinkDialogOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { header: editingExistingLink ? "Edit link" : "Insert link", children: /* @__PURE__ */ jsxRuntime.jsx(Form, { ...linkForm, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "grid gap-4", onSubmit: handleLinkSubmit, children: [
6193
- /* @__PURE__ */ jsxRuntime.jsx(
6194
- FormField,
6195
- {
6196
- control: linkForm.control,
6197
- name: "url",
6198
- rules: { required: "Please enter a URL." },
6199
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { children: [
6200
- /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: "URL" }),
6201
- /* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(Input, { placeholder: "https://example.com", ...field }) }),
6202
- /* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
6203
- ] })
6204
- }
6205
- ),
6206
- /* @__PURE__ */ jsxRuntime.jsx(
6207
- FormField,
6208
- {
6209
- control: linkForm.control,
6210
- name: "label",
6211
- render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { children: [
6212
- /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: "Link label" }),
6213
- /* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(Input, { placeholder: "Display text", ...field }) }),
6214
- /* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
6203
+ /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isLinkDialogOpen, onOpenChange: handleLinkDialogOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(
6204
+ DialogContent,
6205
+ {
6206
+ className: "min-w-[70vw] max-w-7xl",
6207
+ header: editingExistingLink ? "Edit link" : "Insert link",
6208
+ children: /* @__PURE__ */ jsxRuntime.jsx(Form, { ...linkForm, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "grid gap-4 p-6", onSubmit: handleLinkSubmit, children: [
6209
+ /* @__PURE__ */ jsxRuntime.jsx(
6210
+ FormField,
6211
+ {
6212
+ control: linkForm.control,
6213
+ name: "url",
6214
+ rules: { required: "Please enter a URL." },
6215
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { children: [
6216
+ /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: "URL" }),
6217
+ /* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(Input, { placeholder: "https://example.com", ...field }) }),
6218
+ /* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
6219
+ ] })
6220
+ }
6221
+ ),
6222
+ /* @__PURE__ */ jsxRuntime.jsx(
6223
+ FormField,
6224
+ {
6225
+ control: linkForm.control,
6226
+ name: "label",
6227
+ render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { children: [
6228
+ /* @__PURE__ */ jsxRuntime.jsx(FormLabel, { children: "Link label" }),
6229
+ /* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(Input, { placeholder: "Display text", ...field }) }),
6230
+ /* @__PURE__ */ jsxRuntime.jsx(FormMessage, {})
6231
+ ] })
6232
+ }
6233
+ ),
6234
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "pt-2", children: [
6235
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "cancel", onClick: closeLinkDialog, children: "Cancel" }),
6236
+ editingExistingLink ? /* @__PURE__ */ jsxRuntime.jsx(
6237
+ Button,
6238
+ {
6239
+ type: "button",
6240
+ variant: "ghost",
6241
+ onClick: handleRemoveLink,
6242
+ className: "text-destructive",
6243
+ children: "Remove link"
6244
+ }
6245
+ ) : null,
6246
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", children: "Save link" })
6215
6247
  ] })
6216
- }
6217
- ),
6218
- /* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { className: "pt-2", children: [
6219
- /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", variant: "cancel", onClick: closeLinkDialog, children: "Cancel" }),
6220
- editingExistingLink ? /* @__PURE__ */ jsxRuntime.jsx(
6221
- Button,
6222
- {
6223
- type: "button",
6224
- variant: "ghost",
6225
- onClick: handleRemoveLink,
6226
- className: "text-destructive",
6227
- children: "Remove link"
6228
- }
6229
- ) : null,
6230
- /* @__PURE__ */ jsxRuntime.jsx(Button, { type: "submit", children: "Save link" })
6231
- ] })
6232
- ] }) }) }) }),
6233
- /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isImageDialogOpen, onOpenChange: handleImageDialogOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { header: editingExistingImage ? "Edit image" : "Insert image", children: /* @__PURE__ */ jsxRuntime.jsx(Form, { ...imageForm, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "grid gap-4", onSubmit: handleImageSubmit, children: [
6248
+ ] }) })
6249
+ }
6250
+ ) }),
6251
+ /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isImageDialogOpen, onOpenChange: handleImageDialogOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { header: editingExistingImage ? "Edit image" : "Insert image", children: /* @__PURE__ */ jsxRuntime.jsx(Form, { ...imageForm, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "grid gap-4 p-6", onSubmit: handleImageSubmit, children: [
6234
6252
  /* @__PURE__ */ jsxRuntime.jsx(
6235
6253
  FormField,
6236
6254
  {
@@ -6345,6 +6363,7 @@ function ImagesPlugin() {
6345
6363
  editor.update(() => {
6346
6364
  const imageNode = $createImageNode(payload);
6347
6365
  lexical.$insertNodes([imageNode]);
6366
+ placeCaretAfterImage(imageNode);
6348
6367
  });
6349
6368
  return true;
6350
6369
  },
@@ -6358,7 +6377,7 @@ var RichText = React6.forwardRef(function RichText2({
6358
6377
  defaultValue,
6359
6378
  onChange,
6360
6379
  onHtmlChange,
6361
- placeholder: placeholder3 = defaultPlaceholder,
6380
+ placeholder: placeholder3,
6362
6381
  readOnly,
6363
6382
  disabled,
6364
6383
  editorClassName,
@@ -6446,7 +6465,7 @@ var RichText = React6.forwardRef(function RichText2({
6446
6465
  )
6447
6466
  }
6448
6467
  ),
6449
- placeholder: /* @__PURE__ */ jsxRuntime.jsx(Placeholder, { placeholder: placeholder3 }),
6468
+ placeholder: /* @__PURE__ */ jsxRuntime.jsx(Placeholder, { placeholder: placeholder3 || "" }),
6450
6469
  ErrorBoundary: LexicalErrorBoundary.LexicalErrorBoundary
6451
6470
  }
6452
6471
  ),