@peasant-labs/fairtrade 0.0.27 → 0.0.29
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/README.md +30 -0
- package/dist/lib/commons.js +217 -208
- package/dist/lib/components.css +1 -1
- package/dist/lib/types/DataTable.d.ts +19 -12
- package/dist/lib/types/DataTableControls.d.ts +44 -0
- package/dist/lib/types/Publish.d.ts +6 -4
- package/dist/lib/types/Redaction.d.ts +12 -10
- package/dist/lib/types/index.d.ts +2 -0
- package/dist/lib/types/redaction-categories.d.ts +0 -15
- package/dist/lib/{ui-Y-iKXft1.js → ui-kyAEj4Vo.js} +1381 -1341
- package/dist/lib/ui.js +4 -4
- package/package.json +5 -5
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* a sortable + selectable data table. square, hairline, mono headers; both themes
|
|
3
3
|
* via tokens. sort + selection state/logic are powered by TanStack Table
|
|
4
4
|
* (@tanstack/react-table, headless) while this component still renders its own markup
|
|
5
|
-
* + token classes. Search
|
|
6
|
-
*
|
|
5
|
+
* + token classes. Search and filter controls are opt-in toolbar content. Pagination
|
|
6
|
+
* is enabled only by explicit pagination/defaultPagination props. Sorting cycles none -> asc -> desc -> none on a
|
|
7
7
|
* sortable header (a real <button>, so it is keyboard-operable), exposes aria-sort on the
|
|
8
8
|
* <th>, and shows a lucide chevron indicator. selection reuses the existing .check-box control:
|
|
9
9
|
* a header checkbox selects/clears all (with an indeterminate middle state) and
|
|
@@ -47,11 +47,14 @@
|
|
|
47
47
|
* @param {DataTableColumnFilters} [props.defaultColumnFilters=[]] initial column filters.
|
|
48
48
|
* @param {(next: DataTableColumnFilters) => void} [props.onColumnFiltersChange] next filters.
|
|
49
49
|
* @param {DataTablePagination} [props.pagination] controlled pagination (zero-based pageIndex).
|
|
50
|
-
* @param {DataTablePagination} [props.defaultPagination]
|
|
50
|
+
* @param {DataTablePagination} [props.defaultPagination] enables local pagination with this initial state.
|
|
51
51
|
* @param {(next: DataTablePagination) => void} [props.onPaginationChange] next pagination.
|
|
52
52
|
* @param {number} [props.rowCount] host total for host-sliced data: pagination stays manual (the page count comes from rowCount) and sorting stays local, while search and column filters still apply to the rows given; with a partial window and an active filter the footer reports the loaded rows, never the host total.
|
|
53
|
+
* @param {(controls: Parameters<typeof import('./DataTableControls.jsx').DataTableToolbar>[0]) => React.ReactNode} [props.toolbar] optional controls; render DataTableToolbar or importer-owned content.
|
|
54
|
+
* @param {(controls: Parameters<typeof DataTablePaginationControls>[0]) => React.ReactNode} [props.footer] optional footer; replaces the default pager when pagination is enabled.
|
|
55
|
+
* @param {React.CSSProperties['maxHeight']} [props.maxHeight] explicit inner scroll bound; natural height when omitted.
|
|
53
56
|
*/
|
|
54
|
-
export default function DataTable({ columns, rows, selectable, disabled, rowKey, defaultSort, sort: sortProp, onSortChange, defaultSelectedKeys, selectedKeys: selectedProp, onSelectionChange, caption, className, search: searchProp, defaultSearch, onSearchChange, columnFilters: filtersProp, defaultColumnFilters, onColumnFiltersChange, pagination: paginationProp, defaultPagination, onPaginationChange, rowCount, }: {
|
|
57
|
+
export default function DataTable({ columns, rows, selectable, disabled, rowKey, defaultSort, sort: sortProp, onSortChange, defaultSelectedKeys, selectedKeys: selectedProp, onSelectionChange, caption, className, search: searchProp, defaultSearch, onSearchChange, columnFilters: filtersProp, defaultColumnFilters, onColumnFiltersChange, pagination: paginationProp, defaultPagination, onPaginationChange, rowCount, toolbar, footer, maxHeight, }: {
|
|
55
58
|
columns: DataTableColumn[];
|
|
56
59
|
rows: any[];
|
|
57
60
|
selectable?: boolean;
|
|
@@ -75,13 +78,16 @@ export default function DataTable({ columns, rows, selectable, disabled, rowKey,
|
|
|
75
78
|
defaultPagination?: DataTablePagination;
|
|
76
79
|
onPaginationChange?: (next: DataTablePagination) => void;
|
|
77
80
|
rowCount?: number;
|
|
81
|
+
toolbar?: (controls: Parameters<typeof import("./DataTableControls.jsx").DataTableToolbar>[0]) => React.ReactNode;
|
|
82
|
+
footer?: (controls: Parameters<typeof DataTablePaginationControls>[0]) => React.ReactNode;
|
|
83
|
+
maxHeight?: React.CSSProperties["maxHeight"];
|
|
78
84
|
}): import("react").JSX.Element;
|
|
79
85
|
/**
|
|
80
86
|
* a sortable + selectable data table. square, hairline, mono headers; both themes
|
|
81
87
|
* via tokens. sort + selection state/logic are powered by TanStack Table
|
|
82
88
|
* (@tanstack/react-table, headless) while this component still renders its own markup
|
|
83
|
-
* + token classes. Search
|
|
84
|
-
*
|
|
89
|
+
* + token classes. Search and filter controls are opt-in toolbar content. Pagination
|
|
90
|
+
* is enabled only by explicit pagination/defaultPagination props. Sorting cycles none -> asc -> desc -> none on a
|
|
85
91
|
* sortable header (a real <button>, so it is keyboard-operable), exposes aria-sort on the
|
|
86
92
|
* <th>, and shows a lucide chevron indicator. selection reuses the existing .check-box control:
|
|
87
93
|
* a header checkbox selects/clears all (with an indeterminate middle state) and
|
|
@@ -122,8 +128,8 @@ export type DataTableColumn = {
|
|
|
122
128
|
* a sortable + selectable data table. square, hairline, mono headers; both themes
|
|
123
129
|
* via tokens. sort + selection state/logic are powered by TanStack Table
|
|
124
130
|
* (@tanstack/react-table, headless) while this component still renders its own markup
|
|
125
|
-
* + token classes. Search
|
|
126
|
-
*
|
|
131
|
+
* + token classes. Search and filter controls are opt-in toolbar content. Pagination
|
|
132
|
+
* is enabled only by explicit pagination/defaultPagination props. Sorting cycles none -> asc -> desc -> none on a
|
|
127
133
|
* sortable header (a real <button>, so it is keyboard-operable), exposes aria-sort on the
|
|
128
134
|
* <th>, and shows a lucide chevron indicator. selection reuses the existing .check-box control:
|
|
129
135
|
* a header checkbox selects/clears all (with an indeterminate middle state) and
|
|
@@ -142,8 +148,8 @@ export type DataTableSort = {
|
|
|
142
148
|
* a sortable + selectable data table. square, hairline, mono headers; both themes
|
|
143
149
|
* via tokens. sort + selection state/logic are powered by TanStack Table
|
|
144
150
|
* (@tanstack/react-table, headless) while this component still renders its own markup
|
|
145
|
-
* + token classes. Search
|
|
146
|
-
*
|
|
151
|
+
* + token classes. Search and filter controls are opt-in toolbar content. Pagination
|
|
152
|
+
* is enabled only by explicit pagination/defaultPagination props. Sorting cycles none -> asc -> desc -> none on a
|
|
147
153
|
* sortable header (a real <button>, so it is keyboard-operable), exposes aria-sort on the
|
|
148
154
|
* <th>, and shows a lucide chevron indicator. selection reuses the existing .check-box control:
|
|
149
155
|
* a header checkbox selects/clears all (with an indeterminate middle state) and
|
|
@@ -162,8 +168,8 @@ export type DataTableColumnFilters = {
|
|
|
162
168
|
* a sortable + selectable data table. square, hairline, mono headers; both themes
|
|
163
169
|
* via tokens. sort + selection state/logic are powered by TanStack Table
|
|
164
170
|
* (@tanstack/react-table, headless) while this component still renders its own markup
|
|
165
|
-
* + token classes. Search
|
|
166
|
-
*
|
|
171
|
+
* + token classes. Search and filter controls are opt-in toolbar content. Pagination
|
|
172
|
+
* is enabled only by explicit pagination/defaultPagination props. Sorting cycles none -> asc -> desc -> none on a
|
|
167
173
|
* sortable header (a real <button>, so it is keyboard-operable), exposes aria-sort on the
|
|
168
174
|
* <th>, and shows a lucide chevron indicator. selection reuses the existing .check-box control:
|
|
169
175
|
* a header checkbox selects/clears all (with an indeterminate middle state) and
|
|
@@ -178,3 +184,4 @@ export type DataTablePagination = {
|
|
|
178
184
|
pageIndex: number;
|
|
179
185
|
pageSize: number;
|
|
180
186
|
};
|
|
187
|
+
import { DataTablePaginationControls } from './DataTableControls.jsx';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional table controls. Omit search or columnFilters to leave that control out;
|
|
3
|
+
* children extend the toolbar with importer-owned actions.
|
|
4
|
+
* @param {Object} props
|
|
5
|
+
* @param {{ value: string, onChange: (value: string) => void }} [props.search]
|
|
6
|
+
* @param {{ columns: import('./DataTable.jsx').DataTableColumn[], value: import('./DataTable.jsx').DataTableColumnFilters, onChange: (value: import('./DataTable.jsx').DataTableColumnFilters) => void }} [props.columnFilters]
|
|
7
|
+
* @param {boolean} [props.disabled=false]
|
|
8
|
+
* @param {React.ReactNode} [props.children]
|
|
9
|
+
*/
|
|
10
|
+
export function DataTableToolbar({ search, columnFilters, disabled, children }: {
|
|
11
|
+
search?: {
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (value: string) => void;
|
|
14
|
+
};
|
|
15
|
+
columnFilters?: {
|
|
16
|
+
columns: import("./DataTable.jsx").DataTableColumn[];
|
|
17
|
+
value: import("./DataTable.jsx").DataTableColumnFilters;
|
|
18
|
+
onChange: (value: import("./DataTable.jsx").DataTableColumnFilters) => void;
|
|
19
|
+
};
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* Optional pagination/footer presentation, independent of the table's row markup.
|
|
25
|
+
* @param {Object} props
|
|
26
|
+
* @param {string} props.countLabel
|
|
27
|
+
* @param {number} props.pageIndex
|
|
28
|
+
* @param {number} props.pageCount
|
|
29
|
+
* @param {boolean} props.canPreviousPage
|
|
30
|
+
* @param {boolean} props.canNextPage
|
|
31
|
+
* @param {() => void} props.onPreviousPage
|
|
32
|
+
* @param {() => void} props.onNextPage
|
|
33
|
+
* @param {boolean} [props.disabled=false]
|
|
34
|
+
*/
|
|
35
|
+
export function DataTablePaginationControls({ countLabel, pageIndex, pageCount, canPreviousPage, canNextPage, onPreviousPage, onNextPage, disabled }: {
|
|
36
|
+
countLabel: string;
|
|
37
|
+
pageIndex: number;
|
|
38
|
+
pageCount: number;
|
|
39
|
+
canPreviousPage: boolean;
|
|
40
|
+
canNextPage: boolean;
|
|
41
|
+
onPreviousPage: () => void;
|
|
42
|
+
onNextPage: () => void;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
}): import("react").JSX.Element;
|
|
@@ -108,7 +108,7 @@ export function CollectivePicker({ suggestions, onAdd, query: queryProp, onQuery
|
|
|
108
108
|
* @param {string} props.title - the session title, kept in its case.
|
|
109
109
|
* @param {'publish'|'update'} [props.mode='publish']
|
|
110
110
|
* @param {PublishDialogState} props.state - one of PUBLISH_DIALOG_STATES.
|
|
111
|
-
* @param {{ matches?:
|
|
111
|
+
* @param {{ matches?: import('./Redaction.jsx').RedactionMatch[], matchCount?: number, total?: number, failure?: string }} [props.scan] - the host's scan result. `matchCount` is the full occurrence count when `matches` contains only examples. Until it carries a
|
|
112
112
|
* `matches` list, the popup says the transcript is not scanned and keeps publish off. A match with `kept: true` leaves un-redacted, and the
|
|
113
113
|
* popup says so and opens the matches.
|
|
114
114
|
* @param {() => void} [props.onRescan]
|
|
@@ -124,17 +124,18 @@ export function CollectivePicker({ suggestions, onAdd, query: queryProp, onQuery
|
|
|
124
124
|
* @param {() => void} [props.onConnect] - `continue with github`.
|
|
125
125
|
* @param {string} [props.joinHref] - `create or join one on village`.
|
|
126
126
|
* @param {string} [props.stoppedAt] - the step that failed, in words ("setting who can read it").
|
|
127
|
-
* @param {() => void} [props.onRetry
|
|
127
|
+
* @param {() => void} [props.onRecover] - stopped-state prerequisite read/sign-in recovery only; may run before a scan or audience exists, but never with an explicitly refused review. Mutually exclusive with onRetry. Must not publish.
|
|
128
|
+
* @param {() => void} [props.onRetry] - stopped-state actual publication retry; requires a valid review and audience. Mutually exclusive with onRecover.
|
|
128
129
|
* @param {{ url: string, collectives: string[], pending?: string[], pullRequest?: { number: number, branch: string, href?: string } }} [props.done]
|
|
129
130
|
*/
|
|
130
|
-
export function PublishDialog({ open, onClose, title, mode, state, scan, onRescan, changes, access, onRemove, onRestore, picker, autoPublish, accessSummary, primaryLabel, onPublish, onConnect, joinHref, stoppedAt, onRetry, done, }: {
|
|
131
|
+
export function PublishDialog({ open, onClose, title, mode, state, scan, onRescan, changes, access, onRemove, onRestore, picker, autoPublish, accessSummary, primaryLabel, onPublish, onConnect, joinHref, stoppedAt, onRecover, onRetry, done, }: {
|
|
131
132
|
open: boolean;
|
|
132
133
|
onClose: () => void;
|
|
133
134
|
title: string;
|
|
134
135
|
mode?: "publish" | "update";
|
|
135
136
|
state: PublishDialogState;
|
|
136
137
|
scan?: {
|
|
137
|
-
matches?:
|
|
138
|
+
matches?: import("./Redaction.jsx").RedactionMatch[];
|
|
138
139
|
matchCount?: number;
|
|
139
140
|
total?: number;
|
|
140
141
|
failure?: string;
|
|
@@ -158,6 +159,7 @@ export function PublishDialog({ open, onClose, title, mode, state, scan, onResca
|
|
|
158
159
|
onConnect?: () => void;
|
|
159
160
|
joinHref?: string;
|
|
160
161
|
stoppedAt?: string;
|
|
162
|
+
onRecover?: () => void;
|
|
161
163
|
onRetry?: () => void;
|
|
162
164
|
done?: {
|
|
163
165
|
url: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** @typedef {{id:string, category: import('@peasant-labs/schema').RedactionCategory, confidence:number, before?:string, secret?:string, after:string, kept?:boolean}} RedactionMatch */
|
|
1
2
|
/**
|
|
2
3
|
* RedactionReview — the safe-by-default review surface.
|
|
3
4
|
*
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
* empty input throws an actionable TypeError before the review renders.
|
|
9
10
|
* @param {(level: 'minimal'|'standard'|'maximum') => void} [props.onLevel]
|
|
10
11
|
* - called only with an available level on select
|
|
11
|
-
* @param {
|
|
12
|
+
* @param {RedactionMatch[]} [props.matches]
|
|
12
13
|
* - the flagged matches. `before`/`secret` is the original (one or the other), `after` the
|
|
13
14
|
* redacted form. `kept` (controlled mode) = the user opted OUT, secret leaves as-is.
|
|
14
15
|
* @param {(id: string, kept: boolean) => void} [props.onToggle] - called when a match is toggled;
|
|
@@ -24,15 +25,7 @@ export function RedactionReview({ level, availableLevels, onLevel, matches, onTo
|
|
|
24
25
|
level?: "minimal" | "standard" | "maximum";
|
|
25
26
|
availableLevels?: readonly ("minimal" | "standard" | "maximum")[];
|
|
26
27
|
onLevel?: (level: "minimal" | "standard" | "maximum") => void;
|
|
27
|
-
matches?:
|
|
28
|
-
id: any;
|
|
29
|
-
category: import("./redaction-categories.js").RedactionCategory;
|
|
30
|
-
confidence: number;
|
|
31
|
-
before?: string;
|
|
32
|
-
secret?: string;
|
|
33
|
-
after: string;
|
|
34
|
-
kept?: boolean;
|
|
35
|
-
}>;
|
|
28
|
+
matches?: RedactionMatch[];
|
|
36
29
|
onToggle?: (id: string, kept: boolean) => void;
|
|
37
30
|
scanned?: number;
|
|
38
31
|
total?: number;
|
|
@@ -59,3 +52,12 @@ export function WhereDoesThisGo({ destination, sent, private: stays, className,
|
|
|
59
52
|
className?: string;
|
|
60
53
|
}): import("react").JSX.Element;
|
|
61
54
|
export default RedactionReview;
|
|
55
|
+
export type RedactionMatch = {
|
|
56
|
+
id: string;
|
|
57
|
+
category: import("@peasant-labs/schema").RedactionCategory;
|
|
58
|
+
confidence: number;
|
|
59
|
+
before?: string;
|
|
60
|
+
secret?: string;
|
|
61
|
+
after: string;
|
|
62
|
+
kept?: boolean;
|
|
63
|
+
};
|
|
@@ -41,6 +41,7 @@ export { Avatar, AvatarGroup, Kbd, KbdChord, Tag } from "./Avatar.jsx";
|
|
|
41
41
|
export { default as BrandMark, resolveBrand } from "./BrandMark.jsx";
|
|
42
42
|
export { providerAccent, providerDisplayName } from "./provider-policy.js";
|
|
43
43
|
export { Skeleton, Progress, Spinner, Toast, FeedbackPanel } from "./Feedback.jsx";
|
|
44
|
+
export { DataTableToolbar, DataTablePaginationControls } from "./DataTableControls.jsx";
|
|
44
45
|
export { default as HelperGroup, HelperGroupListItem, HelperThreadRow, useHelperSelection, helperOwnerState, helperSelectionIds, helperOwnerToggle, helperMemberToggle, HELPER_OWNER_STATE } from "./HelperGroup.jsx";
|
|
45
46
|
export { default as Timeline, TimelineItem, ToolCall, ThinkingBlock } from "./Timeline.jsx";
|
|
46
47
|
export { default as ToastProvider, useToast } from "./ToastHost.jsx";
|
|
@@ -65,3 +66,4 @@ export { PublishStateLabel, PublishBar, AccessList, CollectivePicker, PublishDia
|
|
|
65
66
|
export { SettingRow, SettingGroup, SettingStatus, SETTING_ROW_STATES } from "./Settings.jsx";
|
|
66
67
|
export { default as VisibilitySegmented, VisibilityEye, ScopeChip, FocusedModeToggle } from "./VisibilityControl.jsx";
|
|
67
68
|
export { default as InUseShell, GraphAppShell, GraphSectionNav, IN_USE_APPS, LOCAL_APP_SECTIONS, GRAPH_APP_SECTIONS } from "./inuse/InUseShell.jsx";
|
|
69
|
+
export { RedactionCategory, RedactionCategoryLabel, AllRedactionCategories, AllRedactionCategoryLabels, isRedactionCategory, parseRedactionCategory, parseRedactionCategoryLabel, redactionCategoryFromLabel, redactionCategoryLabel } from "@peasant-labs/schema";
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
/** @typedef {'secrets'|'pii'|'paths'|'project'} RedactionCategory */
|
|
2
|
-
/** @param {unknown} category */
|
|
3
|
-
export function redactionCategoryLabel(category: unknown): any;
|
|
4
1
|
/** @param {unknown} matches */
|
|
5
2
|
export function hasKnownRedactionCategories(matches: unknown): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Audited JS projection of github.com/peasant-labs/redact/category_string.go:
|
|
8
|
-
* Category.String maps wire categories to these exact rendered labels.
|
|
9
|
-
* Unknown input is never a trusted category or a display-label fallback.
|
|
10
|
-
*/
|
|
11
|
-
export const REDACTION_CATEGORY_LABELS: Readonly<{
|
|
12
|
-
secrets: "CREDENTIAL";
|
|
13
|
-
pii: "PII";
|
|
14
|
-
paths: "PATH";
|
|
15
|
-
project: "INTERNAL";
|
|
16
|
-
}>;
|
|
17
|
-
export type RedactionCategory = "secrets" | "pii" | "paths" | "project";
|