@hanzo/ui 8.0.60 → 8.0.62
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/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/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 +14 -3
- package/dist/product/index.d.ts +1 -1
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +13 -1
- package/dist/product/index.js.map +1 -1
- 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/styles/motion.css +52 -17
- package/dist/styles.css +53 -18
- package/package.json +35 -7
|
@@ -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,EAAC,MAAM,EAAC,EAAE,EAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,cAAc,EAAE,CAAC,EAAE,WAAW,EAAC,cAAc,EAAC,KAAK,EAAC,QAAQ,YACpG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACrB,KAAC,MAAM,IAAa,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,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c,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,C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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,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,GACP,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/product/Field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;GAMG;AACH,O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AAC,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;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GAAG,YAAY,GAAG,IAAI,CAiBtB;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,KAAW,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,E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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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Metric.js","sourceRoot":"","sources":["../../src/product/Metric.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAmBZ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAE/D,oFAAoF;AACpF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAU,CAAA;AACvH,MAAM,CAAC,MAAM,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AAK,EAAC,UAAU,YAClD,KAAK,GACD,IACA,EACR,KAAK,IACC,EACR,WAAW,CAAC,CAAC,CAAC;YACb,wEAAwE;YACxE,4DAA4D;YAC5D,KAAC,IAAI,IAAC,QAAQ,EAAC,IAAI,EAAC,KAAK,EAAC,UAAU,YACjC,WAAW,GACP,CACR,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,IACJ,CACR,CAAA;AACH,CAAC"}
|
|
@@ -1,63 +1,23 @@
|
|
|
1
1
|
'use client';"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.GAP = void 0;
|
|
5
|
-
exports.pages = pages;
|
|
4
|
+
exports.pages = exports.GAP = void 0;
|
|
6
5
|
exports.Pagination = Pagination;
|
|
7
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
7
|
/**
|
|
9
8
|
* Pagination — page N of M, and the way to the others.
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* around the current one, with ellipses standing in for what was skipped and the
|
|
16
|
-
* first and last page always reachable.
|
|
17
|
-
*
|
|
18
|
-
* Fixed width is the requirement. A control that grows with the page count
|
|
19
|
-
* reflows the row it sits in every time you page, which is how a "next" button
|
|
20
|
-
* ends up under the cursor that was pressing "previous".
|
|
10
|
+
* The RULE it pages by — a fixed-width run of page numbers with ellipses
|
|
11
|
+
* standing in for what was skipped — is `pages`, and it lives in `./pages`
|
|
12
|
+
* because it needs no browser. Re-exported here so the product barrel still
|
|
13
|
+
* carries it; `@hanzo/ui/product/pure` is the door that costs no gui runtime.
|
|
21
14
|
*/
|
|
22
15
|
const gui_1 = require("@hanzo/gui");
|
|
23
16
|
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
24
17
|
const instrument_1 = require("./instrument.cjs");
|
|
25
|
-
|
|
26
|
-
exports.GAP
|
|
27
|
-
|
|
28
|
-
* The page numbers to show for `page` of `count`, 1-based.
|
|
29
|
-
*
|
|
30
|
-
* `around` is how many neighbours flank the current page (default 1 → at most
|
|
31
|
-
* 7 slots: first, gap, p-1, p, p+1, gap, last). Returns every page when they
|
|
32
|
-
* all fit, so a short list never grows an ellipsis it does not need.
|
|
33
|
-
*/
|
|
34
|
-
function pages(page, count, around = 1) {
|
|
35
|
-
if (count <= 0)
|
|
36
|
-
return [];
|
|
37
|
-
const width = around * 2 + 5; // first + gap + run + gap + last
|
|
38
|
-
if (count <= width)
|
|
39
|
-
return Array.from({ length: count }, (_, i) => i + 1);
|
|
40
|
-
const current = Math.min(Math.max(page, 1), count);
|
|
41
|
-
// First and last are always present, so the middle carries `width - 2` slots
|
|
42
|
-
// and each end that needs no ellipsis spends that slot on another page
|
|
43
|
-
// instead. Solving for the run that way is what keeps the total constant;
|
|
44
|
-
// clamping the run with Math.max/min alone lets it shrink near the edges, and
|
|
45
|
-
// then the control changes width as you page.
|
|
46
|
-
const middle = width - 2;
|
|
47
|
-
const nearStart = current <= around + 2;
|
|
48
|
-
const nearEnd = current >= count - around - 1;
|
|
49
|
-
const start = nearStart ? 2 : nearEnd ? count - middle + 1 : current - around;
|
|
50
|
-
const end = nearStart ? middle : nearEnd ? count - 1 : current + around;
|
|
51
|
-
const out = [1];
|
|
52
|
-
if (!nearStart)
|
|
53
|
-
out.push(exports.GAP);
|
|
54
|
-
for (let p = start; p <= end; p++)
|
|
55
|
-
out.push(p);
|
|
56
|
-
if (!nearEnd)
|
|
57
|
-
out.push(exports.GAP);
|
|
58
|
-
out.push(count);
|
|
59
|
-
return out;
|
|
60
|
-
}
|
|
18
|
+
const pages_1 = require("./pages.cjs");
|
|
19
|
+
Object.defineProperty(exports, "GAP", { enumerable: true, get: function () { return pages_1.GAP; } });
|
|
20
|
+
Object.defineProperty(exports, "pages", { enumerable: true, get: function () { return pages_1.pages; } });
|
|
61
21
|
function Pagination({ page, count, onChange, around = 1 }) {
|
|
62
22
|
const track = (0, instrument_1.useEmit)();
|
|
63
23
|
if (count <= 1)
|
|
@@ -68,5 +28,5 @@ function Pagination({ page, count, onChange, around = 1 }) {
|
|
|
68
28
|
track({ component: 'Pagination', action: 'select', value: to });
|
|
69
29
|
onChange(to);
|
|
70
30
|
};
|
|
71
|
-
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", justify: "center", gap: "$1", flexWrap: "wrap", children: [(0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: true, icon: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronLeft, { size: 15 }), onPress: () => go(page - 1), disabled: page <= 1, "aria-label": "Previous page" }), pages(page, count, around).map((slot, i) => slot ===
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", justify: "center", gap: "$1", flexWrap: "wrap", children: [(0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: true, icon: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronLeft, { size: 15 }), onPress: () => go(page - 1), disabled: page <= 1, "aria-label": "Previous page" }), (0, pages_1.pages)(page, count, around).map((slot, i) => slot === pages_1.GAP ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { px: "$1.5", fontSize: "$2", color: "$color10", "aria-hidden": true, children: pages_1.GAP }, `gap-${i}`)) : ((0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: slot !== page, onPress: () => go(slot), "aria-label": `Page ${slot}`, "aria-current": slot === page ? 'page' : undefined, bg: slot === page ? '$color4' : undefined, children: String(slot) }, slot))), (0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: true, icon: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronRight, { size: 15 }), onPress: () => go(page + 1), disabled: page >= count, "aria-label": "Next page" })] }));
|
|
72
32
|
}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* The page numbers to show for `page` of `count`, 1-based.
|
|
5
|
-
*
|
|
6
|
-
* `around` is how many neighbours flank the current page (default 1 → at most
|
|
7
|
-
* 7 slots: first, gap, p-1, p, p+1, gap, last). Returns every page when they
|
|
8
|
-
* all fit, so a short list never grows an ellipsis it does not need.
|
|
9
|
-
*/
|
|
10
|
-
export declare function pages(page: number, count: number, around?: number): (number | typeof GAP)[];
|
|
1
|
+
import { GAP, pages } from './pages.js';
|
|
2
|
+
export { GAP, pages };
|
|
11
3
|
export type PaginationProps = {
|
|
12
4
|
/** Current page, 1-based. */
|
|
13
5
|
page: number;
|