@kerfjs/ui 5.0.0-beta.126 → 5.0.0-beta.128

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.
Files changed (51) hide show
  1. package/ai/component-props.json +20 -0
  2. package/ai/public-api-signatures-v1.md +7 -5
  3. package/ai/webawesome-jsx-signatures-v1.md +1 -1
  4. package/dist/browser/editor.js +3 -1
  5. package/dist/{chunk-NR3ZO4LK.js → chunk-7U65KLDL.js} +1 -1
  6. package/dist/chunk-7U65KLDL.js.map +1 -0
  7. package/dist/chunk-BMOZSNDU.js +133 -0
  8. package/dist/chunk-BMOZSNDU.js.map +1 -0
  9. package/dist/chunk-GHV36C6I.js +94 -0
  10. package/dist/chunk-GHV36C6I.js.map +1 -0
  11. package/dist/{chunk-Z3BT2SZE.js → chunk-GQUDCWOD.js} +8 -2
  12. package/dist/chunk-GQUDCWOD.js.map +1 -0
  13. package/dist/{chunk-3SCGTP5O.js → chunk-HD7ZLISK.js} +137 -11
  14. package/dist/chunk-HD7ZLISK.js.map +1 -0
  15. package/dist/column-explorer.d.ts +1 -1
  16. package/dist/column-explorer.js +16 -138
  17. package/dist/column-explorer.js.map +1 -1
  18. package/dist/editor.js +838 -115
  19. package/dist/editor.js.map +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/list-detail-dialog.js +1 -1
  22. package/dist/styles/components/surfaces/editor-frame/editor-frame.css +8 -1
  23. package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +32 -0
  24. package/dist/styles/editor/editor.css +23 -0
  25. package/dist/styles/editor-frame.css +8 -1
  26. package/dist/styles/surface-scaffold.css +32 -0
  27. package/dist/surface-scaffold.d.ts +3 -1
  28. package/dist/surface-scaffold.js +1 -1
  29. package/dist/tree-list.d.ts +2 -2
  30. package/dist/tree-list.js +2 -2
  31. package/dist/{tree-rows-eHnnGLGM.d.ts → tree-rows-Bms5QJvG.d.ts} +3 -0
  32. package/dist/wire-column-explorer.js +1 -92
  33. package/dist/wire-column-explorer.js.map +1 -1
  34. package/dist/workbench-dialog.js +1 -1
  35. package/docs/view.md +19 -0
  36. package/package.json +4 -2
  37. package/ux-demo/recipes/app-shell.tsx +48 -141
  38. package/ux-demo/recipes/collapsible-sidebar.tsx +43 -169
  39. package/ux-demo/recipes/compact-toolbar.tsx +22 -114
  40. package/ux-demo/recipes/composer-form.tsx +14 -104
  41. package/ux-demo/recipes/list-detail-dialog.tsx +38 -84
  42. package/ux-demo/recipes/list-workspace-states.tsx +29 -152
  43. package/ux-demo/recipes/loading-inspector.tsx +30 -174
  44. package/ux-demo/recipes/media-detail.tsx +29 -146
  45. package/ux-demo/recipes/navigation-sidebar.tsx +24 -113
  46. package/ux-demo/recipes/navigation-stack.tsx +7 -43
  47. package/ux-demo/recipes/workspace-header.tsx +2 -66
  48. package/view/generate.mjs +34 -14
  49. package/dist/chunk-3SCGTP5O.js.map +0 -1
  50. package/dist/chunk-NR3ZO4LK.js.map +0 -1
  51. package/dist/chunk-Z3BT2SZE.js.map +0 -1
@@ -1,33 +1,23 @@
1
1
  import '@kerfjs/ui/layout.css';
2
2
  import '@kerfjs/ui/workbench.css';
3
3
 
4
- import { List } from '@kerfjs/ui/list';
5
- import { ListItem } from '@kerfjs/ui/list-item';
6
- import { LucideIcon } from '@kerfjs/ui/lucide-icon';
7
- import { Toolbar } from '@kerfjs/ui/toolbar';
8
- import {
9
- ToolbarButton,
10
- ToolbarControlGroup,
11
- } from '@kerfjs/ui/toolbar-control-group';
12
- import { ToolbarText } from '@kerfjs/ui/toolbar-text';
13
- import { ValueTable, ValueTableRow } from '@kerfjs/ui/value-table';
14
4
  import { wireWorkbench } from '@kerfjs/ui/wire-workbench';
