@hanzo/ui 8.0.61 → 8.0.63
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/dist/backends/gui/input.cjs +4 -3
- package/dist/backends/gui/input.d.ts +10 -2
- package/dist/backends/gui/input.d.ts.map +1 -1
- package/dist/backends/gui/input.js +4 -3
- package/dist/backends/gui/input.js.map +1 -1
- package/dist/backends/gui/mask.cjs +20 -0
- package/dist/backends/gui/mask.d.ts +17 -0
- package/dist/backends/gui/mask.d.ts.map +1 -0
- package/dist/backends/gui/mask.js +17 -0
- package/dist/backends/gui/mask.js.map +1 -0
- package/dist/backends/gui/switch.cjs +16 -2
- package/dist/backends/gui/switch.d.ts +14 -0
- package/dist/backends/gui/switch.d.ts.map +1 -1
- package/dist/backends/gui/switch.js +16 -2
- package/dist/backends/gui/switch.js.map +1 -1
- package/dist/chat/Code.cjs +1 -1
- package/dist/chat/Code.d.ts.map +1 -1
- package/dist/chat/Code.js +1 -1
- package/dist/chat/Code.js.map +1 -1
- package/dist/core/css.cjs +114 -0
- package/dist/core/css.d.ts +46 -0
- package/dist/core/css.d.ts.map +1 -0
- package/dist/core/css.js +112 -0
- package/dist/core/css.js.map +1 -0
- package/dist/product/CopyButton.cjs +16 -2
- package/dist/product/CopyButton.d.ts +30 -3
- package/dist/product/CopyButton.d.ts.map +1 -1
- package/dist/product/CopyButton.js +18 -4
- package/dist/product/CopyButton.js.map +1 -1
- package/dist/product/DataTable.cjs +4 -4
- package/dist/product/DataTable.js +4 -4
- package/dist/product/DataTable.js.map +1 -1
- package/dist/product/FadeIn.cjs +1 -1
- package/dist/product/FadeIn.js +1 -1
- package/dist/product/FadeIn.js.map +1 -1
- package/dist/product/Field.cjs +3 -3
- package/dist/product/Field.d.ts +21 -1
- package/dist/product/Field.d.ts.map +1 -1
- package/dist/product/Field.js +3 -3
- package/dist/product/Field.js.map +1 -1
- package/dist/product/Fieldset.cjs +10 -2
- package/dist/product/Fieldset.d.ts +12 -1
- package/dist/product/Fieldset.d.ts.map +1 -1
- package/dist/product/Fieldset.js +10 -2
- package/dist/product/Fieldset.js.map +1 -1
- package/dist/product/Metric.cjs +7 -4
- package/dist/product/Metric.d.ts +8 -1
- package/dist/product/Metric.d.ts.map +1 -1
- package/dist/product/Metric.js +7 -4
- package/dist/product/Metric.js.map +1 -1
- package/dist/product/Pagination.cjs +9 -49
- package/dist/product/Pagination.d.ts +2 -10
- package/dist/product/Pagination.d.ts.map +1 -1
- package/dist/product/Pagination.js +6 -46
- package/dist/product/Pagination.js.map +1 -1
- package/dist/product/Palette.cjs +65 -0
- package/dist/product/Palette.d.ts +67 -0
- package/dist/product/Palette.d.ts.map +1 -0
- package/dist/product/Palette.js +63 -0
- package/dist/product/Palette.js.map +1 -0
- package/dist/product/Reorder.cjs +1 -1
- package/dist/product/Reorder.js +1 -1
- package/dist/product/Reorder.js.map +1 -1
- package/dist/product/SecretInput.cjs +3 -13
- package/dist/product/SecretInput.d.ts +2 -11
- package/dist/product/SecretInput.d.ts.map +1 -1
- package/dist/product/SecretInput.js +6 -11
- package/dist/product/SecretInput.js.map +1 -1
- package/dist/product/SlideOver.cjs +2 -2
- package/dist/product/SlideOver.js +2 -2
- package/dist/product/SlideOver.js.map +1 -1
- package/dist/product/StatusTag.cjs +10 -39
- package/dist/product/StatusTag.d.ts +6 -2
- package/dist/product/StatusTag.d.ts.map +1 -1
- package/dist/product/StatusTag.js +10 -39
- package/dist/product/StatusTag.js.map +1 -1
- package/dist/product/UserMenu.cjs +4 -10
- package/dist/product/UserMenu.d.ts +2 -3
- package/dist/product/UserMenu.d.ts.map +1 -1
- package/dist/product/UserMenu.js +5 -8
- package/dist/product/UserMenu.js.map +1 -1
- package/dist/product/animatedLogo.logic.cjs +1 -1
- package/dist/product/animatedLogo.logic.js +1 -1
- package/dist/product/brand.cjs +1 -1
- package/dist/product/brand.js +1 -1
- package/dist/product/combobox/filter.cjs +1 -1
- package/dist/product/combobox/filter.js +1 -1
- package/dist/product/index.cjs +21 -3
- package/dist/product/index.d.ts +4 -1
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +20 -1
- package/dist/product/index.js.map +1 -1
- package/dist/product/match.cjs +76 -0
- package/dist/product/match.d.ts +78 -0
- package/dist/product/match.d.ts.map +1 -0
- package/dist/product/match.js +72 -0
- package/dist/product/match.js.map +1 -0
- package/dist/product/name.cjs +17 -0
- package/dist/product/name.d.ts +10 -0
- package/dist/product/name.d.ts.map +1 -0
- package/dist/product/name.js +15 -0
- package/dist/product/name.js.map +1 -0
- package/dist/product/pages.cjs +57 -0
- package/dist/product/pages.d.ts +28 -0
- package/dist/product/pages.d.ts.map +1 -0
- package/dist/product/pages.js +54 -0
- package/dist/product/pages.js.map +1 -0
- package/dist/product/pure.cjs +63 -0
- package/dist/product/pure.d.ts +9 -0
- package/dist/product/pure.d.ts.map +1 -0
- package/dist/product/pure.js +38 -0
- package/dist/product/pure.js.map +1 -0
- package/dist/product/scope.cjs +1 -1
- package/dist/product/scope.js +1 -1
- package/dist/product/social/SocialResource.cjs +1 -1
- package/dist/product/social/SocialResource.js +1 -1
- package/dist/product/social/SocialResource.js.map +1 -1
- package/dist/product/social/SocialSummaryBar.cjs +1 -1
- package/dist/product/social/SocialSummaryBar.js +1 -1
- package/dist/product/social/SocialSummaryBar.js.map +1 -1
- package/dist/product/tone.cjs +105 -0
- package/dist/product/tone.d.ts +52 -0
- package/dist/product/tone.d.ts.map +1 -0
- package/dist/product/tone.js +102 -0
- package/dist/product/tone.js.map +1 -0
- package/dist/product/useCommandK.cjs +46 -0
- package/dist/product/useCommandK.d.ts +4 -0
- package/dist/product/useCommandK.d.ts.map +1 -0
- package/dist/product/useCommandK.js +44 -0
- package/dist/product/useCommandK.js.map +1 -0
- package/dist/styles/motion.css +52 -17
- package/dist/styles.css +53 -20
- package/package.json +31 -3
|
@@ -1,12 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CopyButton — copy with a confirmation tick.
|
|
3
|
+
*
|
|
4
|
+
* The tick is the point. A control that looks identical before and after leaves
|
|
5
|
+
* the reader unsure whether it fired, and the usual response is to press it
|
|
6
|
+
* again. Reverts after `CONFIRM`, and clears its timer on unmount so it cannot
|
|
7
|
+
* set state on a component that is gone.
|
|
8
|
+
*
|
|
9
|
+
* It lived inside `chat/Code.tsx` and was reachable only as `@hanzo/ui/chat`.
|
|
10
|
+
* Nobody looks in a chat module for a copy button, so every surface wrote its
|
|
11
|
+
* own — an API key here, a deposit address there, a referral link, a wire
|
|
12
|
+
* instruction — each with its own confirmation window, or none. Copying text is
|
|
13
|
+
* not a chat idea; it belongs to the product layer, and `Code` now imports it
|
|
14
|
+
* from here rather than owning it.
|
|
15
|
+
*/
|
|
16
|
+
import { type ReactNode } from 'react';
|
|
1
17
|
export interface CopyButtonProps {
|
|
2
18
|
/** The text placed on the clipboard. */
|
|
3
19
|
value: string;
|
|
4
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Visible text beside the glyph — "Copy key", "Copy address". Omit for the
|
|
22
|
+
* bare square the icon form has always been.
|
|
23
|
+
*
|
|
24
|
+
* There is no second prop and no variant to pick, because the two forms differ
|
|
25
|
+
* in exactly one thing: whether the label is drawn. A control standing alone —
|
|
26
|
+
* under a minted key, beside a wire instruction — has no neighbours to explain
|
|
27
|
+
* it, and an unlabeled glyph there is a guess; inside a code header or a table
|
|
28
|
+
* row the label is noise. Passing the text is what asks for it.
|
|
29
|
+
*/
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
/** The tooltip and the accessible name. Defaults to the visible text, else "Copy". */
|
|
5
32
|
label?: string;
|
|
6
|
-
/** Edge of the square
|
|
33
|
+
/** Edge of the glyph's square. Default 24. */
|
|
7
34
|
size?: number;
|
|
8
35
|
/** Names the copied thing in analytics ("api-key", "address"). Never the value. */
|
|
9
36
|
id?: string;
|
|
10
37
|
}
|
|
11
|
-
export declare function CopyButton({ value, label, size, id }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function CopyButton({ value, children, label, size, id }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
12
39
|
//# sourceMappingURL=CopyButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../src/product/CopyButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../src/product/CopyButton.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAUnE,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mFAAmF;IACnF,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAS,EAAE,EAAE,EAAE,EAAE,eAAe,2CAgEpF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
4
|
* CopyButton — copy with a confirmation tick.
|
|
5
5
|
*
|
|
@@ -16,13 +16,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
16
16
|
* from here rather than owning it.
|
|
17
17
|
*/
|
|
18
18
|
import { useEffect, useRef, useState } from 'react';
|
|
19
|
-
import { XStack } from '@hanzo/gui';
|
|
19
|
+
import { Text, XStack } from '@hanzo/gui';
|
|
20
20
|
import { Check, Copy } from '@hanzogui/lucide-icons-2';
|
|
21
21
|
import { tip } from '../backends/gui/slot.js';
|
|
22
22
|
import { useEmit } from './instrument.js';
|
|
23
23
|
/** How long the control shows its confirmation, in ms. */
|
|
24
24
|
const CONFIRM = 2000;
|
|
25
|
-
export function CopyButton({ value, label
|
|
25
|
+
export function CopyButton({ value, children, label, size = 24, id }) {
|
|
26
26
|
const [copied, setCopied] = useState(false);
|
|
27
27
|
const timer = useRef(undefined);
|
|
28
28
|
const track = useEmit();
|
|
@@ -47,6 +47,20 @@ export function CopyButton({ value, label = 'Copy', size = 24, id }) {
|
|
|
47
47
|
track({ component: 'CopyButton', action: 'error', id });
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
const name = label ?? (typeof children === 'string' ? children : 'Copy');
|
|
51
|
+
const glyph = Math.round(size * 0.58);
|
|
52
|
+
return (_jsxs(XStack
|
|
53
|
+
// The label form is a pill that sizes to its text; the icon form is the
|
|
54
|
+
// square it has always been. `height` is shared so a labeled control lines
|
|
55
|
+
// up with an unlabeled one in the same row.
|
|
56
|
+
, {
|
|
57
|
+
// The label form is a pill that sizes to its text; the icon form is the
|
|
58
|
+
// square it has always been. `height` is shared so a labeled control lines
|
|
59
|
+
// up with an unlabeled one in the same row.
|
|
60
|
+
width: children == null ? size : undefined, height: size, px: children == null ? undefined : '$2', gap: children == null ? undefined : '$1.5', items: "center", justify: "center", rounded: "$2", cursor: "pointer", opacity: 0.7, onPress: copy, role: "button", tabIndex: 0, "aria-label": copied ? 'Copied' : name, ...tip(copied ? 'Copied' : name), hoverStyle: { bg: '$color4', opacity: 1 }, pressStyle: { bg: '$color5' }, children: [copied ? _jsx(Check, { size: glyph }) : _jsx(Copy, { size: glyph }), children == null ? null : (
|
|
61
|
+
// The word carries the confirmation too. A tick alone, at 14px, beside
|
|
62
|
+
// text that did not change is the smallest possible way to say the thing
|
|
63
|
+
// the control exists to say.
|
|
64
|
+
_jsx(Text, { fontSize: "$2", color: "$color12", numberOfLines: 1, children: copied ? 'Copied' : children }))] }));
|
|
51
65
|
}
|
|
52
66
|
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyButton.js","sourceRoot":"","sources":["../../src/product/CopyButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"CopyButton.js","sourceRoot":"","sources":["../../src/product/CopyButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,0DAA0D;AAC1D,MAAM,OAAO,GAAG,IAAI,CAAA;AAwBpB,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE,EAAmB;IACnF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC3C,MAAM,KAAK,GAAG,MAAM,CAA4C,SAAS,CAAC,CAAA;IAC1E,MAAM,KAAK,GAAG,OAAO,EAAE,CAAA;IAEvB,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAA;IAEtD,MAAM,IAAI,GAAG,GAAG,EAAE;QAChB,2EAA2E;QAC3E,2EAA2E;QAC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,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAC1C,KAAK,EAAC,QAAQ,EACd,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAC,IAAI,EACZ,MAAM,EAAC,SAAS,EAChB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,IAAI,EACb,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,gBACC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,KAChC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,EACjC,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,EACzC,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,aAE5B,MAAM,CAAC,CAAC,CAAC,KAAC,KAAK,IAAC,IAAI,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,GAAI,EACvD,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;YACzB,uEAAuE;YACvE,yEAAyE;YACzE,6BAA6B;YAC7B,KAAC,IAAI,IAAC,QAAQ,EAAC,IAAI,EAAC,KAAK,EAAC,UAAU,EAAC,aAAa,EAAE,CAAC,YAClD,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GACxB,CACR,IACM,CACV,CAAA;AACH,CAAC"}
|
|
@@ -8,7 +8,7 @@ const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
|
8
8
|
const instrument_1 = require("./instrument.cjs");
|
|
9
9
|
/** Skeleton rows in the real column layout — an honest "loading", never a void. */
|
|
10
10
|
function SkeletonRows({ columns, count = 6 }) {
|
|
11
|
-
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { children: Array.from({ length: count }).map((_, r) => ((0, jsx_runtime_1.jsx)(gui_1.XStack, { py: "$2.5", px: "$3", gap: "$3", borderTopWidth: 1, borderColor: "$borderColor", items: "center", children: columns.map((c, i) => ((0, jsx_runtime_1.jsx)(gui_1.YStack, { width: c.width, flex: c.width ? undefined : 1, minW: c.width ? undefined : FLEX_MIN_COL_W, items: c.align === 'right' ? 'flex-end' : 'flex-start', children: (0, jsx_runtime_1.jsx)("div", { className: "skeleton", style: { height: 12, borderRadius: 6, width: `${[62, 40, 54, 34, 48][(i + r) % 5]}%` }, "aria-hidden": true }) }, c.key))) }, r))) }));
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { children: Array.from({ length: count }).map((_, r) => ((0, jsx_runtime_1.jsx)(gui_1.XStack, { py: "$2.5", px: "$3", gap: "$3", borderTopWidth: 1, borderColor: "$borderColor", items: "center", children: columns.map((c, i) => ((0, jsx_runtime_1.jsx)(gui_1.YStack, { width: c.width, flex: c.width ? undefined : 1, minW: c.width ? undefined : FLEX_MIN_COL_W, items: c.align === 'right' ? 'flex-end' : 'flex-start', children: (0, jsx_runtime_1.jsx)("div", { className: "hz-skeleton", style: { height: 12, borderRadius: 6, width: `${[62, 40, 54, 34, 48][(i + r) % 5]}%` }, "aria-hidden": true }) }, c.key))) }, r))) }));
|
|
12
12
|
}
|
|
13
13
|
function DataTable({ columns, rows, loading, empty = 'Nothing here yet.', rowKey, onRowPress, isRowExpanded, renderExpanded, sort, onSortChange, }) {
|
|
14
14
|
// Every table in the fleet reports the same two interactions with no app code.
|
|
@@ -31,10 +31,10 @@ function DataTable({ columns, rows, loading, empty = 'Nothing here yet.', rowKey
|
|
|
31
31
|
track({ component: 'DataTable', action: 'sort', id: c.key, value: sort?.key === c.key && sort?.dir === 'asc' ? 'desc' : 'asc' });
|
|
32
32
|
onSortChange?.(c.key);
|
|
33
33
|
}
|
|
34
|
-
: undefined, children: [(0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", fontWeight: "500", color: active ? '$color12' : '$color10', text: c.align === 'right' ? 'right' : 'left', className: c.mono ? 'tnum' : undefined, children: c.header }), Caret ? (0, jsx_runtime_1.jsx)(Caret, { size: 12, color: active ? '$color12' : '$color9' }) : null] }, c.key));
|
|
34
|
+
: undefined, children: [(0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", fontWeight: "500", color: active ? '$color12' : '$color10', text: c.align === 'right' ? 'right' : 'left', className: c.mono ? 'hz-tnum' : undefined, children: c.header }), Caret ? (0, jsx_runtime_1.jsx)(Caret, { size: 12, color: active ? '$color12' : '$color9' }) : null] }, c.key));
|
|
35
35
|
}) }), loading ? ((0, jsx_runtime_1.jsx)(SkeletonRows, { columns: columns })) : rows.length > 0 ? ((0, jsx_runtime_1.jsx)(gui_1.YStack, { children: rows.map((row) => {
|
|
36
36
|
const expanded = (isRowExpanded?.(row) ?? false) && !!renderExpanded;
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { children: [(0, jsx_runtime_1.jsx)(gui_1.XStack, { className: "row", py: "$2.5", px: "$3", gap: "$3", borderTopWidth: 1, borderColor: "$borderColor", items: "center", bg: expanded ? '$color2' : undefined, hoverStyle: onRowPress ? { bg: '$color2' } : undefined, cursor: onRowPress ? 'pointer' : undefined, onPress: onRowPress
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { children: [(0, jsx_runtime_1.jsx)(gui_1.XStack, { className: "hz-row", py: "$2.5", px: "$3", gap: "$3", borderTopWidth: 1, borderColor: "$borderColor", items: "center", bg: expanded ? '$color2' : undefined, hoverStyle: onRowPress ? { bg: '$color2' } : undefined, cursor: onRowPress ? 'pointer' : undefined, onPress: onRowPress
|
|
38
38
|
? () => {
|
|
39
39
|
track({ component: 'DataTable', action: 'select', id: rowKey(row), value: rows.length });
|
|
40
40
|
onRowPress(row);
|
|
@@ -49,7 +49,7 @@ function DataTable({ columns, rows, loading, empty = 'Nothing here yet.', rowKey
|
|
|
49
49
|
// and always picks up the numeric mono/align styling. Element
|
|
50
50
|
// renders (Text/badges/cells) pass through untouched.
|
|
51
51
|
const cell = c.render ? c.render(row) : String(row[c.key] ?? '');
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { width: c.width, flex: c.width ? undefined : 1, minW: c.width ? undefined : FLEX_MIN_COL_W, justify: "center", items: c.align === 'right' ? 'flex-end' : 'flex-start', children: typeof cell === 'string' || typeof cell === 'number' ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$3", numberOfLines: 1, color: "$color12", text: c.align === 'right' ? 'right' : 'left', className: c.mono ? 'mono' : undefined, children: cell })) : (cell) }, c.key));
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { width: c.width, flex: c.width ? undefined : 1, minW: c.width ? undefined : FLEX_MIN_COL_W, justify: "center", items: c.align === 'right' ? 'flex-end' : 'flex-start', children: typeof cell === 'string' || typeof cell === 'number' ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$3", numberOfLines: 1, color: "$color12", text: c.align === 'right' ? 'right' : 'left', className: c.mono ? 'hz-mono' : undefined, children: cell })) : (cell) }, c.key));
|
|
53
53
|
}) }), expanded && renderExpanded ? ((0, jsx_runtime_1.jsx)(gui_1.YStack, { borderTopWidth: 1, borderColor: "$borderColor", bg: "$color1", children: renderExpanded(row) })) : null] }, rowKey(row)));
|
|
54
54
|
}) })) : null] }) }), !loading && rows.length === 0 ? ((0, jsx_runtime_1.jsx)(gui_1.YStack, { py: "$8", px: "$4", items: "center", gap: "$1", borderTopWidth: 1, borderColor: "$borderColor", children: (0, jsx_runtime_1.jsx)(gui_1.Text, { color: "$color10", fontSize: "$3", text: "center", children: empty }) })) : null] }));
|
|
55
55
|
}
|
|
@@ -5,7 +5,7 @@ import { ChevronDown, ChevronsUpDown, ChevronUp } from '@hanzogui/lucide-icons-2
|
|
|
5
5
|
import { useEmit } from './instrument.js';
|
|
6
6
|
/** Skeleton rows in the real column layout — an honest "loading", never a void. */
|
|
7
7
|
function SkeletonRows({ columns, count = 6 }) {
|
|
8
|
-
return (_jsx(YStack, { children: Array.from({ length: count }).map((_, r) => (_jsx(XStack, { py: "$2.5", px: "$3", gap: "$3", borderTopWidth: 1, borderColor: "$borderColor", items: "center", children: columns.map((c, i) => (_jsx(YStack, { width: c.width, flex: c.width ? undefined : 1, minW: c.width ? undefined : FLEX_MIN_COL_W, items: c.align === 'right' ? 'flex-end' : 'flex-start', children: _jsx("div", { className: "skeleton", style: { height: 12, borderRadius: 6, width: `${[62, 40, 54, 34, 48][(i + r) % 5]}%` }, "aria-hidden": true }) }, c.key))) }, r))) }));
|
|
8
|
+
return (_jsx(YStack, { children: Array.from({ length: count }).map((_, r) => (_jsx(XStack, { py: "$2.5", px: "$3", gap: "$3", borderTopWidth: 1, borderColor: "$borderColor", items: "center", children: columns.map((c, i) => (_jsx(YStack, { width: c.width, flex: c.width ? undefined : 1, minW: c.width ? undefined : FLEX_MIN_COL_W, items: c.align === 'right' ? 'flex-end' : 'flex-start', children: _jsx("div", { className: "hz-skeleton", style: { height: 12, borderRadius: 6, width: `${[62, 40, 54, 34, 48][(i + r) % 5]}%` }, "aria-hidden": true }) }, c.key))) }, r))) }));
|
|
9
9
|
}
|
|
10
10
|
export function DataTable({ columns, rows, loading, empty = 'Nothing here yet.', rowKey, onRowPress, isRowExpanded, renderExpanded, sort, onSortChange, }) {
|
|
11
11
|
// Every table in the fleet reports the same two interactions with no app code.
|
|
@@ -28,10 +28,10 @@ export function DataTable({ columns, rows, loading, empty = 'Nothing here yet.',
|
|
|
28
28
|
track({ component: 'DataTable', action: 'sort', id: c.key, value: sort?.key === c.key && sort?.dir === 'asc' ? 'desc' : 'asc' });
|
|
29
29
|
onSortChange?.(c.key);
|
|
30
30
|
}
|
|
31
|
-
: undefined, children: [_jsx(Text, { fontSize: "$1", fontWeight: "500", color: active ? '$color12' : '$color10', text: c.align === 'right' ? 'right' : 'left', className: c.mono ? 'tnum' : undefined, children: c.header }), Caret ? _jsx(Caret, { size: 12, color: active ? '$color12' : '$color9' }) : null] }, c.key));
|
|
31
|
+
: undefined, children: [_jsx(Text, { fontSize: "$1", fontWeight: "500", color: active ? '$color12' : '$color10', text: c.align === 'right' ? 'right' : 'left', className: c.mono ? 'hz-tnum' : undefined, children: c.header }), Caret ? _jsx(Caret, { size: 12, color: active ? '$color12' : '$color9' }) : null] }, c.key));
|
|
32
32
|
}) }), loading ? (_jsx(SkeletonRows, { columns: columns })) : rows.length > 0 ? (_jsx(YStack, { children: rows.map((row) => {
|
|
33
33
|
const expanded = (isRowExpanded?.(row) ?? false) && !!renderExpanded;
|
|
34
|
-
return (_jsxs(YStack, { children: [_jsx(XStack, { className: "row", py: "$2.5", px: "$3", gap: "$3", borderTopWidth: 1, borderColor: "$borderColor", items: "center", bg: expanded ? '$color2' : undefined, hoverStyle: onRowPress ? { bg: '$color2' } : undefined, cursor: onRowPress ? 'pointer' : undefined, onPress: onRowPress
|
|
34
|
+
return (_jsxs(YStack, { children: [_jsx(XStack, { className: "hz-row", py: "$2.5", px: "$3", gap: "$3", borderTopWidth: 1, borderColor: "$borderColor", items: "center", bg: expanded ? '$color2' : undefined, hoverStyle: onRowPress ? { bg: '$color2' } : undefined, cursor: onRowPress ? 'pointer' : undefined, onPress: onRowPress
|
|
35
35
|
? () => {
|
|
36
36
|
track({ component: 'DataTable', action: 'select', id: rowKey(row), value: rows.length });
|
|
37
37
|
onRowPress(row);
|
|
@@ -46,7 +46,7 @@ export function DataTable({ columns, rows, loading, empty = 'Nothing here yet.',
|
|
|
46
46
|
// and always picks up the numeric mono/align styling. Element
|
|
47
47
|
// renders (Text/badges/cells) pass through untouched.
|
|
48
48
|
const cell = c.render ? c.render(row) : String(row[c.key] ?? '');
|
|
49
|
-
return (_jsx(YStack, { width: c.width, flex: c.width ? undefined : 1, minW: c.width ? undefined : FLEX_MIN_COL_W, justify: "center", items: c.align === 'right' ? 'flex-end' : 'flex-start', children: typeof cell === 'string' || typeof cell === 'number' ? (_jsx(Text, { fontSize: "$3", numberOfLines: 1, color: "$color12", text: c.align === 'right' ? 'right' : 'left', className: c.mono ? 'mono' : undefined, children: cell })) : (cell) }, c.key));
|
|
49
|
+
return (_jsx(YStack, { width: c.width, flex: c.width ? undefined : 1, minW: c.width ? undefined : FLEX_MIN_COL_W, justify: "center", items: c.align === 'right' ? 'flex-end' : 'flex-start', children: typeof cell === 'string' || typeof cell === 'number' ? (_jsx(Text, { fontSize: "$3", numberOfLines: 1, color: "$color12", text: c.align === 'right' ? 'right' : 'left', className: c.mono ? 'hz-mono' : undefined, children: cell })) : (cell) }, c.key));
|
|
50
50
|
}) }), expanded && renderExpanded ? (_jsx(YStack, { borderTopWidth: 1, borderColor: "$borderColor", bg: "$color1", children: renderExpanded(row) })) : null] }, rowKey(row)));
|
|
51
51
|
}) })) : null] }) }), !loading && rows.length === 0 ? (_jsx(YStack, { py: "$8", px: "$4", items: "center", gap: "$1", borderTopWidth: 1, borderColor: "$borderColor", children: _jsx(Text, { color: "$color10", fontSize: "$3", text: "center", children: empty }) })) : null] }));
|
|
52
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","sourceRoot":"","sources":["../../src/product/DataTable.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAmBZ,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEjF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAoBtC,mFAAmF;AACnF,SAAS,YAAY,CAAI,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAA4C;IACvF,OAAO,CACL,KAAC,MAAM,cACJ,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAC3C,KAAC,MAAM,IAAS,EAAE,E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AAC,MAAM,EAC5C,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,YAExC,IAAI,GACA,CACR,CAAC,CAAC,CAAC,CACF,IAAI,CACL,IAnBI,CAAC,CAAC,GAAG,CAoBH,CACV,CAAA;4CACH,CAAC,CAAC,GACK,EACR,QAAQ,IAAI,cAAc,CAAC,CAAC,CAAC,CAC5B,KAAC,MAAM,IAAC,cAAc,EAAE,CAAC,EAAE,WAAW,EAAC,cAAc,EAAC,EAAE,EAAC,SAAS,YAC/D,cAAc,CAAC,GAAG,CAAC,GACb,CACV,CAAC,CAAC,CAAC,IAAI,KA7DK,MAAM,CAAC,GAAG,CAAC,CA8Df,CACR,CAAA;4BACH,CAAC,CAAC,GACK,CACV,CAAC,CAAC,CAAC,IAAI,IACD,GACF,EAKR,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAC/B,KAAC,MAAM,IAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,KAAK,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,cAAc,EAAE,CAAC,EAAE,WAAW,EAAC,cAAc,YAC3F,KAAC,IAAI,IAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,YAC/C,KAAK,GACD,GACA,CACV,CAAC,CAAC,CAAC,IAAI,IACD,CACV,CAAA;AACH,CAAC;AAED;2EAC2E;AAC3E,MAAM,cAAc,GAAG,GAAG,CAAA"}
|
package/dist/product/FadeIn.cjs
CHANGED
|
@@ -5,5 +5,5 @@ exports.FadeIn = FadeIn;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
function FadeIn({ children, index = 0, step = 50, delayMs, style, }) {
|
|
7
7
|
const delay = delayMs ?? index * step;
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: "fade-up", style: { animationDelay: `${delay}ms`, ...style }, children: children }));
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "hz-fade-up", style: { animationDelay: `${delay}ms`, ...style }, children: children }));
|
|
9
9
|
}
|
package/dist/product/FadeIn.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
export function FadeIn({ children, index = 0, step = 50, delayMs, style, }) {
|
|
4
4
|
const delay = delayMs ?? index * step;
|
|
5
|
-
return (_jsx("div", { className: "fade-up", style: { animationDelay: `${delay}ms`, ...style }, children: children }));
|
|
5
|
+
return (_jsx("div", { className: "hz-fade-up", style: { animationDelay: `${delay}ms`, ...style }, children: children }));
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=FadeIn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FadeIn.js","sourceRoot":"","sources":["../../src/product/FadeIn.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAcZ,MAAM,UAAU,MAAM,CAAC,EACrB,QAAQ,EACR,KAAK,GAAG,CAAC,EACT,IAAI,GAAG,EAAE,EACT,OAAO,EACP,KAAK,GAWN;IACC,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,GAAG,IAAI,CAAA;IACrC,OAAO,CACL,cAAK,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"FadeIn.js","sourceRoot":"","sources":["../../src/product/FadeIn.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAcZ,MAAM,UAAU,MAAM,CAAC,EACrB,QAAQ,EACR,KAAK,GAAG,CAAC,EACT,IAAI,GAAG,EAAE,EACT,OAAO,EACP,KAAK,GAWN;IACC,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,GAAG,IAAI,CAAA;IACrC,OAAO,CACL,cAAK,SAAS,EAAC,YAAY,EAAC,KAAK,EAAE,EAAE,cAAc,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,EAAE,YAC1E,QAAQ,GACL,CACP,CAAA;AACH,CAAC"}
|
package/dist/product/Field.cjs
CHANGED
|
@@ -18,7 +18,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
18
18
|
const react_1 = require("react");
|
|
19
19
|
const gui_1 = require("@hanzo/gui");
|
|
20
20
|
const instrument_1 = require("./instrument.cjs");
|
|
21
|
-
const
|
|
21
|
+
const mask_1 = require("../backends/gui/mask.cjs");
|
|
22
22
|
// The label the caller ALREADY typed on the FieldRow becomes the analytics name —
|
|
23
23
|
// so an app never labels a field twice and no field reports as "unnamed".
|
|
24
24
|
const FieldNameContext = (0, react_1.createContext)(undefined);
|
|
@@ -37,12 +37,12 @@ function useFieldTrack(component) {
|
|
|
37
37
|
function FieldRow({ label, children }) {
|
|
38
38
|
return ((0, jsx_runtime_1.jsx)(FieldNameContext.Provider, { value: label, children: (0, jsx_runtime_1.jsxs)(gui_1.XStack, { gap: "$3", items: "flex-start", flexWrap: "wrap", children: [(0, jsx_runtime_1.jsx)(gui_1.Label, { width: "100%", pt: "$2", color: "$color11", fontSize: "$3", "$md": { width: 180 }, children: label }), (0, jsx_runtime_1.jsx)(gui_1.YStack, { flex: 1, minW: 0, "$md": { minW: 240 }, children: children })] }) }));
|
|
39
39
|
}
|
|
40
|
-
function FieldText({ value, onChange, disabled, secure, placeholder, }) {
|
|
40
|
+
function FieldText({ value, onChange, disabled, secure, placeholder, autoComplete, id, }) {
|
|
41
41
|
const track = useFieldTrack('FieldText');
|
|
42
42
|
return ((0, jsx_runtime_1.jsx)(gui_1.Input, { value: value, onChangeText: (v) => {
|
|
43
43
|
track({ action: 'change', value: secure ? 0 : (0, instrument_1.textSize)(v) });
|
|
44
44
|
onChange(v);
|
|
45
|
-
}, disabled: disabled, ...(0,
|
|
45
|
+
}, disabled: disabled, ...(0, mask_1.masked)(Boolean(secure)), placeholder: placeholder, autoComplete: autoComplete, id: id, autoCapitalize: "none" }));
|
|
46
46
|
}
|
|
47
47
|
function FieldTextArea({ value, onChange, disabled, rows = 6, }) {
|
|
48
48
|
const track = useFieldTrack('FieldTextArea');
|
package/dist/product/Field.d.ts
CHANGED
|
@@ -15,12 +15,32 @@ export declare function FieldRow({ label, children }: {
|
|
|
15
15
|
label: string;
|
|
16
16
|
children: ReactNode;
|
|
17
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export declare function FieldText({ value, onChange, disabled, secure, placeholder, }: {
|
|
18
|
+
export declare function FieldText({ value, onChange, disabled, secure, placeholder, autoComplete, id, }: {
|
|
19
19
|
value: string;
|
|
20
20
|
onChange: (v: string) => void;
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
secure?: boolean;
|
|
23
23
|
placeholder?: string;
|
|
24
|
+
/**
|
|
25
|
+
* What the browser may fill this with — "email", "current-password",
|
|
26
|
+
* "one-time-code", or "off". A sign-in form built out of these rows could not
|
|
27
|
+
* say it, so password managers had nothing to go on: they either filled
|
|
28
|
+
* nothing or filled the wrong row, and every surface that cared dropped back
|
|
29
|
+
* to a raw `<input>` to get the one attribute.
|
|
30
|
+
*/
|
|
31
|
+
autoComplete?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The field's DOM id — what an external `<label for>` points at, and the
|
|
34
|
+
* second thing autofill reads after `autoComplete`.
|
|
35
|
+
*
|
|
36
|
+
* There is deliberately no `name`. `name` is @hanzo/gui's OWN prop (it names a
|
|
37
|
+
* styled component and a theme) and it is consumed before it can reach the
|
|
38
|
+
* DOM — measured, not assumed. Accepting one here would type-check, render
|
|
39
|
+
* nothing, and leave a caller believing their form posts a field it does not.
|
|
40
|
+
* `autoComplete` is the attribute that actually drives autofill; these rows
|
|
41
|
+
* are controlled React fields, so nothing depends on a native form post.
|
|
42
|
+
*/
|
|
43
|
+
id?: string;
|
|
24
44
|
}): import("react/jsx-runtime").JSX.Element;
|
|
25
45
|
export declare function FieldTextArea({ value, onChange, disabled, rows, }: {
|
|
26
46
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/product/Field.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,OAAO,EAAiD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AA2BrF;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAanF;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,WAAW,
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/product/Field.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,OAAO,EAAiD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AA2BrF;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAanF;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,WAAW,EACX,YAAY,EACZ,EAAE,GACH,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;;;;OAUG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,2CAoBA;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,2CAaA;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,2CAeA;AA0CD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAuB,GACxB,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,2CA4BA;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,GAAG,EACH,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,2CA0BA"}
|
package/dist/product/Field.js
CHANGED
|
@@ -10,7 +10,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
import { createContext, useContext } from 'react';
|
|
11
11
|
import { Input, Label, Switch, TextArea, Slider, Text, XStack, YStack, } from '@hanzo/gui';
|
|
12
12
|
import { textSize, useEmit } from './instrument.js';
|
|
13
|
-
import { masked } from '
|
|
13
|
+
import { masked } from '../backends/gui/mask.js';
|
|
14
14
|
// The label the caller ALREADY typed on the FieldRow becomes the analytics name —
|
|
15
15
|
// so an app never labels a field twice and no field reports as "unnamed".
|
|
16
16
|
const FieldNameContext = createContext(undefined);
|
|
@@ -29,12 +29,12 @@ function useFieldTrack(component) {
|
|
|
29
29
|
export function FieldRow({ label, children }) {
|
|
30
30
|
return (_jsx(FieldNameContext.Provider, { value: label, children: _jsxs(XStack, { gap: "$3", items: "flex-start", flexWrap: "wrap", children: [_jsx(Label, { width: "100%", pt: "$2", color: "$color11", fontSize: "$3", "$md": { width: 180 }, children: label }), _jsx(YStack, { flex: 1, minW: 0, "$md": { minW: 240 }, children: children })] }) }));
|
|
31
31
|
}
|
|
32
|
-
export function FieldText({ value, onChange, disabled, secure, placeholder, }) {
|
|
32
|
+
export function FieldText({ value, onChange, disabled, secure, placeholder, autoComplete, id, }) {
|
|
33
33
|
const track = useFieldTrack('FieldText');
|
|
34
34
|
return (_jsx(Input, { value: value, onChangeText: (v) => {
|
|
35
35
|
track({ action: 'change', value: secure ? 0 : textSize(v) });
|
|
36
36
|
onChange(v);
|
|
37
|
-
}, disabled: disabled, ...masked(Boolean(secure)), placeholder: placeholder, autoCapitalize: "none" }));
|
|
37
|
+
}, disabled: disabled, ...masked(Boolean(secure)), placeholder: placeholder, autoComplete: autoComplete, id: id, autoCapitalize: "none" }));
|
|
38
38
|
}
|
|
39
39
|
export function FieldTextArea({ value, onChange, disabled, rows = 6, }) {
|
|
40
40
|
const track = useFieldTrack('FieldTextArea');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/product/Field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAsC,MAAM,OAAO,CAAA;AACrF,OAAO,EACL,KAAK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C,IACK,CACV,CAAA;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAC1B,KAAK,EACL,GAAG,EACH,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,QAAQ,GAQT;IACC,MAAM,KAAK,GAAG,aAAa,CAAC,aAAa,CAAC,CAAA;IAC1C,OAAO,CACL,MAAC,MAAM,IAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAC,QAAQ,aAC7B,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAC,IAAI,EAAC,KAAK,EAAC,UAAU,YAC5C,KAAK,GACD,EACP,MAAC,MAAM,IACL,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,CAAC,KAAK,CAAC,EACd,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE;oBACnB,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAA;oBAC/C,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAA;gBACvB,CAAC,EACD,QAAQ,EAAE,QAAQ,aAElB,KAAC,MAAM,CAAC,KAAK,cACX,KAAC,MAAM,CAAC,WAAW,KAAG,GACT,EACf,KAAC,MAAM,CAAC,KAAK,IAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,SAAG,IAC5B,IACF,CACV,CAAA;AACH,CAAC"}
|
|
@@ -4,9 +4,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Fieldset = Fieldset;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const gui_1 = require("@hanzo/gui");
|
|
7
|
-
function Fieldset({ title, icon, description, action, danger, children }) {
|
|
7
|
+
function Fieldset({ title, icon, description, action, danger, grow = false, minW = 280, children, }) {
|
|
8
8
|
const edge = danger ? '$red9' : '$borderColor';
|
|
9
|
-
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack
|
|
10
|
+
// Full width when it owns the line; flexing with a floor when it shares
|
|
11
|
+
// one. Setting both `width: 100%` and `flex: 1` makes the group overflow
|
|
12
|
+
// its row by its own gap, so it is one or the other.
|
|
13
|
+
, {
|
|
14
|
+
// Full width when it owns the line; flexing with a floor when it shares
|
|
15
|
+
// one. Setting both `width: 100%` and `flex: 1` makes the group overflow
|
|
16
|
+
// its row by its own gap, so it is one or the other.
|
|
17
|
+
width: grow ? undefined : '100%', flex: grow ? 1 : undefined, minW: grow ? minW : 0, p: "$4", gap: "$3", rounded: "$4", borderWidth: 1, borderColor: edge, bg: "$color2", children: [title || action ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", justify: "space-between", flexWrap: "wrap", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", flex: 1, minW: 0, children: [icon, title ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$3", fontWeight: "500", color: danger ? '$red10' : '$color12', children: title })) : null] }), action] })) : null, description ? (
|
|
10
18
|
// Sits under the legend, not beside it: a description that shares the
|
|
11
19
|
// line with the title competes with it and wraps first on a phone.
|
|
12
20
|
(0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color11", children: description })) : null, (0, jsx_runtime_1.jsx)(gui_1.YStack, { gap: "$3", children: children })] }));
|
|
@@ -29,7 +29,18 @@ export type FieldsetProps = {
|
|
|
29
29
|
action?: ReactNode;
|
|
30
30
|
/** The destructive register — irreversible actions only. */
|
|
31
31
|
danger?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Share the width of a ROW of groups instead of taking all of it. Default
|
|
34
|
+
* false, which is the settings page: one group per line, full width.
|
|
35
|
+
*
|
|
36
|
+
* A settings page is a column, but a settings TAB is often two — "Profile"
|
|
37
|
+
* beside "Password", "Region" beside "Limits" — and a group with no way to
|
|
38
|
+
* flex forced every such layout to wrap the group in a sizing box of its own.
|
|
39
|
+
*/
|
|
40
|
+
grow?: boolean;
|
|
41
|
+
/** Floor for the group's width when it is sharing a row. Default 280. */
|
|
42
|
+
minW?: number;
|
|
32
43
|
children: ReactNode;
|
|
33
44
|
};
|
|
34
|
-
export declare function Fieldset({ title, icon, description, action, danger, children }: FieldsetProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare function Fieldset({ title, icon, description, action, danger, grow, minW, children, }: FieldsetProps): import("react/jsx-runtime").JSX.Element;
|
|
35
46
|
//# sourceMappingURL=Fieldset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fieldset.d.ts","sourceRoot":"","sources":["../../src/product/Fieldset.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,MAAM,aAAa,GAAG;IAC1B,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yEAAyE;IACzE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,wBAAgB,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"Fieldset.d.ts","sourceRoot":"","sources":["../../src/product/Fieldset.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,MAAM,aAAa,GAAG;IAC1B,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yEAAyE;IACzE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,WAAW,EACX,MAAM,EACN,MAAM,EACN,IAAY,EACZ,IAAU,EACV,QAAQ,GACT,EAAE,aAAa,2CA0Cf"}
|
package/dist/product/Fieldset.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Text, XStack, YStack } from '@hanzo/gui';
|
|
4
|
-
export function Fieldset({ title, icon, description, action, danger, children }) {
|
|
4
|
+
export function Fieldset({ title, icon, description, action, danger, grow = false, minW = 280, children, }) {
|
|
5
5
|
const edge = danger ? '$red9' : '$borderColor';
|
|
6
|
-
return (_jsxs(YStack
|
|
6
|
+
return (_jsxs(YStack
|
|
7
|
+
// Full width when it owns the line; flexing with a floor when it shares
|
|
8
|
+
// one. Setting both `width: 100%` and `flex: 1` makes the group overflow
|
|
9
|
+
// its row by its own gap, so it is one or the other.
|
|
10
|
+
, {
|
|
11
|
+
// Full width when it owns the line; flexing with a floor when it shares
|
|
12
|
+
// one. Setting both `width: 100%` and `flex: 1` makes the group overflow
|
|
13
|
+
// its row by its own gap, so it is one or the other.
|
|
14
|
+
width: grow ? undefined : '100%', flex: grow ? 1 : undefined, minW: grow ? minW : 0, p: "$4", gap: "$3", rounded: "$4", borderWidth: 1, borderColor: edge, bg: "$color2", children: [title || action ? (_jsxs(XStack, { items: "center", gap: "$2", justify: "space-between", flexWrap: "wrap", children: [_jsxs(XStack, { items: "center", gap: "$2", flex: 1, minW: 0, children: [icon, title ? (_jsx(Text, { fontSize: "$3", fontWeight: "500", color: danger ? '$red10' : '$color12', children: title })) : null] }), action] })) : null, description ? (
|
|
7
15
|
// Sits under the legend, not beside it: a description that shares the
|
|
8
16
|
// line with the title competes with it and wraps first on a phone.
|
|
9
17
|
_jsx(Text, { fontSize: "$2", color: "$color11", children: description })) : null, _jsx(YStack, { gap: "$3", children: children })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fieldset.js","sourceRoot":"","sources":["../../src/product/Fieldset.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAsBZ,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"Fieldset.js","sourceRoot":"","sources":["../../src/product/Fieldset.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAsBZ,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AA2BjD,MAAM,UAAU,QAAQ,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,WAAW,EACX,MAAM,EACN,MAAM,EACN,IAAI,GAAG,KAAK,EACZ,IAAI,GAAG,GAAG,EACV,QAAQ,GACM;IACd,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAA;IAC9C,OAAO,CACL,MAAC,MAAM;IACL,wEAAwE;IACxE,yEAAyE;IACzE,qDAAqD;;QAFrD,wEAAwE;QACxE,yEAAyE;QACzE,qDAAqD;QACrD,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAChC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAC1B,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EACrB,CAAC,EAAC,IAAI,EACN,GAAG,EAAC,IAAI,EACR,OAAO,EAAC,IAAI,EACZ,WAAW,EAAE,CAAC,EACd,WAAW,EAAE,IAAI,EACjB,EAAE,EAAC,SAAS,aAEX,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,CACjB,MAAC,MAAM,IAAC,KAAK,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,OAAO,EAAC,eAAe,EAAC,QAAQ,EAAC,MAAM,aACrE,MAAC,MAAM,IAAC,KAAK,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,aAC7C,IAAI,EACJ,KAAK,CAAC,CAAC,CAAC,CACP,KAAC,IAAI,IAAC,QAAQ,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,YACvE,KAAK,GACD,CACR,CAAC,CAAC,CAAC,IAAI,IACD,EACR,MAAM,IACA,CACV,CAAC,CAAC,CAAC,IAAI,EAEP,WAAW,CAAC,CAAC,CAAC;YACb,sEAAsE;YACtE,mEAAmE;YACnE,KAAC,IAAI,IAAC,QAAQ,EAAC,IAAI,EAAC,KAAK,EAAC,UAAU,YACjC,WAAW,GACP,CACR,CAAC,CAAC,CAAC,IAAI,EAER,KAAC,MAAM,IAAC,GAAG,EAAC,IAAI,YAAE,QAAQ,GAAU,IAC7B,CACV,CAAA;AACH,CAAC"}
|
package/dist/product/Metric.cjs
CHANGED
|
@@ -63,7 +63,7 @@ function UtilBar({ value, width = 120, color }) {
|
|
|
63
63
|
}
|
|
64
64
|
/** A legend row: color swatch + label + value. */
|
|
65
65
|
function LegendDot({ color, label, value }) {
|
|
66
|
-
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", justify: "space-between", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", children: [(0, jsx_runtime_1.jsx)(gui_1.YStack, { width: 10, height: 10, rounded: "$1", bg: color }), (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color11", children: label })] }), value != null ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color12", fontWeight: "500", className: "mono", children: value })) : null] }));
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", justify: "space-between", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", children: [(0, jsx_runtime_1.jsx)(gui_1.YStack, { width: 10, height: 10, rounded: "$1", bg: color }), (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color11", children: label })] }), value != null ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color12", fontWeight: "500", className: "hz-mono", children: value })) : null] }));
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* One overview metric tile. `value` is pre-formatted by the caller (so an absent
|
|
@@ -72,7 +72,7 @@ function LegendDot({ color, label, value }) {
|
|
|
72
72
|
*/
|
|
73
73
|
function MetricCard({ icon, label, value, caption, spark, sparkColor, delta, }) {
|
|
74
74
|
const up = delta ? delta.pct >= 0 : false;
|
|
75
|
-
return ((0, jsx_runtime_1.jsxs)(gui_1.Card, { p: "$3.5", gap: "$2", borderWidth: 1, borderColor: "$borderColor", flex: 1, minW: 172, children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", justify: "space-between", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", children: [icon, (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color11", fontWeight: "500", children: label })] }), delta ? ((0, jsx_runtime_1.jsxs)(gui_1.Text, { fontSize: "$1", color: up ? '#7ee787' : '#e5534b', children: [up ? '▲' : '▼', " ", Math.abs(delta.pct), "%"] })) : null] }), (0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "flex-end", justify: "space-between", gap: "$2", children: [(0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$8", fontWeight: "500", color: "$color12", numberOfLines: 1, className: "mono", children: value }), spark && spark.length >= 2 ? (0, jsx_runtime_1.jsx)(Sparkline, { points: spark, color: sparkColor ?? exports.SERIES[0] }) : null] }), caption ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", color: "$color10", numberOfLines: 1, children: caption })) : null] }));
|
|
75
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.Card, { p: "$3.5", gap: "$2", borderWidth: 1, borderColor: "$borderColor", flex: 1, minW: 172, children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", justify: "space-between", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", children: [icon, (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color11", fontWeight: "500", children: label })] }), delta ? ((0, jsx_runtime_1.jsxs)(gui_1.Text, { fontSize: "$1", color: up ? '#7ee787' : '#e5534b', children: [up ? '▲' : '▼', " ", Math.abs(delta.pct), "%"] })) : null] }), (0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "flex-end", justify: "space-between", gap: "$2", children: [(0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$8", fontWeight: "500", color: "$color12", numberOfLines: 1, className: "hz-mono", children: value }), spark && spark.length >= 2 ? (0, jsx_runtime_1.jsx)(Sparkline, { points: spark, color: sparkColor ?? exports.SERIES[0] }) : null] }), caption ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", color: "$color10", numberOfLines: 1, children: caption })) : null] }));
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* A button that is either a real action (onPress) or HONESTLY disabled with a
|
|
@@ -91,6 +91,9 @@ function HintButton({ icon, iconAfter, children, onPress, disabled, hint, theme,
|
|
|
91
91
|
* inside a vertical rail (a column YStack) so each panel sizes to its content and
|
|
92
92
|
* stacks — flex-grow in a column with no fixed height collapses them onto each other.
|
|
93
93
|
*/
|
|
94
|
-
function Panel({ title, right, children, minW = 280, grow = true, }) {
|
|
95
|
-
return ((0, jsx_runtime_1.jsxs)(gui_1.Card, { p: "$4", gap: "$3", borderWidth: 1, borderColor: "$borderColor", flex: grow ? 1 : undefined, minW: minW, width: grow ? undefined : '100%', children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", justify: "space-between", gap: "$2", children: [(0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$4", fontWeight: "500", color: "$color12", children: title }), right] }),
|
|
94
|
+
function Panel({ title, icon, description, right, children, minW = 280, grow = true, }) {
|
|
95
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.Card, { p: "$4", gap: "$3", borderWidth: 1, borderColor: "$borderColor", flex: grow ? 1 : undefined, minW: minW, width: grow ? undefined : '100%', children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", justify: "space-between", gap: "$2", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", flex: 1, minW: 0, children: [icon, (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$4", fontWeight: "500", color: "$color12", children: title })] }), right] }), description ? (
|
|
96
|
+
// Under the title, not beside it: a description sharing the line with a
|
|
97
|
+
// right-hand control is the first thing to wrap on a phone.
|
|
98
|
+
(0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color11", children: description })) : null, children] }));
|
|
96
99
|
}
|
package/dist/product/Metric.d.ts
CHANGED
|
@@ -93,8 +93,15 @@ export declare function HintButton({ icon, iconAfter, children, onPress, disable
|
|
|
93
93
|
* inside a vertical rail (a column YStack) so each panel sizes to its content and
|
|
94
94
|
* stacks — flex-grow in a column with no fixed height collapses them onto each other.
|
|
95
95
|
*/
|
|
96
|
-
export declare function Panel({ title, right, children, minW, grow, }: {
|
|
96
|
+
export declare function Panel({ title, icon, description, right, children, minW, grow, }: {
|
|
97
97
|
title: string;
|
|
98
|
+
/** Glyph before the title, at the title's own size. Names the panel's subject
|
|
99
|
+
* at a glance in a wall of them. */
|
|
100
|
+
icon?: ReactNode;
|
|
101
|
+
/** One line under the title saying what the panel shows — units, window,
|
|
102
|
+
* source. A number is not self-describing, and the caption every console
|
|
103
|
+
* wanted was being smuggled in as the first child. */
|
|
104
|
+
description?: string;
|
|
98
105
|
right?: ReactNode;
|
|
99
106
|
children: ReactNode;
|
|
100
107
|
minW?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Metric.d.ts","sourceRoot":"","sources":["../../src/product/Metric.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGpD,oFAAoF;AACpF,eAAO,MAAM,MAAM,mGAAoG,CAAA;AACvH,eAAO,MAAM,aAAa,GAAI,GAAG,MAAM,KAAG,MAAmC,CAAA;AAG7E,uEAAuE;AACvE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,KAAW,EACX,MAAW,EACX,KAAiB,GAClB,EAAE;IACD,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,YAAY,GAAG,IAAI,CAatB;AAED,8EAA8E;AAC9E,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,KAAW,EACX,MAAW,EACX,KAAiB,GAClB,EAAE;IACD,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAA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AAC,EAAE,YAAY,CAAA;IACxB,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,2CAmBA;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,IAAI,EACJ,WAAW,EACX,KAAK,EACL,QAAQ,EACR,IAAU,EACV,IAAW,GACZ,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb;yCACqC;IACrC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;2DAEuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,QAAQ,EAAE,SAAS,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,2CAsBA"}
|
package/dist/product/Metric.js
CHANGED
|
@@ -51,7 +51,7 @@ export function UtilBar({ value, width = 120, color }) {
|
|
|
51
51
|
}
|
|
52
52
|
/** A legend row: color swatch + label + value. */
|
|
53
53
|
export function LegendDot({ color, label, value }) {
|
|
54
|
-
return (_jsxs(XStack, { items: "center", gap: "$2", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(YStack, { width: 10, height: 10, rounded: "$1", bg: color }), _jsx(Text, { fontSize: "$2", color: "$color11", children: label })] }), value != null ? (_jsx(Text, { fontSize: "$2", color: "$color12", fontWeight: "500", className: "mono", children: value })) : null] }));
|
|
54
|
+
return (_jsxs(XStack, { items: "center", gap: "$2", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(YStack, { width: 10, height: 10, rounded: "$1", bg: color }), _jsx(Text, { fontSize: "$2", color: "$color11", children: label })] }), value != null ? (_jsx(Text, { fontSize: "$2", color: "$color12", fontWeight: "500", className: "hz-mono", children: value })) : null] }));
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* One overview metric tile. `value` is pre-formatted by the caller (so an absent
|
|
@@ -60,7 +60,7 @@ export function LegendDot({ color, label, value }) {
|
|
|
60
60
|
*/
|
|
61
61
|
export function MetricCard({ icon, label, value, caption, spark, sparkColor, delta, }) {
|
|
62
62
|
const up = delta ? delta.pct >= 0 : false;
|
|
63
|
-
return (_jsxs(Card, { p: "$3.5", gap: "$2", borderWidth: 1, borderColor: "$borderColor", flex: 1, minW: 172, children: [_jsxs(XStack, { items: "center", gap: "$2", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [icon, _jsx(Text, { fontSize: "$2", color: "$color11", fontWeight: "500", children: label })] }), delta ? (_jsxs(Text, { fontSize: "$1", color: up ? '#7ee787' : '#e5534b', children: [up ? '▲' : '▼', " ", Math.abs(delta.pct), "%"] })) : null] }), _jsxs(XStack, { items: "flex-end", justify: "space-between", gap: "$2", children: [_jsx(Text, { fontSize: "$8", fontWeight: "500", color: "$color12", numberOfLines: 1, className: "mono", children: value }), spark && spark.length >= 2 ? _jsx(Sparkline, { points: spark, color: sparkColor ?? SERIES[0] }) : null] }), caption ? (_jsx(Text, { fontSize: "$1", color: "$color10", numberOfLines: 1, children: caption })) : null] }));
|
|
63
|
+
return (_jsxs(Card, { p: "$3.5", gap: "$2", borderWidth: 1, borderColor: "$borderColor", flex: 1, minW: 172, children: [_jsxs(XStack, { items: "center", gap: "$2", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [icon, _jsx(Text, { fontSize: "$2", color: "$color11", fontWeight: "500", children: label })] }), delta ? (_jsxs(Text, { fontSize: "$1", color: up ? '#7ee787' : '#e5534b', children: [up ? '▲' : '▼', " ", Math.abs(delta.pct), "%"] })) : null] }), _jsxs(XStack, { items: "flex-end", justify: "space-between", gap: "$2", children: [_jsx(Text, { fontSize: "$8", fontWeight: "500", color: "$color12", numberOfLines: 1, className: "hz-mono", children: value }), spark && spark.length >= 2 ? _jsx(Sparkline, { points: spark, color: sparkColor ?? SERIES[0] }) : null] }), caption ? (_jsx(Text, { fontSize: "$1", color: "$color10", numberOfLines: 1, children: caption })) : null] }));
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* A button that is either a real action (onPress) or HONESTLY disabled with a
|
|
@@ -79,7 +79,10 @@ export function HintButton({ icon, iconAfter, children, onPress, disabled, hint,
|
|
|
79
79
|
* inside a vertical rail (a column YStack) so each panel sizes to its content and
|
|
80
80
|
* stacks — flex-grow in a column with no fixed height collapses them onto each other.
|
|
81
81
|
*/
|
|
82
|
-
export function Panel({ title, right, children, minW = 280, grow = true, }) {
|
|
83
|
-
return (_jsxs(Card, { p: "$4", gap: "$3", borderWidth: 1, borderColor: "$borderColor", flex: grow ? 1 : undefined, minW: minW, width: grow ? undefined : '100%', children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsx(Text, { fontSize: "$4", fontWeight: "500", color: "$color12", children: title }), right] }),
|
|
82
|
+
export function Panel({ title, icon, description, right, children, minW = 280, grow = true, }) {
|
|
83
|
+
return (_jsxs(Card, { p: "$4", gap: "$3", borderWidth: 1, borderColor: "$borderColor", flex: grow ? 1 : undefined, minW: minW, width: grow ? undefined : '100%', children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", flex: 1, minW: 0, children: [icon, _jsx(Text, { fontSize: "$4", fontWeight: "500", color: "$color12", children: title })] }), right] }), description ? (
|
|
84
|
+
// Under the title, not beside it: a description sharing the line with a
|
|
85
|
+
// right-hand control is the first thing to wrap on a phone.
|
|
86
|
+
_jsx(Text, { fontSize: "$2", color: "$color11", children: description })) : null, children] }));
|
|
84
87
|
}
|
|
85
88
|
//# sourceMappingURL=Metric.js.map
|