@peasant-labs/fairtrade 0.0.0
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/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/lib/README.md +13 -0
- package/dist/lib/base.css +48 -0
- package/dist/lib/components.css +2 -0
- package/dist/lib/fonts.css +28 -0
- package/dist/lib/tokens.css +184 -0
- package/dist/lib/tokens.json +768 -0
- package/dist/lib/types/Accordion.d.ts +47 -0
- package/dist/lib/types/Accordion.stories.d.ts +91 -0
- package/dist/lib/types/Avatar.d.ts +94 -0
- package/dist/lib/types/Avatar.stories.d.ts +160 -0
- package/dist/lib/types/BrandMark.d.ts +25 -0
- package/dist/lib/types/BrandMark.stories.d.ts +75 -0
- package/dist/lib/types/Breadcrumb.d.ts +66 -0
- package/dist/lib/types/Breadcrumb.stories.d.ts +91 -0
- package/dist/lib/types/Button.d.ts +86 -0
- package/dist/lib/types/Button.stories.d.ts +129 -0
- package/dist/lib/types/Card.d.ts +145 -0
- package/dist/lib/types/Card.stories.d.ts +70 -0
- package/dist/lib/types/Chart.stories.d.ts +55 -0
- package/dist/lib/types/ChartBar.d.ts +51 -0
- package/dist/lib/types/ChartLine.d.ts +54 -0
- package/dist/lib/types/Checkbox.d.ts +132 -0
- package/dist/lib/types/Checkbox.stories.d.ts +75 -0
- package/dist/lib/types/Chip.d.ts +85 -0
- package/dist/lib/types/Chip.stories.d.ts +190 -0
- package/dist/lib/types/CliOnboard.d.ts +68 -0
- package/dist/lib/types/CliOnboard.stories.d.ts +24 -0
- package/dist/lib/types/CommandPalette.d.ts +6 -0
- package/dist/lib/types/CommandPalette.stories.d.ts +94 -0
- package/dist/lib/types/CommitGraph.d.ts +71 -0
- package/dist/lib/types/CommitGraph.stories.d.ts +17 -0
- package/dist/lib/types/ConnectionState.d.ts +82 -0
- package/dist/lib/types/ConnectionState.stories.d.ts +117 -0
- package/dist/lib/types/ConsentDialog.d.ts +97 -0
- package/dist/lib/types/ConsentDialog.stories.d.ts +61 -0
- package/dist/lib/types/DataTable.d.ts +116 -0
- package/dist/lib/types/DataTable.stories.d.ts +240 -0
- package/dist/lib/types/DateRange.d.ts +242 -0
- package/dist/lib/types/DateRange.stories.d.ts +272 -0
- package/dist/lib/types/Dialog.d.ts +9 -0
- package/dist/lib/types/Dialog.stories.d.ts +121 -0
- package/dist/lib/types/DiffView.d.ts +39 -0
- package/dist/lib/types/DiffView.stories.d.ts +118 -0
- package/dist/lib/types/EmptyState.d.ts +28 -0
- package/dist/lib/types/EmptyState.stories.d.ts +130 -0
- package/dist/lib/types/EvidenceCaption.d.ts +39 -0
- package/dist/lib/types/EvidenceCaption.stories.d.ts +43 -0
- package/dist/lib/types/Explainer.d.ts +82 -0
- package/dist/lib/types/Explainer.stories.d.ts +22 -0
- package/dist/lib/types/FacetRail.d.ts +13 -0
- package/dist/lib/types/FacetRail.stories.d.ts +28 -0
- package/dist/lib/types/Feedback.d.ts +222 -0
- package/dist/lib/types/Feedback.stories.d.ts +81 -0
- package/dist/lib/types/GroupedMultiSelect.d.ts +67 -0
- package/dist/lib/types/GroupedMultiSelect.stories.d.ts +59 -0
- package/dist/lib/types/Input.d.ts +158 -0
- package/dist/lib/types/Input.stories.d.ts +181 -0
- package/dist/lib/types/Intensity.d.ts +55 -0
- package/dist/lib/types/Intensity.stories.d.ts +108 -0
- package/dist/lib/types/MapCanvas.d.ts +89 -0
- package/dist/lib/types/MapCanvas.stories.d.ts +174 -0
- package/dist/lib/types/Menu.d.ts +62 -0
- package/dist/lib/types/Menu.stories.d.ts +173 -0
- package/dist/lib/types/ModerationQueue.d.ts +135 -0
- package/dist/lib/types/ModerationQueue.stories.d.ts +34 -0
- package/dist/lib/types/Pager.d.ts +47 -0
- package/dist/lib/types/Pager.stories.d.ts +100 -0
- package/dist/lib/types/Pagination.d.ts +50 -0
- package/dist/lib/types/Pagination.stories.d.ts +193 -0
- package/dist/lib/types/PolicySelect.d.ts +80 -0
- package/dist/lib/types/PolicySelect.stories.d.ts +130 -0
- package/dist/lib/types/ProviderIcon.d.ts +83 -0
- package/dist/lib/types/ProviderIcon.stories.d.ts +44 -0
- package/dist/lib/types/RailShell.d.ts +199 -0
- package/dist/lib/types/RailShell.stories.d.ts +32 -0
- package/dist/lib/types/Redaction.d.ts +53 -0
- package/dist/lib/types/Redaction.stories.d.ts +120 -0
- package/dist/lib/types/RoleRoster.d.ts +97 -0
- package/dist/lib/types/RoleRoster.stories.d.ts +23 -0
- package/dist/lib/types/SignIn.d.ts +78 -0
- package/dist/lib/types/SignIn.stories.d.ts +57 -0
- package/dist/lib/types/Sparkline.d.ts +19 -0
- package/dist/lib/types/StatTiles.d.ts +115 -0
- package/dist/lib/types/StatTiles.stories.d.ts +31 -0
- package/dist/lib/types/StepWizard.d.ts +92 -0
- package/dist/lib/types/StepWizard.stories.d.ts +18 -0
- package/dist/lib/types/StepsWaterfall.d.ts +67 -0
- package/dist/lib/types/StepsWaterfall.stories.d.ts +94 -0
- package/dist/lib/types/Switch.d.ts +63 -0
- package/dist/lib/types/Switch.stories.d.ts +134 -0
- package/dist/lib/types/Tabs.d.ts +48 -0
- package/dist/lib/types/Tabs.stories.d.ts +75 -0
- package/dist/lib/types/TimeStrip.d.ts +12 -0
- package/dist/lib/types/TimeStrip.stories.d.ts +30 -0
- package/dist/lib/types/Timeline.d.ts +192 -0
- package/dist/lib/types/Timeline.stories.d.ts +974 -0
- package/dist/lib/types/ToastHost.d.ts +70 -0
- package/dist/lib/types/ToastHost.stories.d.ts +115 -0
- package/dist/lib/types/ToolRenderers.d.ts +24 -0
- package/dist/lib/types/ToolRenderers.stories.d.ts +138 -0
- package/dist/lib/types/Tooltip.d.ts +80 -0
- package/dist/lib/types/Tooltip.stories.d.ts +116 -0
- package/dist/lib/types/Tour.d.ts +37 -0
- package/dist/lib/types/Tour.stories.d.ts +39 -0
- package/dist/lib/types/TranscriptMarkers.d.ts +50 -0
- package/dist/lib/types/TranscriptMarkers.stories.d.ts +48 -0
- package/dist/lib/types/Treemap.d.ts +77 -0
- package/dist/lib/types/Treemap.stories.d.ts +101 -0
- package/dist/lib/types/VisibilityControl.d.ts +54 -0
- package/dist/lib/types/VisibilityControl.stories.d.ts +126 -0
- package/dist/lib/types/chart-shared.d.ts +63 -0
- package/dist/lib/types/index.d.ts +53 -0
- package/dist/lib/types/story-frame.d.ts +12 -0
- package/dist/lib/ui.js +8707 -0
- package/package.json +67 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} Commit
|
|
3
|
+
* @property {string} id - stable key (e.g. short hash)
|
|
4
|
+
* @property {number} lane - 0 = main line; >0 = a branch lane
|
|
5
|
+
* @property {string[]} [parents] - parent commit ids (>1 = a merge commit)
|
|
6
|
+
* @property {string} message - the commit subject (USER CONTENT — case preserved)
|
|
7
|
+
* @property {string} [branch] - branch name for the chip (USER CONTENT — case preserved)
|
|
8
|
+
* @property {boolean} [session] - a recorded AI session sits behind this commit (-> filled + sparkle)
|
|
9
|
+
* @property {boolean} [merged] - this commit merged a branch back in (-> merged chip)
|
|
10
|
+
* @property {boolean} [tip] - this commit is a branch tip (-> small tip affordance)
|
|
11
|
+
* @property {string} [time] - relative time label (e.g. "8m ago") — already humanised by the caller
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* CommitGraph — render `commits` (newest first) as a lane gutter + a column of selectable rows.
|
|
15
|
+
*
|
|
16
|
+
* @param {object} props
|
|
17
|
+
* @param {Commit[]} props.commits - the history, newest first; lane 0 is the main line.
|
|
18
|
+
* @param {string} [props.selectedId] - id of the active/selected row (the scarce amber treatment).
|
|
19
|
+
* @param {(commit: Commit) => void} [props.onSelect] - called with the commit when a row is chosen.
|
|
20
|
+
* @param {boolean} [props.hasMore=false] - more history exists below the window -> show the "show older" ghost.
|
|
21
|
+
* @param {() => void} [props.onShowOlder] - called when "show older" is pressed.
|
|
22
|
+
* @param {string} [props.label='commit history'] - accessible name for the list (lowercase chrome).
|
|
23
|
+
* @param {string} [props.className] - extra classes appended to the root.
|
|
24
|
+
*/
|
|
25
|
+
export default function CommitGraph({ commits, selectedId, onSelect, hasMore, onShowOlder, label, className, ...rest }: {
|
|
26
|
+
commits: Commit[];
|
|
27
|
+
selectedId?: string;
|
|
28
|
+
onSelect?: (commit: Commit) => void;
|
|
29
|
+
hasMore?: boolean;
|
|
30
|
+
onShowOlder?: () => void;
|
|
31
|
+
label?: string;
|
|
32
|
+
className?: string;
|
|
33
|
+
}): any;
|
|
34
|
+
export type Commit = {
|
|
35
|
+
/**
|
|
36
|
+
* - stable key (e.g. short hash)
|
|
37
|
+
*/
|
|
38
|
+
id: string;
|
|
39
|
+
/**
|
|
40
|
+
* - 0 = main line; >0 = a branch lane
|
|
41
|
+
*/
|
|
42
|
+
lane: number;
|
|
43
|
+
/**
|
|
44
|
+
* - parent commit ids (>1 = a merge commit)
|
|
45
|
+
*/
|
|
46
|
+
parents?: string[];
|
|
47
|
+
/**
|
|
48
|
+
* - the commit subject (USER CONTENT — case preserved)
|
|
49
|
+
*/
|
|
50
|
+
message: string;
|
|
51
|
+
/**
|
|
52
|
+
* - branch name for the chip (USER CONTENT — case preserved)
|
|
53
|
+
*/
|
|
54
|
+
branch?: string;
|
|
55
|
+
/**
|
|
56
|
+
* - a recorded AI session sits behind this commit (-> filled + sparkle)
|
|
57
|
+
*/
|
|
58
|
+
session?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* - this commit merged a branch back in (-> merged chip)
|
|
61
|
+
*/
|
|
62
|
+
merged?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* - this commit is a branch tip (-> small tip affordance)
|
|
65
|
+
*/
|
|
66
|
+
tip?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* - relative time label (e.g. "8m ago") — already humanised by the caller
|
|
69
|
+
*/
|
|
70
|
+
time?: string;
|
|
71
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default meta;
|
|
2
|
+
export namespace Default {
|
|
3
|
+
function render(): any;
|
|
4
|
+
}
|
|
5
|
+
export namespace Linear {
|
|
6
|
+
export function render_1(): any;
|
|
7
|
+
export { render_1 as render };
|
|
8
|
+
}
|
|
9
|
+
declare namespace meta {
|
|
10
|
+
export let title: string;
|
|
11
|
+
export { CommitGraph as component };
|
|
12
|
+
export let decorators: Function[];
|
|
13
|
+
export namespace parameters {
|
|
14
|
+
let layout: string;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
import CommitGraph from './CommitGraph.jsx';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConnectionPill — the small, glanceable connection indicator. a square hairline pill carrying an
|
|
3
|
+
* icon and the word; the note ("on this computer · no internet") sits beside it as quiet mono
|
|
4
|
+
* chrome. the state never rides on color alone: the icon and the word both encode it (no status
|
|
5
|
+
* dot — a color-only dot would break that rule), and the whole pill is announced via role=status.
|
|
6
|
+
* the per-tone icon color is a tint on top, only where color is welcome.
|
|
7
|
+
*
|
|
8
|
+
* @param {object} props
|
|
9
|
+
* @param {'live'|'connecting'|'disconnected'} [props.status='live'] - the connection state.
|
|
10
|
+
* @param {boolean} [props.showNote=true] - render the trailing "on this computer · no internet"
|
|
11
|
+
* style note. set false for the tightest, word-only pill.
|
|
12
|
+
* @param {string} [props.className]
|
|
13
|
+
*/
|
|
14
|
+
export function ConnectionPill({ status, showNote, className, ...rest }: {
|
|
15
|
+
status?: "live" | "connecting" | "disconnected";
|
|
16
|
+
showNote?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
}): any;
|
|
19
|
+
/**
|
|
20
|
+
* DataState — the discriminator between the states a data view can be in, so a dropped connection
|
|
21
|
+
* never reads as "empty". precedence is deliberate:
|
|
22
|
+
*
|
|
23
|
+
* loading → a skeleton (don't show "empty" before the answer is in).
|
|
24
|
+
* disconnected || error → the calm lost-connection panel + retry (the key rule:
|
|
25
|
+
* disconnected != empty — a lost socket is not zero results).
|
|
26
|
+
* empty → the teaching `empty` slot (connected, but genuinely nothing here).
|
|
27
|
+
* else → children (the real content).
|
|
28
|
+
*
|
|
29
|
+
* @param {object} props
|
|
30
|
+
* @param {'live'|'connecting'|'disconnected'} [props.status] - the live connection status. when
|
|
31
|
+
* 'disconnected', the lost-connection panel wins over `empty` even if `empty` is provided.
|
|
32
|
+
* @param {boolean} [props.loading] - data is in flight; show the skeleton.
|
|
33
|
+
* @param {boolean|string} [props.error] - an error occurred; truthy shows the lost-connection
|
|
34
|
+
* panel. a string overrides the panel body.
|
|
35
|
+
* @param {boolean} [props.empty] - connected, request resolved, but there is nothing to show.
|
|
36
|
+
* @param {import('react').ReactNode} [props.children] - the real content, shown when none of the
|
|
37
|
+
* above apply.
|
|
38
|
+
* @param {import('react').ReactNode} [props.emptyState] - the teaching empty slot (e.g. a
|
|
39
|
+
* <TeachingEmptyState/>), rendered when `empty` is true.
|
|
40
|
+
* @param {() => void} [props.onRetry] - retry handler for the lost-connection panel.
|
|
41
|
+
* @param {number} [props.skeletonRows=3] - how many skeleton bars to show while loading.
|
|
42
|
+
* @param {string} [props.className]
|
|
43
|
+
*/
|
|
44
|
+
export function DataState({ status, loading, error, empty, children, emptyState, onRetry, skeletonRows, className, ...rest }: {
|
|
45
|
+
status?: "live" | "connecting" | "disconnected";
|
|
46
|
+
loading?: boolean;
|
|
47
|
+
error?: boolean | string;
|
|
48
|
+
empty?: boolean;
|
|
49
|
+
children?: any;
|
|
50
|
+
emptyState?: any;
|
|
51
|
+
onRetry?: () => void;
|
|
52
|
+
skeletonRows?: number;
|
|
53
|
+
className?: string;
|
|
54
|
+
}): any;
|
|
55
|
+
/**
|
|
56
|
+
* TeachingEmptyState — an empty state that TEACHES the mechanism instead of just declaring the
|
|
57
|
+
* absence. a leading icon, a title, a line of guidance, and a copy-able `$ command` chip (the
|
|
58
|
+
* actual command to run, e.g. `peasant ingest`) with an inline copy button — then a short privacy
|
|
59
|
+
* line, because the whole point is that this runs locally and nothing leaves the machine.
|
|
60
|
+
*
|
|
61
|
+
* @param {object} props
|
|
62
|
+
* @param {import('react').ComponentType} [props.icon=HardDrive] - lucide icon for the heading.
|
|
63
|
+
* @param {import('react').ReactNode} props.title - the short headline.
|
|
64
|
+
* @param {import('react').ReactNode} [props.body] - a line of guidance prose (what the command
|
|
65
|
+
* does, in plain words).
|
|
66
|
+
* @param {string} [props.command] - the command to teach, shown in a `$`-prefixed mono chip with a
|
|
67
|
+
* copy button. the `$` is decoration; only the command itself is copied.
|
|
68
|
+
* @param {import('react').ReactNode} [props.privacy] - the privacy line. defaults to "nothing
|
|
69
|
+
* leaves your machine". pass null to omit.
|
|
70
|
+
* @param {keyof JSX.IntrinsicElements} [props.as='h3'] - heading level for the title.
|
|
71
|
+
* @param {string} [props.className]
|
|
72
|
+
*/
|
|
73
|
+
export function TeachingEmptyState({ icon: Icon, title, body, command, privacy, as: Heading, className, ...rest }: {
|
|
74
|
+
icon?: any;
|
|
75
|
+
title: any;
|
|
76
|
+
body?: any;
|
|
77
|
+
command?: string;
|
|
78
|
+
privacy?: any;
|
|
79
|
+
as?: keyof JSX.IntrinsicElements;
|
|
80
|
+
className?: string;
|
|
81
|
+
}): any;
|
|
82
|
+
export default ConnectionPill;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export default meta;
|
|
2
|
+
export namespace Pills {
|
|
3
|
+
namespace parameters {
|
|
4
|
+
namespace controls {
|
|
5
|
+
let include: any[];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
function render(): any;
|
|
9
|
+
function play({ canvasElement }: {
|
|
10
|
+
canvasElement: any;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export namespace SinglePill {
|
|
14
|
+
export function render_1(args: any): any;
|
|
15
|
+
export { render_1 as render };
|
|
16
|
+
export namespace args {
|
|
17
|
+
let status: string;
|
|
18
|
+
let showNote: boolean;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export namespace Disconnected {
|
|
22
|
+
export namespace parameters_1 {
|
|
23
|
+
export namespace controls_1 {
|
|
24
|
+
let include_1: any[];
|
|
25
|
+
export { include_1 as include };
|
|
26
|
+
}
|
|
27
|
+
export { controls_1 as controls };
|
|
28
|
+
}
|
|
29
|
+
export { parameters_1 as parameters };
|
|
30
|
+
export function render_2(): any;
|
|
31
|
+
export { render_2 as render };
|
|
32
|
+
export function play_1({ canvasElement }: {
|
|
33
|
+
canvasElement: any;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
export { play_1 as play };
|
|
36
|
+
}
|
|
37
|
+
export namespace TeachingEmpty {
|
|
38
|
+
export namespace parameters_2 {
|
|
39
|
+
export namespace controls_2 {
|
|
40
|
+
let include_2: any[];
|
|
41
|
+
export { include_2 as include };
|
|
42
|
+
}
|
|
43
|
+
export { controls_2 as controls };
|
|
44
|
+
}
|
|
45
|
+
export { parameters_2 as parameters };
|
|
46
|
+
export function render_3(): any;
|
|
47
|
+
export { render_3 as render };
|
|
48
|
+
export function play_2({ canvasElement }: {
|
|
49
|
+
canvasElement: any;
|
|
50
|
+
}): Promise<void>;
|
|
51
|
+
export { play_2 as play };
|
|
52
|
+
}
|
|
53
|
+
export namespace TeachingStandalone {
|
|
54
|
+
export namespace parameters_3 {
|
|
55
|
+
export namespace controls_3 {
|
|
56
|
+
let include_3: any[];
|
|
57
|
+
export { include_3 as include };
|
|
58
|
+
}
|
|
59
|
+
export { controls_3 as controls };
|
|
60
|
+
}
|
|
61
|
+
export { parameters_3 as parameters };
|
|
62
|
+
export function render_4(): any;
|
|
63
|
+
export { render_4 as render };
|
|
64
|
+
}
|
|
65
|
+
export namespace Loading {
|
|
66
|
+
export namespace parameters_4 {
|
|
67
|
+
export namespace controls_4 {
|
|
68
|
+
let include_4: any[];
|
|
69
|
+
export { include_4 as include };
|
|
70
|
+
}
|
|
71
|
+
export { controls_4 as controls };
|
|
72
|
+
}
|
|
73
|
+
export { parameters_4 as parameters };
|
|
74
|
+
export function render_5(): any;
|
|
75
|
+
export { render_5 as render };
|
|
76
|
+
export function play_3({ canvasElement }: {
|
|
77
|
+
canvasElement: any;
|
|
78
|
+
}): Promise<void>;
|
|
79
|
+
export { play_3 as play };
|
|
80
|
+
}
|
|
81
|
+
export namespace LightTheme {
|
|
82
|
+
export namespace parameters_5 {
|
|
83
|
+
export namespace controls_5 {
|
|
84
|
+
let include_5: any[];
|
|
85
|
+
export { include_5 as include };
|
|
86
|
+
}
|
|
87
|
+
export { controls_5 as controls };
|
|
88
|
+
}
|
|
89
|
+
export { parameters_5 as parameters };
|
|
90
|
+
export function render_6(): any;
|
|
91
|
+
export { render_6 as render };
|
|
92
|
+
export namespace globals {
|
|
93
|
+
let theme: string;
|
|
94
|
+
namespace backgrounds {
|
|
95
|
+
let value: string;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
declare namespace meta {
|
|
100
|
+
export let title: string;
|
|
101
|
+
export { ConnectionPill as component };
|
|
102
|
+
export let tags: string[];
|
|
103
|
+
export let decorators: Function[];
|
|
104
|
+
export namespace argTypes {
|
|
105
|
+
export namespace status_1 {
|
|
106
|
+
let control: string;
|
|
107
|
+
let options: string[];
|
|
108
|
+
}
|
|
109
|
+
export { status_1 as status };
|
|
110
|
+
export namespace showNote_1 {
|
|
111
|
+
let control_1: string;
|
|
112
|
+
export { control_1 as control };
|
|
113
|
+
}
|
|
114
|
+
export { showNote_1 as showNote };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
import { ConnectionPill } from './ConnectionState.jsx';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} ConsentAxis
|
|
3
|
+
* @property {React.ElementType} [icon] lucide component for the row (rendered in a square chip)
|
|
4
|
+
* @property {string} key the mono, lowercase axis label (e.g. "identity", "data access")
|
|
5
|
+
* @property {React.ReactNode} value the chosen value — may contain user content (NOT lowercased)
|
|
6
|
+
* @property {React.ReactNode} [scope] optional "who can see / what changes" note shown under the value
|
|
7
|
+
* @property {'reveal'|'open'|'restricted'} [tone] colors the icon chip: reveal=amber, open=teal, restricted=clay
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* ConsentSummary — the reusable axes block. an aligned grid of rows, each an icon
|
|
11
|
+
* chip + a mono key + the value (+ an optional scope note). this is the seed that
|
|
12
|
+
* already lived in the join dialog; here it is generalized so every governance
|
|
13
|
+
* dialog renders the same legible "here is what is at stake" panel.
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} props
|
|
16
|
+
* @param {ConsentAxis[]} props.axes the rows to render
|
|
17
|
+
* @param {string} [props.caption] optional mono eyebrow above the rows
|
|
18
|
+
* @param {string} [props.className] extra classes appended after .cns-summary
|
|
19
|
+
*/
|
|
20
|
+
export function ConsentSummary({ axes, caption, className, ...rest }: {
|
|
21
|
+
axes: ConsentAxis[];
|
|
22
|
+
caption?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}): any;
|
|
25
|
+
/**
|
|
26
|
+
* ConsentDialog — a scrim + bordered modal that frames a governance decision.
|
|
27
|
+
* structure: head (mono lowercase title + close) / body (intro prose, a
|
|
28
|
+
* <ConsentSummary>, an optional "i understand and consent" checkbox, optional
|
|
29
|
+
* extra children rendered after the summary) / foot (cancel secondary + the
|
|
30
|
+
* primary confirm in amber). when `requireConsent`, the primary stays disabled
|
|
31
|
+
* until the checkbox is ticked, so the irreversible action never rides on a
|
|
32
|
+
* single reflexive click.
|
|
33
|
+
*
|
|
34
|
+
* controlled by `open` + `onCancel`. focus is trapped while open; Escape and a
|
|
35
|
+
* scrim click cancel; focus returns to whatever was focused when it opened (or
|
|
36
|
+
* `returnFocusRef` if given); background scroll is locked.
|
|
37
|
+
*
|
|
38
|
+
* @param {Object} props
|
|
39
|
+
* @param {boolean} props.open whether the dialog is mounted/visible
|
|
40
|
+
* @param {React.ReactNode} props.title the mono lowercase head title (may embed a .cns-name)
|
|
41
|
+
* @param {React.ReactNode} [props.intro] reading-prose lede above the summary
|
|
42
|
+
* @param {ConsentAxis[]} [props.axes] axes for the embedded <ConsentSummary>
|
|
43
|
+
* @param {string} [props.summaryCaption] eyebrow above the summary rows
|
|
44
|
+
* @param {React.ReactNode} [props.children] extra content rendered after the summary (e.g. a retention choice)
|
|
45
|
+
* @param {string} [props.confirmLabel='confirm'] primary button label (mono lowercase)
|
|
46
|
+
* @param {React.ElementType} [props.confirmIcon] lucide icon for the primary button
|
|
47
|
+
* @param {string} [props.cancelLabel='cancel'] secondary button label
|
|
48
|
+
* @param {() => void} props.onCancel called on cancel / esc / scrim / close
|
|
49
|
+
* @param {() => void} props.onConfirm called when the (enabled) primary is pressed
|
|
50
|
+
* @param {boolean} [props.requireConsent=true] gate the primary behind the consent checkbox
|
|
51
|
+
* @param {React.ReactNode} [props.consentLabel] the checkbox label (default "i understand and consent")
|
|
52
|
+
* @param {'primary'|'danger'} [props.tone='primary'] primary button treatment (danger for leave/retract)
|
|
53
|
+
* @param {boolean} [props.busy=false] disables controls + shows the primary as busy
|
|
54
|
+
* @param {string} [props.labelId='cns-title'] id wiring aria-labelledby (unique it if two can co-exist)
|
|
55
|
+
* @param {React.RefObject<HTMLElement>} [props.returnFocusRef] where to send focus on close
|
|
56
|
+
*/
|
|
57
|
+
export default function ConsentDialog({ open, title, intro, axes, summaryCaption, children, confirmLabel, confirmIcon: ConfirmIcon, cancelLabel, onCancel, onConfirm, requireConsent, consentLabel, tone, busy, labelId, returnFocusRef, }: {
|
|
58
|
+
open: boolean;
|
|
59
|
+
title: React.ReactNode;
|
|
60
|
+
intro?: React.ReactNode;
|
|
61
|
+
axes?: ConsentAxis[];
|
|
62
|
+
summaryCaption?: string;
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
confirmLabel?: string;
|
|
65
|
+
confirmIcon?: React.ElementType;
|
|
66
|
+
cancelLabel?: string;
|
|
67
|
+
onCancel: () => void;
|
|
68
|
+
onConfirm: () => void;
|
|
69
|
+
requireConsent?: boolean;
|
|
70
|
+
consentLabel?: React.ReactNode;
|
|
71
|
+
tone?: "primary" | "danger";
|
|
72
|
+
busy?: boolean;
|
|
73
|
+
labelId?: string;
|
|
74
|
+
returnFocusRef?: React.RefObject<HTMLElement>;
|
|
75
|
+
}): any;
|
|
76
|
+
export type ConsentAxis = {
|
|
77
|
+
/**
|
|
78
|
+
* lucide component for the row (rendered in a square chip)
|
|
79
|
+
*/
|
|
80
|
+
icon?: React.ElementType;
|
|
81
|
+
/**
|
|
82
|
+
* the mono, lowercase axis label (e.g. "identity", "data access")
|
|
83
|
+
*/
|
|
84
|
+
key: string;
|
|
85
|
+
/**
|
|
86
|
+
* the chosen value — may contain user content (NOT lowercased)
|
|
87
|
+
*/
|
|
88
|
+
value: React.ReactNode;
|
|
89
|
+
/**
|
|
90
|
+
* optional "who can see / what changes" note shown under the value
|
|
91
|
+
*/
|
|
92
|
+
scope?: React.ReactNode;
|
|
93
|
+
/**
|
|
94
|
+
* colors the icon chip: reveal=amber, open=teal, restricted=clay
|
|
95
|
+
*/
|
|
96
|
+
tone?: "reveal" | "open" | "restricted";
|
|
97
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export default meta;
|
|
2
|
+
export namespace Join {
|
|
3
|
+
let name: string;
|
|
4
|
+
function render(): any;
|
|
5
|
+
function play({ canvasElement, step }: {
|
|
6
|
+
canvasElement: any;
|
|
7
|
+
step: any;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export namespace Contribute {
|
|
11
|
+
let name_1: string;
|
|
12
|
+
export { name_1 as name };
|
|
13
|
+
export function render_1(): any;
|
|
14
|
+
export { render_1 as render };
|
|
15
|
+
export function play_1({ canvasElement, step }: {
|
|
16
|
+
canvasElement: any;
|
|
17
|
+
step: any;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
export { play_1 as play };
|
|
20
|
+
}
|
|
21
|
+
export namespace Leave {
|
|
22
|
+
let name_2: string;
|
|
23
|
+
export { name_2 as name };
|
|
24
|
+
export function render_2(): any;
|
|
25
|
+
export { render_2 as render };
|
|
26
|
+
export function play_2({ canvasElement, step }: {
|
|
27
|
+
canvasElement: any;
|
|
28
|
+
step: any;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
export { play_2 as play };
|
|
31
|
+
}
|
|
32
|
+
export namespace Summary {
|
|
33
|
+
let name_3: string;
|
|
34
|
+
export { name_3 as name };
|
|
35
|
+
export function render_3(): any;
|
|
36
|
+
export { render_3 as render };
|
|
37
|
+
}
|
|
38
|
+
export namespace JoinStatic {
|
|
39
|
+
let name_4: string;
|
|
40
|
+
export { name_4 as name };
|
|
41
|
+
export function render_4(): any;
|
|
42
|
+
export { render_4 as render };
|
|
43
|
+
}
|
|
44
|
+
export namespace LeaveStatic {
|
|
45
|
+
let name_5: string;
|
|
46
|
+
export { name_5 as name };
|
|
47
|
+
export function render_5(): any;
|
|
48
|
+
export { render_5 as render };
|
|
49
|
+
export function play_3({ canvasElement }: {
|
|
50
|
+
canvasElement: any;
|
|
51
|
+
}): Promise<void>;
|
|
52
|
+
export { play_3 as play };
|
|
53
|
+
}
|
|
54
|
+
declare namespace meta {
|
|
55
|
+
export let title: string;
|
|
56
|
+
export { ConsentDialog as component };
|
|
57
|
+
export namespace parameters {
|
|
58
|
+
let layout: string;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
import ConsentDialog from './ConsentDialog.jsx';
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* a sortable + selectable data table. square, hairline, mono headers; both themes
|
|
3
|
+
* via tokens. sort + selection state/logic are powered by TanStack Table
|
|
4
|
+
* (@tanstack/react-table, headless) while this component still renders its own markup
|
|
5
|
+
* + token classes, so the look is unchanged and growth (filtering, pagination, column
|
|
6
|
+
* sizing/visibility) is a config away. sorting cycles none -> asc -> desc -> none on a
|
|
7
|
+
* sortable header (a real <button>, so it is keyboard-operable), exposes aria-sort on the
|
|
8
|
+
* <th>, and shows a lucide chevron indicator. selection reuses the existing .check-box control:
|
|
9
|
+
* a header checkbox selects/clears all (with an indeterminate middle state) and
|
|
10
|
+
* each row carries its own. selected rows get a subtle highlight.
|
|
11
|
+
*
|
|
12
|
+
* sort + selection are each independently controlled OR uncontrolled:
|
|
13
|
+
* - sort: pass `sort` + `onSortChange` to control; otherwise `defaultSort` seeds it.
|
|
14
|
+
* - selection: pass `selectedKeys` + `onSelectionChange` to control; otherwise
|
|
15
|
+
* `defaultSelectedKeys` seeds it.
|
|
16
|
+
*
|
|
17
|
+
* @typedef {Object} DataTableColumn
|
|
18
|
+
* @property {string} key object key this column reads from each row.
|
|
19
|
+
* @property {React.ReactNode} label header text (kept as passed; not forced-lowercase).
|
|
20
|
+
* @property {boolean} [sortable] when true the header sorts; default false.
|
|
21
|
+
* @property {'left'|'right'|'center'} [align] cell alignment; 'right' also gets tabular nums. default 'left'.
|
|
22
|
+
* @property {string} [width] optional fixed column width (any css length, e.g. '12rem'); emits a <colgroup> entry so columns stay put as cell content changes.
|
|
23
|
+
* @property {(value: any, row: Object) => React.ReactNode} [render] custom cell renderer; falls back to row[key].
|
|
24
|
+
*
|
|
25
|
+
* @typedef {{ key: string, dir: 'asc'|'desc' } | null} DataTableSort
|
|
26
|
+
*
|
|
27
|
+
* @param {Object} props
|
|
28
|
+
* @param {DataTableColumn[]} props.columns column definitions.
|
|
29
|
+
* @param {Object[]} props.rows row objects.
|
|
30
|
+
* @param {boolean} [props.selectable=false] render the selection column.
|
|
31
|
+
* @param {(row: Object, index: number) => (string|number)} [props.rowKey] stable key per row; defaults to row.id ?? index.
|
|
32
|
+
* @param {DataTableSort} [props.defaultSort=null] initial sort (uncontrolled).
|
|
33
|
+
* @param {DataTableSort} [props.sort] controlled sort.
|
|
34
|
+
* @param {(next: DataTableSort) => void} [props.onSortChange] called with the next sort state.
|
|
35
|
+
* @param {Array<string|number>} [props.defaultSelectedKeys=[]] initial selection (uncontrolled).
|
|
36
|
+
* @param {Array<string|number>} [props.selectedKeys] controlled selection.
|
|
37
|
+
* @param {(keys: Array<string|number>) => void} [props.onSelectionChange] called with the next selection.
|
|
38
|
+
* @param {string} [props.caption] accessible <caption> for the table (visually present, mono/quiet).
|
|
39
|
+
* @param {string} [props.className] extra class on the scroll wrapper.
|
|
40
|
+
*/
|
|
41
|
+
export default function DataTable({ columns, rows, selectable, rowKey, defaultSort, sort: sortProp, onSortChange, defaultSelectedKeys, selectedKeys: selectedProp, onSelectionChange, caption, className, }: {
|
|
42
|
+
columns: DataTableColumn[];
|
|
43
|
+
rows: any[];
|
|
44
|
+
selectable?: boolean;
|
|
45
|
+
rowKey?: (row: any, index: number) => (string | number);
|
|
46
|
+
defaultSort?: DataTableSort;
|
|
47
|
+
sort?: DataTableSort;
|
|
48
|
+
onSortChange?: (next: DataTableSort) => void;
|
|
49
|
+
defaultSelectedKeys?: Array<string | number>;
|
|
50
|
+
selectedKeys?: Array<string | number>;
|
|
51
|
+
onSelectionChange?: (keys: Array<string | number>) => void;
|
|
52
|
+
caption?: string;
|
|
53
|
+
className?: string;
|
|
54
|
+
}): any;
|
|
55
|
+
/**
|
|
56
|
+
* a sortable + selectable data table. square, hairline, mono headers; both themes
|
|
57
|
+
* via tokens. sort + selection state/logic are powered by TanStack Table
|
|
58
|
+
* (@tanstack/react-table, headless) while this component still renders its own markup
|
|
59
|
+
* + token classes, so the look is unchanged and growth (filtering, pagination, column
|
|
60
|
+
* sizing/visibility) is a config away. sorting cycles none -> asc -> desc -> none on a
|
|
61
|
+
* sortable header (a real <button>, so it is keyboard-operable), exposes aria-sort on the
|
|
62
|
+
* <th>, and shows a lucide chevron indicator. selection reuses the existing .check-box control:
|
|
63
|
+
* a header checkbox selects/clears all (with an indeterminate middle state) and
|
|
64
|
+
* each row carries its own. selected rows get a subtle highlight.
|
|
65
|
+
*
|
|
66
|
+
* sort + selection are each independently controlled OR uncontrolled:
|
|
67
|
+
* - sort: pass `sort` + `onSortChange` to control; otherwise `defaultSort` seeds it.
|
|
68
|
+
* - selection: pass `selectedKeys` + `onSelectionChange` to control; otherwise
|
|
69
|
+
* `defaultSelectedKeys` seeds it.
|
|
70
|
+
*/
|
|
71
|
+
export type DataTableColumn = {
|
|
72
|
+
/**
|
|
73
|
+
* object key this column reads from each row.
|
|
74
|
+
*/
|
|
75
|
+
key: string;
|
|
76
|
+
/**
|
|
77
|
+
* header text (kept as passed; not forced-lowercase).
|
|
78
|
+
*/
|
|
79
|
+
label: React.ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* when true the header sorts; default false.
|
|
82
|
+
*/
|
|
83
|
+
sortable?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* cell alignment; 'right' also gets tabular nums. default 'left'.
|
|
86
|
+
*/
|
|
87
|
+
align?: "left" | "right" | "center";
|
|
88
|
+
/**
|
|
89
|
+
* optional fixed column width (any css length, e.g. '12rem'); emits a <colgroup> entry so columns stay put as cell content changes.
|
|
90
|
+
*/
|
|
91
|
+
width?: string;
|
|
92
|
+
/**
|
|
93
|
+
* custom cell renderer; falls back to row[key].
|
|
94
|
+
*/
|
|
95
|
+
render?: (value: any, row: any) => React.ReactNode;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* a sortable + selectable data table. square, hairline, mono headers; both themes
|
|
99
|
+
* via tokens. sort + selection state/logic are powered by TanStack Table
|
|
100
|
+
* (@tanstack/react-table, headless) while this component still renders its own markup
|
|
101
|
+
* + token classes, so the look is unchanged and growth (filtering, pagination, column
|
|
102
|
+
* sizing/visibility) is a config away. sorting cycles none -> asc -> desc -> none on a
|
|
103
|
+
* sortable header (a real <button>, so it is keyboard-operable), exposes aria-sort on the
|
|
104
|
+
* <th>, and shows a lucide chevron indicator. selection reuses the existing .check-box control:
|
|
105
|
+
* a header checkbox selects/clears all (with an indeterminate middle state) and
|
|
106
|
+
* each row carries its own. selected rows get a subtle highlight.
|
|
107
|
+
*
|
|
108
|
+
* sort + selection are each independently controlled OR uncontrolled:
|
|
109
|
+
* - sort: pass `sort` + `onSortChange` to control; otherwise `defaultSort` seeds it.
|
|
110
|
+
* - selection: pass `selectedKeys` + `onSelectionChange` to control; otherwise
|
|
111
|
+
* `defaultSelectedKeys` seeds it.
|
|
112
|
+
*/
|
|
113
|
+
export type DataTableSort = {
|
|
114
|
+
key: string;
|
|
115
|
+
dir: "asc" | "desc";
|
|
116
|
+
} | null;
|