@peasant-labs/fairtrade 0.0.30 → 0.0.32

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,215 @@
1
+ /**
2
+ * The shared app sidebar: brand, collapse toggle, the caller's nav groups, the online / local /
3
+ * docs app switcher and an account row. A sticky resizable column on desktop that collapses to an
4
+ * icon rail; a top bar plus an opaque drawer below 768px.
5
+ * @param {AppSidebarProps} props
6
+ */
7
+ export default function AppSidebar({ app, apps, groups, currentId, homeHref, brand, account, accountSlot, LinkComponent, storageKey, defaultCollapsed, defaultWidth, minWidth, maxWidth, onCollapsedChange, label, className, }: AppSidebarProps): import("react").JSX.Element;
8
+ /**
9
+ * The page frame for an app screen: the sidebar column beside a main column that takes the rest
10
+ * (min-width 0, so wide content stays contained). One column below 768px, the top bar above the page.
11
+ * @param {AppSidebarLayoutProps} props
12
+ */
13
+ export function AppSidebarLayout({ sidebar, children, className }: AppSidebarLayoutProps): import("react").JSX.Element;
14
+ /**
15
+ * @typedef {Object} AppSidebarApp
16
+ * @property {string} id 'online' | 'local' | 'docs', or another app id (shown with a generic icon).
17
+ * @property {string} label the switcher label.
18
+ * @property {string} [href] where the app lives. A non-current app without an href is omitted.
19
+ * @property {string} [target]
20
+ * @property {string} [rel]
21
+ */
22
+ /**
23
+ * @typedef {Object} AppSidebarItem
24
+ * @property {string} id
25
+ * @property {string} label rendered as given (never lowercased: it may be user content).
26
+ * @property {string} [href] renders a link (or `LinkComponent`).
27
+ * @property {(id: string) => void} [onSelect] with no href, renders a button that calls this.
28
+ * @property {import('react').ComponentType<any>} [icon] a lucide icon component.
29
+ * @property {string} [swatch] a CSS colour for a 12px square in place of an icon, e.g. 'var(--olive)'.
30
+ * @property {boolean} [external] the item leaves this app: a trailing marker and a spoken suffix.
31
+ * @property {string} [title] tooltip; defaults to the label.
32
+ * @property {0|1} [depth] 1 indents the item under the one above it.
33
+ * @property {string} [target]
34
+ * @property {string} [rel]
35
+ */
36
+ /**
37
+ * @typedef {Object} AppSidebarGroup
38
+ * @property {string} id
39
+ * @property {string} [label] a visible group label, shown only while expanded.
40
+ * @property {string} [ariaLabel] the nav landmark name; defaults to the label, then the id.
41
+ * @property {AppSidebarItem[]} items
42
+ */
43
+ /**
44
+ * @typedef {Object} AppSidebarAccount
45
+ * @property {string} handle shown as @handle; its first letter fills the square avatar.
46
+ * @property {string} [href] makes the account row a link.
47
+ */
48
+ /**
49
+ * @typedef {Object} AppSidebarProps
50
+ * @property {'online'|'local'|'docs'|string} app which app renders the sidebar; marks its switcher entry current.
51
+ * @property {AppSidebarApp[]} [apps] the app switcher entries (default APP_SIDEBAR_APPS, no hrefs).
52
+ * @property {AppSidebarGroup[]} groups
53
+ * @property {string} [currentId] the id of the current item (aria-current="page").
54
+ * @property {string} [homeHref] the brand links here.
55
+ * @property {string} [brand] the wordmark, default 'peasant'.
56
+ * @property {AppSidebarAccount} [account]
57
+ * @property {import('react').ReactNode} [accountSlot] replaces the default account row content.
58
+ * @property {import('react').ComponentType<any>} [LinkComponent] a router link; receives href, className,
59
+ * aria-current, title, target, rel, onClick and children.
60
+ * @property {string|null} [storageKey] localStorage key prefix, default 'fairtrade.app-sidebar'; null disables persistence.
61
+ * @property {boolean} [defaultCollapsed]
62
+ * @property {number} [defaultWidth] px, default 248.
63
+ * @property {number} [minWidth] px, default 200.
64
+ * @property {number} [maxWidth] px, default 360.
65
+ * @property {(collapsed: boolean) => void} [onCollapsedChange]
66
+ * @property {string} [label] the aside's accessible name, default 'peasant'.
67
+ * @property {string} [className]
68
+ */
69
+ /**
70
+ * @typedef {Object} AppSidebarLayoutProps
71
+ * @property {import('react').ReactNode} sidebar an <AppSidebar>.
72
+ * @property {import('react').ReactNode} children the page body.
73
+ * @property {string} [className]
74
+ */
75
+ /** The app switcher's default entries, in order. Consumers map their hrefs in.
76
+ * @type {ReadonlyArray<Readonly<AppSidebarApp>>} */
77
+ export const APP_SIDEBAR_APPS: ReadonlyArray<Readonly<AppSidebarApp>>;
78
+ export type AppSidebarApp = {
79
+ /**
80
+ * 'online' | 'local' | 'docs', or another app id (shown with a generic icon).
81
+ */
82
+ id: string;
83
+ /**
84
+ * the switcher label.
85
+ */
86
+ label: string;
87
+ /**
88
+ * where the app lives. A non-current app without an href is omitted.
89
+ */
90
+ href?: string;
91
+ target?: string;
92
+ rel?: string;
93
+ };
94
+ export type AppSidebarItem = {
95
+ id: string;
96
+ /**
97
+ * rendered as given (never lowercased: it may be user content).
98
+ */
99
+ label: string;
100
+ /**
101
+ * renders a link (or `LinkComponent`).
102
+ */
103
+ href?: string;
104
+ /**
105
+ * with no href, renders a button that calls this.
106
+ */
107
+ onSelect?: (id: string) => void;
108
+ /**
109
+ * a lucide icon component.
110
+ */
111
+ icon?: import("react").ComponentType<any>;
112
+ /**
113
+ * a CSS colour for a 12px square in place of an icon, e.g. 'var(--olive)'.
114
+ */
115
+ swatch?: string;
116
+ /**
117
+ * the item leaves this app: a trailing marker and a spoken suffix.
118
+ */
119
+ external?: boolean;
120
+ /**
121
+ * tooltip; defaults to the label.
122
+ */
123
+ title?: string;
124
+ /**
125
+ * 1 indents the item under the one above it.
126
+ */
127
+ depth?: 0 | 1;
128
+ target?: string;
129
+ rel?: string;
130
+ };
131
+ export type AppSidebarGroup = {
132
+ id: string;
133
+ /**
134
+ * a visible group label, shown only while expanded.
135
+ */
136
+ label?: string;
137
+ /**
138
+ * the nav landmark name; defaults to the label, then the id.
139
+ */
140
+ ariaLabel?: string;
141
+ items: AppSidebarItem[];
142
+ };
143
+ export type AppSidebarAccount = {
144
+ /**
145
+ * shown as
146
+ */
147
+ handle: string;
148
+ };
149
+ export type AppSidebarProps = {
150
+ /**
151
+ * which app renders the sidebar; marks its switcher entry current.
152
+ */
153
+ app: "online" | "local" | "docs" | string;
154
+ /**
155
+ * the app switcher entries (default APP_SIDEBAR_APPS, no hrefs).
156
+ */
157
+ apps?: AppSidebarApp[];
158
+ groups: AppSidebarGroup[];
159
+ /**
160
+ * the id of the current item (aria-current="page").
161
+ */
162
+ currentId?: string;
163
+ /**
164
+ * the brand links here.
165
+ */
166
+ homeHref?: string;
167
+ /**
168
+ * the wordmark, default 'peasant'.
169
+ */
170
+ brand?: string;
171
+ account?: AppSidebarAccount;
172
+ /**
173
+ * replaces the default account row content.
174
+ */
175
+ accountSlot?: import("react").ReactNode;
176
+ /**
177
+ * a router link; receives href, className,
178
+ * aria-current, title, target, rel, onClick and children.
179
+ */
180
+ LinkComponent?: import("react").ComponentType<any>;
181
+ /**
182
+ * localStorage key prefix, default 'fairtrade.app-sidebar'; null disables persistence.
183
+ */
184
+ storageKey?: string | null;
185
+ defaultCollapsed?: boolean;
186
+ /**
187
+ * px, default 248.
188
+ */
189
+ defaultWidth?: number;
190
+ /**
191
+ * px, default 200.
192
+ */
193
+ minWidth?: number;
194
+ /**
195
+ * px, default 360.
196
+ */
197
+ maxWidth?: number;
198
+ onCollapsedChange?: (collapsed: boolean) => void;
199
+ /**
200
+ * the aside's accessible name, default 'peasant'.
201
+ */
202
+ label?: string;
203
+ className?: string;
204
+ };
205
+ export type AppSidebarLayoutProps = {
206
+ /**
207
+ * an <AppSidebar>.
208
+ */
209
+ sidebar: import("react").ReactNode;
210
+ /**
211
+ * the page body.
212
+ */
213
+ children: import("react").ReactNode;
214
+ className?: string;
215
+ };
@@ -31,6 +31,12 @@ export { default as VillageObservations } from "./VillageObservations.jsx";
31
31
  export * from "./transcript/index.js";
