@nexub/patterns 1.4.0 → 1.5.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.
@@ -0,0 +1,60 @@
1
+ 'use client';
2
+
3
+ // src/components/ListDetail/ListDetail.tsx
4
+ import * as React from "react";
5
+ import { IconButton, cn } from "@nexub/react";
6
+ import { ArrowLeft } from "@nexub/icons";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var widths = {
9
+ sm: "[@container(min-width:720px)]:w-72",
10
+ md: "[@container(min-width:720px)]:w-80",
11
+ lg: "[@container(min-width:720px)]:w-[400px]"
12
+ };
13
+ var ListDetail = React.forwardRef(
14
+ ({
15
+ list,
16
+ detail,
17
+ showDetail = false,
18
+ onBack,
19
+ backLabel = "Back",
20
+ listWidth = "md",
21
+ listLabel = "List",
22
+ detailLabel = "Detail",
23
+ className,
24
+ ...props
25
+ }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("h-full [container-type:inline-size]", className), ...props, children: /* @__PURE__ */ jsxs("div", { className: "flex h-full", children: [
26
+ /* @__PURE__ */ jsx(
27
+ "section",
28
+ {
29
+ "aria-label": listLabel,
30
+ className: cn(
31
+ "min-h-0 w-full shrink-0 flex-col overflow-y-auto",
32
+ "[@container(min-width:720px)]:flex [@container(min-width:720px)]:border-r [@container(min-width:720px)]:border-[var(--color-outline-variant)]",
33
+ widths[listWidth],
34
+ showDetail ? "hidden" : "flex"
35
+ ),
36
+ children: list
37
+ }
38
+ ),
39
+ /* @__PURE__ */ jsxs(
40
+ "section",
41
+ {
42
+ "aria-label": detailLabel,
43
+ className: cn(
44
+ "min-h-0 min-w-0 flex-1 flex-col overflow-y-auto",
45
+ "[@container(min-width:720px)]:flex",
46
+ showDetail ? "flex" : "hidden"
47
+ ),
48
+ children: [
49
+ onBack && /* @__PURE__ */ jsx("div", { className: "p-2 [@container(min-width:720px)]:hidden", children: /* @__PURE__ */ jsx(IconButton, { label: backLabel, onClick: onBack, children: /* @__PURE__ */ jsx(ArrowLeft, { size: "md", "aria-hidden": "true" }) }) }),
50
+ detail
51
+ ]
52
+ }
53
+ )
54
+ ] }) })
55
+ );
56
+ ListDetail.displayName = "ListDetail";
57
+
58
+ export {
59
+ ListDetail
60
+ };
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+ import {
3
+ ListDetail
4
+ } from "../../chunk-TLOLIMPY.js";
5
+ export {
6
+ ListDetail
7
+ };
package/dist/index.d.ts CHANGED
@@ -83,6 +83,31 @@ declare const InfoList: {
83
83
  };
84
84
  };
85
85
 
