@loykin/designkit 0.0.2 → 0.0.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.cjs CHANGED
@@ -2826,6 +2826,56 @@ function isDataBodySummary(node) {
2826
2826
  node && typeof node === "object" && "type" in node && node.type === DataBodySummary
2827
2827
  );
2828
2828
  }
2829
+ function DataBodyResource({
2830
+ toolbarLeft,
2831
+ toolbarRight,
2832
+ refreshing,
2833
+ refreshingLabel = "Refreshing",
2834
+ notice,
2835
+ footer,
2836
+ children,
2837
+ className,
2838
+ bodyClassName
2839
+ }) {
2840
+ useDataBodyTemplateParent("Resource");
2841
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2842
+ "section",
2843
+ {
2844
+ "data-slot": "data-body-resource",
2845
+ "data-refreshing": refreshing ? "true" : "false",
2846
+ className: cn("flex min-h-0 flex-col", className),
2847
+ children: [
2848
+ (toolbarLeft || toolbarRight || refreshing) && /* @__PURE__ */ jsxRuntime.jsxs(DataPage.GroupToolbar, { children: [
2849
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: toolbarLeft }),
2850
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
2851
+ refreshing && /* @__PURE__ */ jsxRuntime.jsxs(
2852
+ "span",
2853
+ {
2854
+ className: "flex items-center gap-1.5 text-xs text-muted-foreground",
2855
+ role: "status",
2856
+ children: [
2857
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-3 animate-spin rounded-full border-2 border-muted border-t-primary" }),
2858
+ refreshingLabel
2859
+ ]
2860
+ }
2861
+ ),
2862
+ /* @__PURE__ */ jsxRuntime.jsx(DataPage.Actions, { children: toolbarRight })
2863
+ ] })
2864
+ ] }),
2865
+ notice && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-3 shrink-0", children: notice }),
2866
+ /* @__PURE__ */ jsxRuntime.jsx(DataPage.GroupBody, { className: cn("min-h-0 flex-1", bodyClassName), children }),
2867
+ footer && /* @__PURE__ */ jsxRuntime.jsx(
2868
+ "div",
2869
+ {
2870
+ className: "mt-3 shrink-0 border-t border-border pt-3",
2871
+ "data-slot": "data-body-resource-footer",
2872
+ children: footer
2873
+ }
2874
+ )
2875
+ ]
2876
+ }
2877
+ );
2878
+ }
2829
2879
  var layoutDefaultVariant = {
2830
2880
  stacked: "plain",
2831
2881
  horizontal: "card",
@@ -3015,7 +3065,13 @@ function RootContent({
3015
3065
  /* @__PURE__ */ jsxRuntime.jsx(DataPage.Actions, { children: actions })
3016
3066
  ] }),
3017
3067
  summaryEl && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 border-b border-border px-(--designkit-page-padding-x) py-(--designkit-panel-gap)", children: summaryEl.props.children }),
3018
- /* @__PURE__ */ jsxRuntime.jsx(DataPage.Content, { className: contentClassName, children: /* @__PURE__ */ jsxRuntime.jsx(DataPage.Group, { className: "h-full", children: /* @__PURE__ */ jsxRuntime.jsx(DataPage.GroupBody, { className: cn("h-full", bodyEl.props.className), children: bodyEl.props.children }) }) })
3068
+ /* @__PURE__ */ jsxRuntime.jsx(DataPage.Content, { className: contentClassName, children: /* @__PURE__ */ jsxRuntime.jsxs(DataPage.Group, { className: "flex h-full flex-col", children: [
3069
+ (toolbarLeft || toolbarRight) && /* @__PURE__ */ jsxRuntime.jsxs(DataPage.GroupToolbar, { children: [
3070
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 items-center gap-2", children: toolbarLeft }),
3071
+ /* @__PURE__ */ jsxRuntime.jsx(DataPage.Actions, { children: toolbarRight })
3072
+ ] }),
3073
+ /* @__PURE__ */ jsxRuntime.jsx(DataPage.GroupBody, { className: cn("min-h-0 flex-1", bodyEl.props.className), children: bodyEl.props.children })
3074
+ ] }) })
3019
3075
  ] });
3020
3076
  }
3021
3077
  if (hasSections) {
@@ -3054,6 +3110,8 @@ function RootContent({
3054
3110
  ] });
3055
3111
  }
3056
3112
  const activeTabNode = tabs.find((tab) => tab.props.id === activeId) ?? tabs[0];
3113
+ const activeToolbarLeft = activeTabNode?.props.toolbarLeft ?? toolbarLeft;
3114
+ const activeToolbarRight = activeTabNode?.props.toolbarRight ?? toolbarRight;
3057
3115
  return /* @__PURE__ */ jsxRuntime.jsxs(DataPage, { className: cn("layout-databody", className), style: theme, children: [
3058
3116
  /* @__PURE__ */ jsxRuntime.jsx(TopBarSlot, { topBar }),
3059
3117
  /* @__PURE__ */ jsxRuntime.jsxs(DataPage.Header, { children: [
@@ -3073,12 +3131,13 @@ function RootContent({
3073
3131
  tab.props.id
3074
3132
  )) }),
3075
3133
  /* @__PURE__ */ jsxRuntime.jsxs(DataPage.Content, { className: contentClassName, children: [
3076
- (toolbarLeft || toolbarRight) && /* @__PURE__ */ jsxRuntime.jsxs(DataPage.GroupToolbar, { children: [
3077
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 items-center gap-2", children: toolbarLeft }),
3078
- /* @__PURE__ */ jsxRuntime.jsx(DataPage.Actions, { children: toolbarRight })
3134
+ (activeToolbarLeft || activeToolbarRight) && /* @__PURE__ */ jsxRuntime.jsxs(DataPage.GroupToolbar, { children: [
3135
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 items-center gap-2", children: activeToolbarLeft }),
3136
+ /* @__PURE__ */ jsxRuntime.jsx(DataPage.Actions, { children: activeToolbarRight })
3079
3137
  ] }),
3080
3138
  hasTabs ? /* @__PURE__ */ jsxRuntime.jsx(DataPage.GroupBody, { className: "min-h-full", children: renderGroups(activeTabNode?.props.children) }) : /* @__PURE__ */ jsxRuntime.jsx(DataPage.GroupBody, { children: bodyChildren.map((child, i) => /* @__PURE__ */ jsxRuntime.jsx(React2.Fragment, { children: isDataBodyGroup(child) ? renderGroup(child) : child }, i)) })
3081
- ] })
3139
+ ] }),
3140
+ activeTabNode?.props.footer && /* @__PURE__ */ jsxRuntime.jsx(DataPage.Footer, { children: activeTabNode.props.footer })
3082
3141
  ] });
3083
3142
  }
3084
3143
  function Root2(props) {
@@ -3089,6 +3148,7 @@ var DataBodyTemplate = Object.assign(Root2, {
3089
3148
  Tab: DataBodyTab,
3090
3149
  Section: DataBodySection,
3091
3150
  Summary: DataBodySummary,
3151
+ Resource: DataBodyResource,
3092
3152
  Group: DataBodyGroup,
3093
3153
  Row: DataBodyRow,
3094
3154
  Field: DataBodyField