15
- import { Workbench } from '@kerfjs/ui/workbench';
16
5
  import { delegate, signal } from 'kerfjs';
17
- import { Bell, Folder, Inbox, Settings } from 'lucide';
18
6
 
7
+ import { renderRecipeAppShellBar } from '../views/recipe-app-shell-bar.view.js';
8
+ import { renderRecipeAppShellFrame } from '../views/recipe-app-shell-frame.view.js';
9
+ import { renderRecipeAppShellInspector } from '../views/recipe-app-shell-inspector.view.js';
10
+ import { renderRecipeAppShellMainTitle } from '../views/recipe-app-shell-main-title.view.js';
11
+ import { renderRecipeAppShellNavigation } from '../views/recipe-app-shell-navigation.view.js';
12
+ import { renderRecipeAppShellNewTask } from '../views/recipe-app-shell-new-task.view.js';
13
+ import { renderRecipeAppShellRailTitle } from '../views/recipe-app-shell-rail-title.view.js';
14
+ import { renderRecipeAppShellTasks } from '../views/recipe-app-shell-tasks.view.js';
15
+ import { renderRecipeAppShellWorkbench } from '../views/recipe-app-shell-workbench.view.js';
19
16
  import type { RecipeFactory, RecipePresentation } from './types.js';
20
17
 
21
18
  const NAVIGATION_ACTION = 'recipe-shell-toggle-navigation';
22
19
  const INSPECTOR_ACTION = 'recipe-shell-toggle-inspector';
23
20
 
