@hanzo/build 0.2.70 → 0.2.72
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/lib/summary.js +8 -5
- package/package.json +1 -1
package/lib/summary.js
CHANGED
|
@@ -12,18 +12,21 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
12
12
|
*/
|
|
13
13
|
import { useMemo, useState } from 'react';
|
|
14
14
|
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
15
|
-
import { ListTodo } from '@hanzogui/lucide-icons-2';
|
|
15
|
+
import { FilePlus2, ListTodo } from '@hanzogui/lucide-icons-2';
|
|
16
16
|
import { Popover, PopoverContent, PopoverTrigger } from '@hanzo/ui';
|
|
17
|
+
/** A row's pitch and inset, px: the kit menu's, so this panel reads as every other one. */
|
|
18
|
+
const ROW_H = 32;
|
|
19
|
+
const ROW_PX = 8;
|
|
17
20
|
/** A row of the summary: its mark and its name, one press from a tab. */
|
|
18
21
|
function Line({ icon, children, detail, onPress, quiet = false }) {
|
|
19
|
-
return (_jsxs(XStack, { render: onPress ? 'button' : undefined, role: onPress ? 'button' : undefined, onPress: onPress, items: "center",
|
|
22
|
+
return (_jsxs(XStack, { render: onPress ? 'button' : undefined, role: onPress ? 'button' : undefined, onPress: onPress, items: "center", justify: "flex-start", gap: ROW_PX, px: ROW_PX, minH: ROW_H, width: "100%", rounded: 4, cursor: onPress ? 'pointer' : undefined, hoverStyle: onPress ? { bg: '$hover' } : undefined, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: [icon ? (_jsx(XStack, { width: 16, justify: "center", shrink: 0, opacity: 0.75, children: icon })) : null, _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", py: detail ? '$1' : 0, children: [_jsx(SizableText, { fontSize: 14, color: quiet ? '$soft' : '$ink', numberOfLines: 1, style: { textAlign: 'left' }, children: children }), detail ? (_jsx(SizableText, { fontSize: 12, color: "$soft", numberOfLines: 2, style: { textAlign: 'left' }, children: detail })) : null] })] }));
|
|
20
23
|
}
|
|
21
24
|
/** A section's heading, with what it adds at its end. */
|
|
22
|
-
const Head = ({ children, action }) => (_jsxs(XStack, { items: "center", justify: "space-between", px:
|
|
25
|
+
const Head = ({ children, action }) => (_jsxs(XStack, { items: "center", justify: "space-between", px: ROW_PX, minH: ROW_H, children: [_jsx(SizableText, { fontSize: 13, color: "$soft", children: children }), action] }));
|
|
23
26
|
/** One section's rows; `done` runs after a row is pressed (the popover puts itself away). */
|
|
24
27
|
function Rows({ section, done, details = false }) {
|
|
25
28
|
const { entries, empty, lead } = section;
|
|
26
|
-
return (_jsxs(_Fragment, { children: [lead ? (_jsx(Line, {
|
|
29
|
+
return (_jsxs(_Fragment, { children: [lead ? (_jsx(Line, { icon: _jsx(FilePlus2, { size: 15, "aria-hidden": true }), onPress: () => {
|
|
27
30
|
done?.();
|
|
28
31
|
lead.run();
|
|
29
32
|
}, children: lead.title })) : null, entries.map((e) => (_jsx(Line, { icon: e.icon, detail: details ? e.detail : undefined, onPress: e.open
|
|
@@ -43,7 +46,7 @@ export function Summary({ sections, onOpen, label = 'Summary' }) {
|
|
|
43
46
|
setOpen(false);
|
|
44
47
|
onOpen?.();
|
|
45
48
|
};
|
|
46
|
-
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, allowFlip: true, children: [_jsx(PopoverTrigger, { children: _jsx(XStack, { render: "button", "data-slot": "summary-toggle", "aria-label": label, "aria-haspopup": "dialog", "aria-expanded": open, ...{ title: label }, width: 32, height: 32, rounded: "$3", items: "center", justify: "center", cursor: "pointer", bg: open ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: _jsx(ListTodo, { size: 16, "aria-hidden": true }) }) }), _jsx(PopoverContent, { solid: true, align: "end", p:
|
|
49
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, allowFlip: true, children: [_jsx(PopoverTrigger, { children: _jsx(XStack, { render: "button", "data-slot": "summary-toggle", "aria-label": label, "aria-haspopup": "dialog", "aria-expanded": open, ...{ title: label }, width: 32, height: 32, rounded: "$3", items: "center", justify: "center", cursor: "pointer", bg: open ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: _jsx(ListTodo, { size: 16, "aria-hidden": true }) }) }), _jsx(PopoverContent, { solid: true, align: "end", sideOffset: 8, p: 4, width: 288, maxW: "calc(100vw - 24px)", children: _jsx(YStack, { "data-slot": "summary", role: "dialog", "aria-label": label, self: "stretch", width: "100%", maxH: "min(70dvh, 520px)", overflowY: "auto", overflowX: "hidden", children: sections.map((s, i) => (_jsxs(YStack, { children: [i ? _jsx(XStack, { height: 1, bg: "$borderColor", my: 4, mx: 4 }) : null, _jsx(Head, { action: s.action, children: s.title }), _jsx(Rows, { section: s, done: done })] }, s.id))) }) })] }));
|
|
47
50
|
}
|
|
48
51
|
/** Each section as a kind of tab for `Panel`: the same rows, with their second lines. */
|
|
49
52
|
export function kinds(sections, icons = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/build",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.72",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"description": "Hanzo Build — say what you want, watch it built, deployed and running. The builder as a component, mounted by the Hanzo app at hanzo.ai.",
|