@proveanything/smartlinks-utils-ui 0.10.4 → 0.10.5

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.
@@ -2458,6 +2458,15 @@ interface Props<T> {
2458
2458
  contextKind?: string;
2459
2459
  contextSummary?: string | null;
2460
2460
  onSelect: (itemId: string) => void;
2461
+ /**
2462
+ * Optional sticky "+ New {noun}" affordance pinned to the bottom of the
2463
+ * rail. When supplied the rail renders a footer button that calls this
2464
+ * callback. Mirrors the toolbar `+ New` in the list view so admins can
2465
+ * add another record without first navigating back to the list.
2466
+ */
2467
+ onCreate?: () => void;
2468
+ /** Noun used in the "+ New {noun}" footer label. */
2469
+ itemNoun?: string;
2461
2470
  /**
2462
2471
  * Set of keys (recordIds + scope refs) currently dirty in the shell-level
2463
2472
  * draft store. Used to paint a per-row pip on items the user has edited
@@ -2467,9 +2476,9 @@ interface Props<T> {
2467
2476
  dirtyKeys?: ReadonlySet<string>;
2468
2477
  /** Subset of `dirtyKeys` whose last save attempt failed. */
2469
2478
  errorKeys?: ReadonlySet<string>;
2470
- i18n: Pick<RecordsAdminI18n, 'backToScopes' | 'siblingsHeading' | 'noItemsTitle' | 'noItemsBody' | 'backToList'>;
2479
+ i18n: Pick<RecordsAdminI18n, 'backToScopes' | 'siblingsHeading' | 'noItemsTitle' | 'noItemsBody' | 'backToList' | 'newItem'>;
2471
2480
  }
2472
- declare function SiblingRail<T>({ items, selectedItemId, isLoading, error, onBack, onSelect, contextKind, contextSummary, dirtyKeys, errorKeys, i18n, }: Props<T>): react_jsx_runtime.JSX.Element;
2481
+ declare function SiblingRail<T>({ items, selectedItemId, isLoading, error, onBack, onSelect, contextKind, contextSummary, onCreate, itemNoun, dirtyKeys, errorKeys, i18n, }: Props<T>): react_jsx_runtime.JSX.Element;
2473
2482
 
2474
2483
  interface ClipboardEntry<T = unknown> {
2475
2484
  value: T;
@@ -6039,11 +6039,14 @@ function SiblingRail({
6039
6039
  onSelect,
6040
6040
  contextKind,
6041
6041
  contextSummary,
6042
+ onCreate,
6043
+ itemNoun,
6042
6044
  dirtyKeys,
6043
6045
  errorKeys,
6044
6046
  i18n
6045
6047
  }) {
6046
6048
  const ruleLabelLookup = useRuleLabelLookup();
6049
+ const newLabel = i18n.newItem.includes("{noun}") ? i18n.newItem.replace("{noun}", itemNoun ?? "item") : i18n.newItem;
6047
6050
  return /* @__PURE__ */ jsxs("div", { className: "ra-sibling-rail", children: [
6048
6051
  (onBack || contextKind) && /* @__PURE__ */ jsxs("div", { className: "ra-sibling-context", children: [
6049
6052
  onBack && /* @__PURE__ */ jsx(
@@ -6119,7 +6122,20 @@ function SiblingRail({
6119
6122
  }
6120
6123
  ) }, key);
6121
6124
  }) })
6122
- ] })
6125
+ ] }),
6126
+ onCreate && /* @__PURE__ */ jsx("div", { className: "ra-sibling-footer", children: /* @__PURE__ */ jsxs(
6127
+ "button",
6128
+ {
6129
+ type: "button",
6130
+ onClick: onCreate,
6131
+ className: "ra-sibling-create",
6132
+ title: newLabel,
6133
+ children: [
6134
+ /* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5", "aria-hidden": "true" }),
6135
+ /* @__PURE__ */ jsx("span", { children: newLabel })
6136
+ ]
6137
+ }
6138
+ ) })
6123
6139
  ] });
6124
6140
  }
6125
6141
  var TONE_ICON = {
@@ -8597,6 +8613,8 @@ function RecordsAdminShellInner(props) {
8597
8613
  error: collectionItems.error,
8598
8614
  onBack: onItemBack,
8599
8615
  onSelect: onItemOpen,
8616
+ onCreate: onItemCreate,
8617
+ itemNoun: itemNounLabel,
8600
8618
  dirtyKeys,
8601
8619
  errorKeys,
8602
8620
  contextKind: activeScope === "rule" ? "Rule" : activeScope === "product" ? "Product" : activeScope === "collection" ? "Global" : activeScope === "all" ? "All records" : activeScope === "variant" ? "Variant" : activeScope === "batch" ? "Batch" : activeScope === "facet" ? "Facet" : void 0,