24
- const tasks = [
25
- ['Release accessibility audit', 'Interface systems · due this week'],
26
- ['Prepare tablet navigation', 'Interface systems · due this week'],
27
- ['Review stale-data states', 'Platform · due next week'],
28
- ['Confirm package boundaries', 'Platform · due next week'],
29
- ] as const;
30
-
31
21
  export const presentation: RecipePresentation = {
32
22
  viewport: {
33
23
  width: 'full',
@@ -49,133 +39,50 @@ export const createRecipe: RecipeFactory = (announce) => {
49
39
 
50
40
  const navigation = () => (
51
41
  <nav aria-label="Workspace">
52
- <List gap="2xs">
53
- <ListItem
54
- action="recipe-action"
55
- itemId="inbox"
56
- label="Inbox"
57
- icon={<LucideIcon icon={Inbox} name="inbox" />}
58
- selected={selected.value === 'inbox'}
59
- />
60
- <ListItem
61
- action="recipe-action"
62
- itemId="projects"
63
- label="Projects with a Deliberately Wrapping Title"
64
- icon={<LucideIcon icon={Folder} name="folder" />}
65
- selected={selected.value === 'projects'}
66
- multiline
67
- />
68
- </List>
42
+ {renderRecipeAppShellNavigation({
43
+ inboxSelected: selected.value === 'inbox',
44
+ projectsSelected: selected.value === 'projects',
45
+ })}
69
46
  </nav>
70
47
  );
71
48
 
72
- const render = () => (
73
- <List fill rootAttributes={{ 'data-recipe': 'recipe-app-shell' }}>
74
- <Toolbar
75
- label="Atlas Workspace"
76
- safeAreaEdges={['block-start', 'inline-start', 'inline-end']}
77
- dividerSides="b"
78
- leading={<ToolbarText text="Atlas" />}
79
- trailing={
80
- <ToolbarControlGroup
81
- appearance="borderless"
82
- label="Workspace Controls"
83
- >
84
- <ToolbarButton
85
- ariaLabel="Notifications"
86
- action="recipe-action"
87
- rootAttributes={{ 'data-recipe-command': 'notify' }}
88
- icon={<LucideIcon icon={Bell} name="bell" />}
89
- />
90
- <ToolbarButton
91
- ariaLabel="Settings"
92
- action="recipe-action"
93
- rootAttributes={{ 'data-recipe-command': 'settings' }}
94
- icon={<LucideIcon icon={Settings} name="settings" />}
95
- />
96
- </ToolbarControlGroup>
97
- }
98
- />
99
- <List flex>
100
- <Workbench
101
- id="recipe-shell"
102
- label="Atlas Workspace Panes"
103
- leftRail={{
104
- label: 'Navigation',
105
- size: navigationSize.value,
106
- resizable: { min: 180, max: 320 },
107
- collapsed: navigationCollapsed.value,
108
- toolbar: {
109
- label: 'Navigation',
110
- title: <ToolbarText text="Workspace" />,
111
- toggle: { action: NAVIGATION_ACTION, name: 'Navigation' },
49
+ const render = () =>
50
+ renderRecipeAppShellFrame(
51
+ {},
52
+ {
53
+ bar: renderRecipeAppShellBar,
54
+ workbench: () =>
55
+ renderRecipeAppShellWorkbench(
56
+ {
57
+ navigationSize: navigationSize.value,
58
+ inspectorSize: inspectorSize.value,
59
+ navigationCollapsed: navigationCollapsed.value,
60
+ inspectorCollapsed: inspectorCollapsed.value,
112
61
  },
113
- content: navigation(),
114
- }}
115
- mainToolbar={{
116
- label: 'Current Workspace View',
117
- title: (
118
- <ToolbarText
119
- text={
120
- selected.value === 'inbox'
121
- ? 'Inbox Triage'
122
- : 'Active Projects'
123
- }
124
- size="xlarge"
125
- id="recipe-shell-main-title"
126
- />
127
- ),
128
- responsive: 'wrap',
129
- trailing: (
130
- <ToolbarControlGroup
131
- appearance="borderless"
132
- content="text"
133
- single
134
- >
135
- <ToolbarButton
136
- action="recipe-action"
137
- rootAttributes={{ 'data-recipe-command': 'new' }}
138
- >
139
- New Task
140
- </ToolbarButton>
141
- </ToolbarControlGroup>
142
- ),
143
- }}
144
- main={
145
- <section aria-label="Tasks">
146
- {tasks.map(([title, detail]) => (
147
- <ListItem
148
- action="recipe-action"
149
- label={title}
150
- description={detail}
151
- multiline
152
- rootAttributes={{ 'data-recipe-command': 'open-task' }}
153
- />
154
- ))}
155
- </section>
156
- }
157
- rightRail={{
158
- label: 'Inspector',
159
- size: inspectorSize.value,
160
- resizable: { min: 200, max: 360 },
161
- collapsed: inspectorCollapsed.value,
162
- toolbar: {
163
- label: 'Inspector',
164
- title: <ToolbarText text="Inspector" />,
165
- toggle: { action: INSPECTOR_ACTION, name: 'Inspector' },
62
+ {
63
+ navigationTitle: () =>
64
+ renderRecipeAppShellRailTitle({ text: 'Workspace' }),
65
+ navigation,
66
+ mainTitle: () =>
67
+ renderRecipeAppShellMainTitle({
68
+ text:
69
+ selected.value === 'inbox'
70
+ ? 'Inbox Triage'
71
+ : 'Active Projects',
72
+ }),
73
+ newTask: renderRecipeAppShellNewTask,
74
+ main: () => (
75
+ <section aria-label="Tasks">
76
+ {renderRecipeAppShellTasks()}
77
+ </section>
78
+ ),
79
+ inspectorTitle: () =>
80
+ renderRecipeAppShellRailTitle({ text: 'Inspector' }),
81
+ inspector: renderRecipeAppShellInspector,
166
82
  },
167
- content: (
168
- <ValueTable label="Selected Task">
169
- <ValueTableRow label="Status" value="In review" />
170
- <ValueTableRow label="Owner" value="Mara Chen" />
171
- <ValueTableRow label="Priority" value="High" />
172
- </ValueTable>
173
- ),
174
- }}
175
- />
176
- </List>
177
- </List>
178
- );
83
+ ),
84
+ },
85
+ );
179
86
 
180
87
  return {
181
88
  render,
@@ -2,29 +2,18 @@ import '@kerfjs/ui/layout.css';
2
2
  import '@kerfjs/ui/collapsible-panel.css';
3
3
  import '@kerfjs/ui/floating-toolbar.css';
4
4
 
5
- import {
6
- CollapsiblePanel,
7
- CollapsiblePanelRelocated,
8
- type CollapsiblePanelToolbar,
9
- } from '@kerfjs/ui/collapsible-panel';
10
- import { ContentItem } from '@kerfjs/ui/content-item';
5
+ import { type CollapsiblePanelToolbar } from '@kerfjs/ui/collapsible-panel';
11
6
  import { deviceClass } from '@kerfjs/ui/device-class';
12
- import { FloatingToolbar } from '@kerfjs/ui/floating-toolbar';
13
- import { Grid } from '@kerfjs/ui/grid';
14
- import { List } from '@kerfjs/ui/list';
15
- import { ListHeader } from '@kerfjs/ui/list-header';
16
- import { ListItem } from '@kerfjs/ui/list-item';
17
- import { LucideIcon } from '@kerfjs/ui/lucide-icon';
18
- import { Pane } from '@kerfjs/ui/pane';
19
- import { Row } from '@kerfjs/ui/row';
20
- import { Text } from '@kerfjs/ui/text';
21
- import { Toolbar } from '@kerfjs/ui/toolbar';
22
- import { ToolbarText } from '@kerfjs/ui/toolbar-text';
23
- import { ValueTable, ValueTableRow } from '@kerfjs/ui/value-table';
24
7
  import { type SidebarStorage, wireSidebar } from '@kerfjs/ui/wire-sidebar';
25
8
  import { signal } from 'kerfjs';
26
- import { Bell, Folder, Inbox, Users } from 'lucide';
27
9
 
10
+ import { renderRecipeCollapsibleSidebar } from '../views/recipe-collapsible-sidebar.view.js';
11
+ import { renderRecipeSidebarDrawerTitle } from '../views/recipe-sidebar-drawer-title.view.js';
12
+ import { renderRecipeSidebarNavHeader } from '../views/recipe-sidebar-nav-header.view.js';
13
+ import { renderRecipeSidebarNavInbox } from '../views/recipe-sidebar-nav-inbox.view.js';
14
+ import { renderRecipeSidebarNavProjects } from '../views/recipe-sidebar-nav-projects.view.js';
15
+ import { renderRecipeSidebarNavShared } from '../views/recipe-sidebar-nav-shared.view.js';
16
+ import { renderRecipeSidebarRailTitle } from '../views/recipe-sidebar-rail-title.view.js';
28
17
  import type { RecipeFactory, RecipePresentation } from './types.js';
29
18
 
30
19
  const RAIL_ACTION = 'recipe-sidebar-rail';
@@ -42,10 +31,7 @@ export const presentation: RecipePresentation = {
42
31
  note: "The app owns each panel's collapsed signal, sizes, and content; wireSidebar owns the toggle, focus move/restore, the compact overlay, and persistence.",
43
32
  };
44
33
 
45
- /**
46
- * A memory-backed store so the recipe demonstrates the persistence hook without
47
- * writing to the shared `localStorage` the catalog page runs in.
48
- */
34
+ /** Memory storage demonstrates persistence without changing the catalog page. */
49
35
  function memoryStorage(): SidebarStorage {
50
36
  const map = new Map<string, string>();
51
37
  return {
@@ -64,166 +50,54 @@ const labels: Record<string, string> = {
64
50
 
65
51
  export const createRecipe: RecipeFactory = (announce) => {
66
52
  const selected = signal('inbox');
67
- // A shared window-backed device class: when the viewport is compact the wire
68
- // switches the rail/drawer to a dismissable overlay presentation.
69
53
  const device = deviceClass();
70
- // A compact overlay only opens on a user action, so the first render already
71
- // matches: collapsed on a compact device, open inline otherwise. The wire's
72
- // `inlineCollapsed` keeps the open inline default for a later wide crossing.
73
54
  const railCollapsed = signal(device.value.compact);
74
55
  const drawerCollapsed = signal(true);
75
56
  const storage = memoryStorage();
76
57
 
77
- // Each panel composes its own toolbar with the standard toggle last. While a
78
- // panel is collapsed, CollapsiblePanelRelocated carries that toggle: the
79
- // rail's leads the main toolbar, the drawer's floats in its container's
80
- // bottom-end corner. wireSidebar hands focus between the two positions.
81
58
  const railToolbar: CollapsiblePanelToolbar = {
82
59
  label: 'Workspace Navigation',
83
- title: <ToolbarText text="Atlas" />,
60
+ title: renderRecipeSidebarRailTitle({}),
84
61
  toggle: { action: RAIL_ACTION, name: 'Navigation' },
85
62
  };
86
63
  const drawerToolbar: CollapsiblePanelToolbar = {
87
64
  label: 'Activity',
88
- title: <ToolbarText text="Activity" size="small" />,
65
+ title: renderRecipeSidebarDrawerTitle({}),
89
66
  toggle: { action: DRAWER_ACTION, name: 'Activity' },
90
67
  };
91
68
 
92
- const rail = () => (
93
- <CollapsiblePanel
94
- id="sidebar-rail"
95
- side="left"
96
- size={232}
97
- collapsed={railCollapsed.value}
98
- label="Workspace Navigation"
99
- toolbar={railToolbar}
100
- >
101
- <nav aria-label="Workspace">
102
- <section>
103
- <ListHeader label="Workspace" />
104
- <ListItem
105
- action="recipe-action"
106
- itemId="inbox"
107
- label="Inbox"
108
- icon={<LucideIcon icon={Inbox} name="inbox" />}
109
- trailing={<span>12</span>}
110
- selected={selected.value === 'inbox'}
111
- />
112
- <ListItem
113
- action="recipe-action"
114
- itemId="projects"
115
- label="Projects"
116
- icon={<LucideIcon icon={Folder} name="folder" />}
117
- selected={selected.value === 'projects'}
118
- />
119
- <ListItem
120
- action="recipe-action"
121
- itemId="shared"
122
- label="Shared with Me"
123
- icon={<LucideIcon icon={Users} name="users" />}
124
- selected={selected.value === 'shared'}
125
- />
126
- </section>
127
- </nav>
128
- </CollapsiblePanel>
129
- );
130
-
131
- const main = () => (
132
- <Pane
133
- element="main"
134
- header={
135
- <Toolbar
136
- label="Current Navigation View"
137
- leading={
138
- <>
139
- <CollapsiblePanelRelocated
140
- panelId="sidebar-rail"
141
- side="left"
142
- collapsed={railCollapsed.value}
143
- toolbar={railToolbar}
144
- />
145
- <ToolbarText
146
- text={labels[selected.value] ?? 'Inbox'}
147
- size="xlarge"
148
- id="recipe-collapsible-main-title"
149
- />
150
- </>
151
- }
152
- />
153
- }
154
- >
155
- <ContentItem>
156
- <List gap="2xs">
157
- <Text variant="span" weight="strong">
158
- Compact Width
159
- </Text>
160
- <Text variant="span" tone="quiet" size="compact">
161
- Narrow the window to a compact width: the rail and drawer start
162
- closed and open as a dismissable overlay, with a backdrop, Escape,
163
- and a trapped Tab ring, all managed by the wire.
164
- </Text>
165
- </List>
166
- </ContentItem>
167
- </Pane>
168
- );
169
-
170
- const drawer = () => (
171
- <CollapsiblePanel
172
- id="sidebar-console"
173
- side="bottom"
174
- size={168}
175
- collapsed={drawerCollapsed.value}
176
- label="Activity"
177
- toolbar={drawerToolbar}
178
- restoreControl={
179
- <FloatingToolbar label="Activity Drawer">
180
- <CollapsiblePanelRelocated
181
- panelId="sidebar-console"
182
- side="bottom"
183
- collapsed={drawerCollapsed.value}
184
- toolbar={drawerToolbar}
185
- />
186
- </FloatingToolbar>
187
- }
188
- >
189
- <ValueTable label="Recent Activity">
190
- <ValueTableRow
191
- label="Deploy finished"
192
- value="2m ago"
193
- icon={<LucideIcon icon={Bell} name="bell" />}
194
- />
195
- <ValueTableRow
196
- label="Review requested"
197
- value="9m ago"
198
- icon={<LucideIcon icon={Bell} name="bell" />}
199
- />
200
- </ValueTable>
201
- </CollapsiblePanel>
202
- );
203
-
204
- // The root Row fills the frame's definite height with the rail beside a
205
- // column whose main pane grows above the bottom drawer. Each CollapsiblePanel
206
- // docks to a real frame edge, so it paints through that edge's safe area and
207
- // hands the edge back to its siblings when it collapses.
208
- const render = () => (
209
- <Row
210
- gap="none"
211
- fill
212
- rootAttributes={{
213
- 'data-recipe': 'recipe-collapsible-sidebar',
214
- 'data-rail-collapsed': String(railCollapsed.value),
215
- 'data-drawer-collapsed': String(drawerCollapsed.value),
216
- }}
217
- >
218
- {rail()}
219
- <List flex>
220
- <Grid columns={1} gap="none" flex>
221
- {main()}
222
- </Grid>
223
- {drawer()}
224
- </List>
225
- </Row>
226
- );
69
+ const render = () => {
70
+ const rail = railCollapsed.value;
71
+ const drawer = drawerCollapsed.value;
72
+ const item = selected.value;
73
+ return renderRecipeCollapsibleSidebar(
74
+ {
75
+ railCollapsed: rail,
76
+ drawerCollapsed: drawer,
77
+ railCollapsedText: String(rail),
78
+ drawerCollapsedText: String(drawer),
79
+ railToolbar,
80
+ railRelocatedToolbar: railToolbar,
81
+ drawerToolbar,
82
+ drawerRelocatedToolbar: drawerToolbar,
83
+ selectedLabel: labels[item] ?? 'Inbox',
84
+ },
85
+ {
86
+ navigation: () => (
87
+ <nav aria-label="Workspace">
88
+ <section>
89
+ {renderRecipeSidebarNavHeader({})}
90
+ {renderRecipeSidebarNavInbox({ selected: item === 'inbox' })}
91
+ {renderRecipeSidebarNavProjects({
92
+ selected: item === 'projects',
93
+ })}
94
+ {renderRecipeSidebarNavShared({ selected: item === 'shared' })}
95
+ </section>
96
+ </nav>
97
+ ),
98
+ },
99
+ );
100
+ };
227
101
 
228
102
  return {
229
103
  render,
@@ -2,31 +2,11 @@ import '@kerfjs/ui/layout.css';
2
2
  import '@kerfjs/ui/select/register';
3
3
 
4
4
  import { deviceClass } from '@kerfjs/ui/device-class';
5
- import { Grid } from '@kerfjs/ui/grid';
6
- import { List } from '@kerfjs/ui/list';
7
- import { ListInsetText } from '@kerfjs/ui/list-inset-text';
8
- import { LucideIcon } from '@kerfjs/ui/lucide-icon';
9
- import { SegmentedControl } from '@kerfjs/ui/segmented-control';
10
- import { Select } from '@kerfjs/ui/select';
11
- import { Text } from '@kerfjs/ui/text';
12
- import { Toolbar } from '@kerfjs/ui/toolbar';
13
- import {
14
- ToolbarButton,
15
- ToolbarControlGroup,
16
- } from '@kerfjs/ui/toolbar-control-group';
17
- import { ToolbarText } from '@kerfjs/ui/toolbar-text';
18
5
  import { signal } from 'kerfjs';
19
- import { Ellipsis, Funnel, RefreshCw } from 'lucide';
20
6
 
7
+ import { renderRecipeCompactToolbar } from '../views/recipe-compact-toolbar.view.js';
21
8
  import type { RecipeFactory, RecipePresentation } from './types.js';
22
9
 
23
- const guide = [
24
- ['ToolbarControlGroup', 'Related commands or pressed tools.'],
25
- ['SegmentedControl', 'A few visible exclusive choices.'],
26
- ['Select', 'A longer controlled value list.'],
27
- ['Ordinary button', 'One independent command.'],
28
- ] as const;
29
-
30
10
  export const presentation: RecipePresentation = {
31
11
  viewport: {
32
12
  width: 'full',
@@ -39,108 +19,30 @@ export const presentation: RecipePresentation = {
39
19
  };
40
20
 
41
21
  export const createRecipe: RecipeFactory = (announce) => {
42
- const view = signal('list');
43
- const sort = signal('updated');
22
+ const view = signal<'list' | 'board' | 'timeline'>('list');
23
+ const sort = signal<'updated' | 'priority' | 'owner' | 'created'>('updated');
44
24
  const filtered = signal(false);
45
25
  const device = deviceClass();
46
26
  const render = () => (
47
27
  <section data-recipe="recipe-compact-toolbar" aria-label="Task Workspace">
48
- <List gap="l" controlInsets="b">
49
- <Toolbar
50
- label="Task Workspace Controls"
51
- responsive="stack"
52
- responsiveAt="compact"
53
- leading={<ToolbarText text="Tasks" size="small" />}
54
- center={
55
- <ToolbarControlGroup>
56
- <SegmentedControl<string>
57
- id="recipe-view"
58
- label="View"
59
- value={view.value}
60
- action="recipe-action"
61
- appearance="toolbar"
62
- shape="pill"
63
- size="compact"
64
- choices={[
65
- { value: 'list', label: 'List' },
66
- { value: 'board', label: 'Board' },
67
- { value: 'timeline', label: 'Timeline' },
68
- ]}
69
- />
70
- </ToolbarControlGroup>
71
- }
72
- trailing={
73
- <>
74
- <ToolbarControlGroup single focusRing="outline">
75
- <Select<string>
76
- name="recipe-sort"
77
- value={sort.value}
78
- ariaLabel="Sort Tasks"
79
- fitMenu
80
- presentation="toolbar-borderless"
81
- size="compact"
82
- focusRingOwner="group"
83
- choices={[
84
- { value: 'updated', label: 'Recently Updated' },
85
- { value: 'priority', label: 'Priority' },
86
- { value: 'owner', label: 'Owner' },
87
- { value: 'created', label: 'Created Date' },
88
- ]}
89
- />
90
- </ToolbarControlGroup>
91
- <ToolbarControlGroup label="Task Actions" buttonAppearance="push">
92
- <ToolbarButton
93
- ariaLabel="Toggle Filters"
94
- pressed={filtered.value}
95
- action="recipe-action"
96
- rootAttributes={{ 'data-recipe-command': 'filter' }}
97
- icon={<LucideIcon icon={Funnel} name="funnel" />}
98
- />
99
- <ToolbarButton
100
- ariaLabel="Refresh Tasks"
101
- action="recipe-action"
102
- rootAttributes={{ 'data-recipe-command': 'refresh' }}
103
- icon={<LucideIcon icon={RefreshCw} name="refresh-cw" />}
104
- />
105
- </ToolbarControlGroup>
106
- <ToolbarControlGroup label="More Task Actions" single>
107
- <ToolbarButton
108
- ariaLabel="More Task Actions"
109
- action="recipe-action"
110
- rootAttributes={{ 'data-recipe-command': 'more' }}
111
- icon={<LucideIcon icon={Ellipsis} name="ellipsis" />}
112
- />
113
- </ToolbarControlGroup>
114
- </>
115
- }
116
- />
117
- <Grid
118
- columns={
119
- device.value.compact ? 1 : device.value.atLeast('desktop') ? 4 : 2
120
- }
121
- gap="none"
122
- >
123
- {guide.map(([name, use]) => (
124
- <ListInsetText>
125
- <List gap="2xs">
126
- <Text variant="span" weight="strong">
127
- {name}
128
- </Text>
129
- <Text variant="span" tone="quiet" size="compact">
130
- {use}
131
- </Text>
132
- </List>
133
- </ListInsetText>
134
- ))}
135
- </Grid>
136
- </List>
28
+ {renderRecipeCompactToolbar({
29
+ view: view.value,
30
+ sort: sort.value,
31
+ filtered: filtered.value,
32
+ columns: device.value.compact
33
+ ? 1
34
+ : device.value.atLeast('desktop')
35
+ ? 4
36
+ : 2,
37
+ })}
137
38
  </section>
138
39
  );
139
40
  return {
140
41
  render,
141
42
  action(command, element) {
142
43
  const value = element.dataset.segmentValue;
143
- if (value) view.value = value;
44
+ if (value === 'list' || value === 'board' || value === 'timeline')
45
+ view.value = value;
144
46
  if (command === 'filter') filtered.value = !filtered.value;
145
47
  announce(
146
48
  value
@@ -152,7 +54,13 @@ export const createRecipe: RecipeFactory = (announce) => {
152
54
  },
153
55
  change(element) {
154
56
  const value = (element as HTMLElement & { value?: string }).value;
155
- if (element.getAttribute('name') === 'recipe-sort' && value) {
57
+ if (
58
+ element.getAttribute('name') === 'recipe-sort' &&
59
+ (value === 'updated' ||
60
+ value === 'priority' ||
61
+ value === 'owner' ||
62
+ value === 'created')
63
+ ) {
156
64
  sort.value = value;
157
65
  announce(`Sort: ${value}`);
158
66
  }