@proveanything/smartlinks-utils-ui 0.10.4 → 0.10.6
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/components/AssetPicker/index.css +33 -0
- package/dist/components/AssetPicker/index.css.map +1 -1
- package/dist/components/ConditionsEditor/index.css +33 -0
- package/dist/components/ConditionsEditor/index.css.map +1 -1
- package/dist/components/FontPicker/index.css +33 -0
- package/dist/components/FontPicker/index.css.map +1 -1
- package/dist/components/IconPicker/index.css +33 -0
- package/dist/components/IconPicker/index.css.map +1 -1
- package/dist/components/RecordsAdmin/index.css +33 -0
- package/dist/components/RecordsAdmin/index.css.map +1 -1
- package/dist/components/RecordsAdmin/index.d.ts +11 -2
- package/dist/components/RecordsAdmin/index.js +28 -5
- package/dist/components/RecordsAdmin/index.js.map +1 -1
- package/dist/index.css +33 -0
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -2924,9 +2924,10 @@ function useEditorBridge(args) {
|
|
|
2924
2924
|
}
|
|
2925
2925
|
if (isEqualSpec(target, lastTargetRef.current)) return;
|
|
2926
2926
|
lastTargetRef.current = target;
|
|
2927
|
+
const isCreate = !!target.createMode;
|
|
2927
2928
|
const id = selection.selectTarget({
|
|
2928
2929
|
spec: target,
|
|
2929
|
-
seed: resolved.source === "empty" ? void 0 : {
|
|
2930
|
+
seed: isCreate || resolved.source === "empty" ? void 0 : {
|
|
2930
2931
|
value: resolved.data ?? (defaultData?.() ?? null),
|
|
2931
2932
|
facetRule: resolved.facetRule ?? null,
|
|
2932
2933
|
source: resolved.source,
|
|
@@ -2941,8 +2942,9 @@ function useEditorBridge(args) {
|
|
|
2941
2942
|
const id = editorIdRef.current;
|
|
2942
2943
|
if (!id) return;
|
|
2943
2944
|
if (resolved.source === "empty" && !resolved.recordId) return;
|
|
2945
|
+
if (target?.createMode) return;
|
|
2944
2946
|
selection.hydrate(id, resolved);
|
|
2945
|
-
}, [resolved.source, resolved.recordId, resolved.sourceRef, resolved.data, resolved.facetRule]);
|
|
2947
|
+
}, [resolved.source, resolved.recordId, resolved.sourceRef, resolved.data, resolved.facetRule, target?.createMode]);
|
|
2946
2948
|
const editorId = selection.currentEditorId ?? editorIdRef.current;
|
|
2947
2949
|
const session = useEditorSession(editorId);
|
|
2948
2950
|
const prevStatusRef = useRef(null);
|
|
@@ -3028,7 +3030,7 @@ function useShellEditorTarget(args) {
|
|
|
3028
3030
|
} = args;
|
|
3029
3031
|
const editorTargetSpec = useMemo(() => {
|
|
3030
3032
|
if (!editingTargetScope) return null;
|
|
3031
|
-
const initialFacetRule = editingTargetScope.kind === "rule" ? ruleWizardStep === 2 && ruleWizardRule ? ruleWizardRule : resolved.facetRule ?? { all: [] } : ruleWizardStep === 2 && ruleWizardRule && isCollection && !!selectedItemId ? ruleWizardRule : null;
|
|
3033
|
+
const initialFacetRule = editingTargetScope.kind === "rule" ? ruleWizardStep === 2 && ruleWizardRule ? ruleWizardRule : resolved.facetRule ?? { all: [] } : ruleWizardStep === 2 && ruleWizardRule && isCollection && !!selectedItemId ? ruleWizardRule : isCollection && !!selectedItemId && isDraftId2(selectedItemId) ? resolved.facetRule ?? null : null;
|
|
3032
3034
|
const label = deriveDraftLabel ? deriveDraftLabel(resolved.data, editingTargetScope) : void 0;
|
|
3033
3035
|
const rawScope = editingTargetScope.raw ?? "";
|
|
3034
3036
|
const isDraftScope = rawScope.includes("__draft__") || rawScope.includes("item:draft:");
|
|
@@ -6039,11 +6041,14 @@ function SiblingRail({
|
|
|
6039
6041
|
onSelect,
|
|
6040
6042
|
contextKind,
|
|
6041
6043
|
contextSummary,
|
|
6044
|
+
onCreate,
|
|
6045
|
+
itemNoun,
|
|
6042
6046
|
dirtyKeys,
|
|
6043
6047
|
errorKeys,
|
|
6044
6048
|
i18n
|
|
6045
6049
|
}) {
|
|
6046
6050
|
const ruleLabelLookup = useRuleLabelLookup();
|
|
6051
|
+
const newLabel = i18n.newItem.includes("{noun}") ? i18n.newItem.replace("{noun}", itemNoun ?? "item") : i18n.newItem;
|
|
6047
6052
|
return /* @__PURE__ */ jsxs("div", { className: "ra-sibling-rail", children: [
|
|
6048
6053
|
(onBack || contextKind) && /* @__PURE__ */ jsxs("div", { className: "ra-sibling-context", children: [
|
|
6049
6054
|
onBack && /* @__PURE__ */ jsx(
|
|
@@ -6119,7 +6124,20 @@ function SiblingRail({
|
|
|
6119
6124
|
}
|
|
6120
6125
|
) }, key);
|
|
6121
6126
|
}) })
|
|
6122
|
-
] })
|
|
6127
|
+
] }),
|
|
6128
|
+
onCreate && /* @__PURE__ */ jsx("div", { className: "ra-sibling-footer", children: /* @__PURE__ */ jsxs(
|
|
6129
|
+
"button",
|
|
6130
|
+
{
|
|
6131
|
+
type: "button",
|
|
6132
|
+
onClick: onCreate,
|
|
6133
|
+
className: "ra-sibling-create",
|
|
6134
|
+
title: newLabel,
|
|
6135
|
+
children: [
|
|
6136
|
+
/* @__PURE__ */ jsx(Plus, { className: "w-3.5 h-3.5", "aria-hidden": "true" }),
|
|
6137
|
+
/* @__PURE__ */ jsx("span", { children: newLabel })
|
|
6138
|
+
]
|
|
6139
|
+
}
|
|
6140
|
+
) })
|
|
6123
6141
|
] });
|
|
6124
6142
|
}
|
|
6125
6143
|
var TONE_ICON = {
|
|
@@ -7777,7 +7795,7 @@ function RecordsAdminShellInner(props) {
|
|
|
7777
7795
|
setDraftKind(null);
|
|
7778
7796
|
}
|
|
7779
7797
|
if (isCreate && selectedRecordId === DRAFT_ID3) {
|
|
7780
|
-
setSelectedRecordId(null);
|
|
7798
|
+
setSelectedRecordId(savedRecordId ?? null);
|
|
7781
7799
|
setDraftKind(null);
|
|
7782
7800
|
}
|
|
7783
7801
|
if (isCreate && isCollection && savedRecordId && isDraftId3(selectedItemId)) {
|
|
@@ -7793,6 +7811,9 @@ function RecordsAdminShellInner(props) {
|
|
|
7793
7811
|
setSelectedVariantId(void 0);
|
|
7794
7812
|
} else if (drillTab === "batch") {
|
|
7795
7813
|
setSelectedBatchId(void 0);
|
|
7814
|
+
} else if (selectedRecordId) {
|
|
7815
|
+
setSelectedRecordId(null);
|
|
7816
|
+
setDraftKind(null);
|
|
7796
7817
|
}
|
|
7797
7818
|
refetchAll();
|
|
7798
7819
|
}
|
|
@@ -8597,6 +8618,8 @@ function RecordsAdminShellInner(props) {
|
|
|
8597
8618
|
error: collectionItems.error,
|
|
8598
8619
|
onBack: onItemBack,
|
|
8599
8620
|
onSelect: onItemOpen,
|
|
8621
|
+
onCreate: onItemCreate,
|
|
8622
|
+
itemNoun: itemNounLabel,
|
|
8600
8623
|
dirtyKeys,
|
|
8601
8624
|
errorKeys,
|
|
8602
8625
|
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,
|