@aortl/admin-react 0.19.0 → 0.19.1

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.mjs CHANGED
@@ -2581,8 +2581,9 @@ function PropertyListLabel({ className, ...rest }) {
2581
2581
  ...rest
2582
2582
  });
2583
2583
  }
2584
- function PropertyListValue({ numeric, copyable, empty, copyValue, className, classNames, children, ...rest }) {
2584
+ function PropertyListValue({ numeric, copyable, empty, copyValue, className, classNames, children, onClick, ...rest }) {
2585
2585
  const ddRef = useRef(null);
2586
+ const copyButtonRef = useRef(null);
2586
2587
  const [copied, setCopied] = useState(false);
2587
2588
  async function handleCopy() {
2588
2589
  const text = copyValue ?? ddRef.current?.textContent?.trim() ?? "";
@@ -2593,6 +2594,14 @@ function PropertyListValue({ numeric, copyable, empty, copyValue, className, cla
2593
2594
  setTimeout(() => setCopied(false), 1200);
2594
2595
  } catch {}
2595
2596
  }
2597
+ function handleCellClick(event) {
2598
+ onClick?.(event);
2599
+ if (event.defaultPrevented) return;
2600
+ if (window.getSelection()?.toString()) return;
2601
+ const interactive = event.target.closest("a, button, input, select, textarea");
2602
+ if (interactive && interactive !== copyButtonRef.current) return;
2603
+ handleCopy();
2604
+ }
2596
2605
  return /* @__PURE__ */ jsxs("dd", {
2597
2606
  ref: ddRef,
2598
2607
  className: cn([
@@ -2601,12 +2610,13 @@ function PropertyListValue({ numeric, copyable, empty, copyValue, className, cla
2601
2610
  copyable && "property-list-value-copyable",
2602
2611
  empty && "property-list-value-empty"
2603
2612
  ], className),
2613
+ onClick: copyable ? handleCellClick : onClick,
2604
2614
  ...rest,
2605
2615
  children: [children, /* @__PURE__ */ jsxs("button", {
2616
+ ref: copyButtonRef,
2606
2617
  type: "button",
2607
2618
  "aria-label": "Copy",
2608
2619
  className: cn("property-list-copy", classNames?.copy),
2609
- onClick: handleCopy,
2610
2620
  "data-copied": copied ? "true" : void 0,
2611
2621
  children: [/* @__PURE__ */ jsx(CopyGlyph, { className: cn("property-list-copy-icon", void 0) }), /* @__PURE__ */ jsx(CheckGlyph, { className: cn("property-list-copy-icon-copied", void 0) })]
2612
2622
  })]