@meowdown/react 0.68.2 → 0.68.3

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
@@ -741,32 +741,33 @@ function LinkEditContent({ edit, resolveLinkPreview, onSubmit, onRemove }) {
741
741
  const [text, setText] = useState(edit.text);
742
742
  const [href, setHref] = useState(edit.link?.href ?? "");
743
743
  const [debouncedHref, setDebouncedHref] = useState(href.trim());
744
- const textInputRef = useRef(null);
744
+ const hrefInputRef = useRef(null);
745
745
  const previewHref = normalizeHref(debouncedHref);
746
746
  const previewState = useLinkPreview(previewHref || void 0, resolveLinkPreview);
747
747
  const canUseTitle = !!edit.link && debouncedHref === href.trim() && isLinkTextForHref(text, previewHref);
748
+ const canSave = text.trim() !== "" && href.trim() !== "";
748
749
  useEffect(() => {
749
750
  const timer = window.setTimeout(() => setDebouncedHref(href.trim()), 400);
750
751
  return () => window.clearTimeout(timer);
751
752
  }, [href]);
752
753
  useEffect(() => {
753
- textInputRef.current?.focus();
754
+ hrefInputRef.current?.focus();
755
+ hrefInputRef.current?.select();
754
756
  }, []);
755
757
  return /* @__PURE__ */ jsxs("form", {
756
758
  className: link_menu_module_default.Form,
757
759
  "data-testid": "link-popover-edit",
760
+ noValidate: true,
758
761
  onSubmit: (event) => {
759
762
  event.preventDefault();
760
- if (text.trim() && href.trim()) onSubmit(text, href);
763
+ if (canSave) onSubmit(text, href);
761
764
  },
762
765
  children: [
763
766
  /* @__PURE__ */ jsxs("label", {
764
767
  className: link_menu_module_default.Field,
765
768
  children: [/* @__PURE__ */ jsx("span", { children: "Text" }), /* @__PURE__ */ jsx("input", {
766
- ref: textInputRef,
767
769
  className: link_menu_module_default.Input,
768
770
  value: text,
769
- required: true,
770
771
  "data-testid": "link-popover-text-input",
771
772
  onChange: (event) => setText(event.target.value)
772
773
  })]
@@ -774,10 +775,10 @@ function LinkEditContent({ edit, resolveLinkPreview, onSubmit, onRemove }) {
774
775
  /* @__PURE__ */ jsxs("label", {
775
776
  className: link_menu_module_default.Field,
776
777
  children: [/* @__PURE__ */ jsx("span", { children: "Link" }), /* @__PURE__ */ jsx("input", {
778
+ ref: hrefInputRef,
777
779
  className: link_menu_module_default.Input,
778
780
  value: href,
779
- required: true,
780
- placeholder: "Paste link...",
781
+ placeholder: "Paste link…",
781
782
  "data-testid": "link-popover-input",
782
783
  onChange: (event) => setHref(event.target.value)
783
784
  })]
@@ -800,6 +801,7 @@ function LinkEditContent({ edit, resolveLinkPreview, onSubmit, onRemove }) {
800
801
  /* @__PURE__ */ jsx("button", {
801
802
  type: "submit",
802
803
  className: link_menu_module_default.SaveButton,
804
+ disabled: !canSave,
803
805
  "data-testid": "link-popover-submit",
804
806
  children: "Save"
805
807
  })
@@ -926,7 +928,7 @@ function LinkMenu({ onLinkClick, onLinkCopy, resolveLinkPreview, readOnly = fals
926
928
  children: editing ? /* @__PURE__ */ jsx(LinkEditContent, {
927
929
  edit,
928
930
  resolveLinkPreview,
929
- onRemove: handleEditRemove,
931
+ onRemove: edit.link ? handleEditRemove : void 0,
930
932
  onSubmit: handleEditSubmit
931
933
  }) : link ? /* @__PURE__ */ jsx(LinkInfoContent, {
932
934
  href: link.href,
package/dist/style.css CHANGED
@@ -533,28 +533,44 @@
533
533
 
534
534
  & > span {
535
535
  color: var(--meowdown-muted);
536
- font-size: .75rem;
537
- font-weight: 600;
536
+ font-size: .8125rem;
537
+ font-weight: 500;
538
538
  }
539
539
  }
540
540
 
541
541
  .meow_Input_IjcqKG {
542
542
  box-sizing: border-box;
543
543
  width: 100%;
544
+ height: 2rem;
544
545
  font: inherit;
545
546
  color: var(--meowdown-text);
546
- border: 1px solid var(--meowdown-border);
547
+ border: 1px solid var(--meowdown-input-border);
547
548
  background: none;
548
549
  border-radius: .5rem;
549
- padding: .5rem .625rem;
550
+ padding: 0 .625rem;
551
+ transition: border-color .1s, box-shadow .1s;
552
+
553
+ &::placeholder {
554
+ color: var(--meowdown-placeholder);
555
+ }
550
556
 
551
557
  &:focus {
552
- outline: 2px solid var(--meowdown-accent);
553
- outline-offset: -1px;
558
+ border-color: var(--meowdown-focus-ring);
559
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--meowdown-focus-ring) 50%, transparent);
560
+ outline: none;
561
+ }
562
+
563
+ @media (pointer: coarse) {
564
+ height: 2.75rem;
565
+ }
566
+
567
+ @media (prefers-reduced-motion: reduce) {
568
+ transition: none;
554
569
  }
555
570
  }
556
571
 
557
572
  .meow_FormActions_IjcqKG {
573
+ justify-content: flex-end;
558
574
  align-items: center;
559
575
  gap: .375rem;
560
576
  padding-top: .125rem;
@@ -569,19 +585,64 @@
569
585
  border: 0;
570
586
  border-radius: .5rem;
571
587
  padding: .375rem .625rem;
588
+ font-weight: 500;
589
+ transition: background-color .1s;
590
+
591
+ &:focus-visible {
592
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--meowdown-focus-ring) 50%, transparent);
593
+ outline: none;
594
+ }
572
595
 
573
596
  @media (pointer: coarse) {
574
597
  min-height: 2.75rem;
575
598
  }
599
+
600
+ @media (prefers-reduced-motion: reduce) {
601
+ transition: none;
602
+ }
576
603
  }
577
604
 
578
605
  .meow_RemoveButton_IjcqKG {
579
- color: var(--meowdown-danger, #c33);
606
+ color: var(--meowdown-danger);
607
+ margin-right: auto;
608
+
609
+ &:hover {
610
+ background: color-mix(in oklab, var(--meowdown-danger) 10%, transparent);
611
+ }
580
612
  }
581
613
 
582
614
  .meow_UseTitleButton_IjcqKG {
583
615
  color: var(--meowdown-accent);
584
- margin-left: auto;
616
+
617
+ &:hover {
618
+ background: var(--meowdown-popover-hover-bg);
619
+ }
620
+ }
621
+
622
+ .meow_SaveButton_IjcqKG {
623
+ transition: background-color .1s, transform .1s ease-out;
624
+
625
+ &:hover:not(:disabled) {
626
+ background: color-mix(in oklab, var(--meowdown-accent) 80%, transparent);
627
+ }
628
+
629
+ &:active:not(:disabled) {
630
+ transform: translateY(1px);
631
+ }
632
+
633
+ &:focus-visible {
634
+ box-shadow: 0 0 0 3px color-mix(in oklab, var(--meowdown-focus-ring) 50%, transparent);
635
+ outline: none;
636
+ }
637
+
638
+ &:disabled {
639
+ opacity: .5;
640
+ cursor: default;
641
+ }
642
+
643
+ @media (prefers-reduced-motion: reduce) {
644
+ transition: none;
645
+ }
585
646
  }
586
647
  .meow_Positioner_DPJ5ia {
587
648
  z-index: 50;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meowdown/react",
3
3
  "type": "module",
4
- "version": "0.68.2",
4
+ "version": "0.68.3",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "@base-ui/react": "^1.7.0",
25
- "@ocavue/utils": "^1.7.0",
25
+ "@ocavue/utils": "^1.8.0",
26
26
  "@prosekit/core": "^0.13.2",
27
27
  "@prosekit/pm": "^0.1.19",
28
28
  "@prosekit/react": "^0.8.2",
@@ -31,7 +31,7 @@
31
31
  "github-slugger": "^2.0.0",
32
32
  "lucide-react": "^1.38.0",
33
33
  "react-property": "^2.0.2",
34
- "@meowdown/core": "0.68.2"
34
+ "@meowdown/core": "0.68.3"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "react": "^19.0.0",