86
+ interface ListDetailProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
87
+ list: React.ReactNode;
88
+ detail: React.ReactNode;
89
+ /**
90
+ * When narrow (one pane at a time), show the detail instead of the list.
91
+ * Set it when an item is selected. Ignored when both panes fit.
92
+ */
93
+ showDetail?: boolean;
94
+ /** Called by the back button, shown only when narrow. Omit to hide it. */
95
+ onBack?: () => void;
96
+ /** @default 'Back' */
97
+ backLabel?: string;
98
+ /** Fixed list width when both panes show. @default 'md' (320px) */
99
+ listWidth?: 'sm' | 'md' | 'lg';
100
+ /** Accessible names for the two regions. */
101
+ listLabel?: string;
102
+ detailLabel?: string;
103
+ }
104
+ /**
105
+ * The M3 list-detail canonical layout. It responds to its *own* width via a
106
+ * container query, not the viewport: at 720px and up the list (fixed width)
107
+ * and detail sit side by side; below that one pane shows at a time.
108
+ */
109
+ declare const ListDetail: React.ForwardRefExoticComponent<ListDetailProps & React.RefAttributes<HTMLDivElement>>;
110
+
86
111
  interface PlanCardProps extends React.HTMLAttributes<HTMLDivElement> {
87
112
  name: string;
88
113
  price: string;
@@ -246,4 +271,4 @@ interface AppHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, 'childr
246
271
  */
247
272
  declare const AppHeader: React.ForwardRefExoticComponent<AppHeaderProps & React.RefAttributes<HTMLElement>>;
248
273
 
249
- export { ActivityFeed, type ActivityItemProps, AppHeader, type AppHeaderOrg, type AppHeaderProps, type AppHeaderSearchGroup, type AppHeaderSearchItem, type AppHeaderUser, AppLauncher, type AppLauncherApp, type AppLauncherProps, AuthCard, type AuthCardProps, FilterBar, type FilterBarProps, InfoList, type InfoListItemProps, type InfoListRootProps, NotificationItem, type NotificationItemProps, PlanCard, type PlanCardProps, SettingsLayout, type SettingsLayoutItem, type SettingsLayoutProps, type SettingsLayoutSectionProps, SettingsRow, type SettingsRowProps, SettingsSection, type SettingsSectionProps, StatCard, type StatCardProps, StepIndicator, type StepIndicatorProps, type StepIndicatorStep, UserCard, type UserCardProps };
274
+ export { ActivityFeed, type ActivityItemProps, AppHeader, type AppHeaderOrg, type AppHeaderProps, type AppHeaderSearchGroup, type AppHeaderSearchItem, type AppHeaderUser, AppLauncher, type AppLauncherApp, type AppLauncherProps, AuthCard, type AuthCardProps, FilterBar, type FilterBarProps, InfoList, type InfoListItemProps, type InfoListRootProps, ListDetail, type ListDetailProps, NotificationItem, type NotificationItemProps, PlanCard, type PlanCardProps, SettingsLayout, type SettingsLayoutItem, type SettingsLayoutProps, type SettingsLayoutSectionProps, SettingsRow, type SettingsRowProps, SettingsSection, type SettingsSectionProps, StatCard, type StatCardProps, StepIndicator, type StepIndicatorProps, type StepIndicatorStep, UserCard, type UserCardProps };
package/dist/index.js CHANGED
@@ -1,11 +1,14 @@
1
1
  'use client';
2
2
  import {
3
- SettingsLayout,
4
- SettingsRow
5
- } from "./chunk-5QFC4WFD.js";
3
+ NotificationItem
4
+ } from "./chunk-Y3TNGDKC.js";
6
5
  import {
7
6
  PlanCard
8
7
  } from "./chunk-QMYBXQG4.js";
8
+ import {
9
+ SettingsLayout,
10
+ SettingsRow
11
+ } from "./chunk-5QFC4WFD.js";
9
12
  import {
10
13
  SettingsSection
11
14
  } from "./chunk-OTNHVOPC.js";
@@ -38,8 +41,8 @@ import {
38
41
  InfoList
39
42
  } from "./chunk-74JVLMLE.js";
40
43
  import {
41
- NotificationItem
42
- } from "./chunk-Y3TNGDKC.js";
44
+ ListDetail
45
+ } from "./chunk-TLOLIMPY.js";
43
46
  export {
44
47
  ActivityFeed,
45
48
  AppHeader,
@@ -47,6 +50,7 @@ export {
47
50
  AuthCard,
48
51
  FilterBar,
49
52
  InfoList,
53
+ ListDetail,
50
54
  NotificationItem,
51
55
  PlanCard,
52
56
  SettingsLayout,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexub/patterns",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "description": "Composite UI patterns for Nexub Design System — pre-built, production-ready layouts and widgets built on @nexub/react.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,9 +36,9 @@
36
36
  "peerDependencies": {
37
37
  "react": ">=18 <20",
38
38
  "react-dom": ">=18 <20",
39
- "@nexub/react": "^1.4.0",
40
- "@nexub/icons": "^1.4.0",
41
- "@nexub/tokens": "^1.4.0"
39
+ "@nexub/react": "^1.5.1",
40
+ "@nexub/icons": "^1.5.1",
41
+ "@nexub/tokens": "^1.5.1"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "@nexub/icons": {
@@ -58,9 +58,9 @@
58
58
  "tsup": "^8.3.5",
59
59
  "typescript": "^5.6.3",
60
60
  "vitest": "^2.1.8",
61
- "@nexub/icons": "1.4.0",
62
- "@nexub/react": "1.4.0",
63
- "@nexub/tokens": "1.4.0"
61
+ "@nexub/icons": "1.5.1",
62
+ "@nexub/react": "1.5.1",
63
+ "@nexub/tokens": "1.5.1"
64
64
  },
65
65
  "scripts": {
66
66
  "build": "tsup",