32
32
  export * from "./transcript/graph/index.js";
33
33
  export type TimelineNavigationAction = import("./graph/timelineNavigation.js").TimelineNavigationAction;
34
+ export type AppSidebarProps = import("./AppSidebar.jsx").AppSidebarProps;
35
+ export type AppSidebarLayoutProps = import("./AppSidebar.jsx").AppSidebarLayoutProps;
36
+ export type AppSidebarGroup = import("./AppSidebar.jsx").AppSidebarGroup;
37
+ export type AppSidebarItem = import("./AppSidebar.jsx").AppSidebarItem;
38
+ export type AppSidebarApp = import("./AppSidebar.jsx").AppSidebarApp;
39
+ export type AppSidebarAccount = import("./AppSidebar.jsx").AppSidebarAccount;
34
40
  export type VillageObservationsProps = import("./VillageObservations.jsx").VillageObservationsProps;
35
41
  export type ObservationDomain = import("./VillageObservations.jsx").ObservationDomain;
36
42
  export type ObservedCollective = import("./VillageObservations.jsx").ObservedCollective;
@@ -61,6 +67,7 @@ export { default as ConsentDialog, ConsentSummary } from "./ConsentDialog.jsx";
61
67
  export { default as ModerationQueue, ApprovalBar } from "./ModerationQueue.jsx";
62
68
  export { default as RoleRoster, ConfirmInline, DangerZone } from "./RoleRoster.jsx";
63
69
  export { default as RailShell, RailSection, SplitRail } from "./RailShell.jsx";
70
+ export { default as AppSidebar, AppSidebarLayout, APP_SIDEBAR_APPS } from "./AppSidebar.jsx";
64
71
  export { default as ProviderIcon, ProviderTag, ProviderName, AccentLegend, PROVIDER_ACCENT } from "./ProviderIcon.jsx";
65
72
  export { default as EvidenceCaption, EvidenceTarget } from "./EvidenceCaption.jsx";
66
73
  export { PhaseDivider, Phase, TaskBoundary, CheckpointMarker, TurnContextBar } from "./TranscriptMarkers.jsx";