@hanzo/ui 8.0.18 → 8.0.19
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/ThemeToggleNext-LI3SBFW7.cjs +20 -0
- package/dist/{ThemeToggleNext-ICB5KL5J.cjs.map → ThemeToggleNext-LI3SBFW7.cjs.map} +1 -1
- package/dist/ThemeToggleNext-OMBC67MO.js +5 -0
- package/dist/{ThemeToggleNext-7727UR5W.js.map → ThemeToggleNext-OMBC67MO.js.map} +1 -1
- package/dist/{chunk-23V6BPHG.js → chunk-3YH7AUKQ.js} +83 -13
- package/dist/chunk-3YH7AUKQ.js.map +1 -0
- package/dist/chunk-57YEM34R.cjs +35 -0
- package/dist/chunk-57YEM34R.cjs.map +1 -0
- package/dist/{chunk-YBXVUV7P.cjs → chunk-J3P63OX6.cjs} +6 -4
- package/dist/chunk-J3P63OX6.cjs.map +1 -0
- package/dist/chunk-P6IHE2O3.js +29 -0
- package/dist/chunk-P6IHE2O3.js.map +1 -0
- package/dist/{chunk-42CU5GSF.js → chunk-T3UAC7ZZ.js} +6 -4
- package/dist/chunk-T3UAC7ZZ.js.map +1 -0
- package/dist/{chunk-5MBAHVEO.cjs → chunk-XULZJEW2.cjs} +83 -13
- package/dist/chunk-XULZJEW2.cjs.map +1 -0
- package/dist/product/Field.d.ts +1 -1
- package/dist/product/Filters.d.ts +6 -2
- package/dist/product/index.cjs +126 -61
- package/dist/product/index.cjs.map +1 -1
- package/dist/product/index.d.ts +1 -0
- package/dist/product/index.js +61 -15
- package/dist/product/index.js.map +1 -1
- package/dist/product/instrument.d.ts +33 -0
- package/dist/product/social/index.cjs +16 -15
- package/dist/product/social/index.js +2 -1
- package/package.json +19 -18
- package/LICENSE.md +0 -21
- package/dist/ThemeToggleNext-7727UR5W.js +0 -4
- package/dist/ThemeToggleNext-ICB5KL5J.cjs +0 -19
- package/dist/chunk-23V6BPHG.js.map +0 -1
- package/dist/chunk-42CU5GSF.js.map +0 -1
- package/dist/chunk-5MBAHVEO.cjs.map +0 -1
- package/dist/chunk-YBXVUV7P.cjs.map +0 -1
package/dist/product/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './BackendState';
|
|
|
17
17
|
export * from './CommerceResource';
|
|
18
18
|
export * from './ConfirmDelete';
|
|
19
19
|
export * from './Filters';
|
|
20
|
+
export * from './instrument';
|
|
20
21
|
export * from './AnimatedLogo';
|
|
21
22
|
export * from './brand';
|
|
22
23
|
export * from './DataTable';
|
package/dist/product/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { ThemeToggle } from '../chunk-
|
|
3
|
-
export { AgnosticThemeToggle, ThemeToggle, ThemeToggleNext } from '../chunk-
|
|
4
|
-
import { classifyBackend, PageHeader, BackendStateCard, DataTable, asColor } from '../chunk-
|
|
5
|
-
export { BackendStateCard, COMPOSE_MODES, CampaignCard, ChannelBadge, DataTable, EmptyState, FieldRow, FieldSelect, FieldSlider, FieldSwitch, FieldText, FieldTextArea, HostProvider, PageHeader, PostAgenda, PostCard, PostComposer, PrimaryButton, ProviderReadinessList, LG as SLIDEOVER_LG, SlideOver, SocialResource, SocialSummaryBar, StatusTag, ViewToggle, accentFor, asColor, classifyBackend, classifyRead, contrastText, formatPostTime, isHexColor, parsePostTime, postDayBucket, postPreview, resolveAccent, setOrgAccent, useAccent, useHost } from '../chunk-
|
|
2
|
+
import { ThemeToggle } from '../chunk-T3UAC7ZZ.js';
|
|
3
|
+
export { AgnosticThemeToggle, ThemeToggle, ThemeToggleNext } from '../chunk-T3UAC7ZZ.js';
|
|
4
|
+
import { classifyBackend, PageHeader, BackendStateCard, DataTable, asColor } from '../chunk-3YH7AUKQ.js';
|
|
5
|
+
export { BackendStateCard, COMPOSE_MODES, CampaignCard, ChannelBadge, DataTable, EmptyState, FieldRow, FieldSelect, FieldSlider, FieldSwitch, FieldText, FieldTextArea, HostProvider, PageHeader, PostAgenda, PostCard, PostComposer, PrimaryButton, ProviderReadinessList, LG as SLIDEOVER_LG, SlideOver, SocialResource, SocialSummaryBar, StatusTag, ViewToggle, accentFor, asColor, classifyBackend, classifyRead, contrastText, formatPostTime, isHexColor, parsePostTime, postDayBucket, postPreview, resolveAccent, setOrgAccent, useAccent, useHost } from '../chunk-3YH7AUKQ.js';
|
|
6
|
+
import { useEmit, textSize } from '../chunk-P6IHE2O3.js';
|
|
7
|
+
export { InstrumentSurface, emit, textSize, useEmit, useSurface } from '../chunk-P6IHE2O3.js';
|
|
6
8
|
export { ACCOUNT_STATUSES, POST_STATUSES, PROVIDERS, createSocialApi, normalizeAccount, normalizeAccounts, normalizePost, normalizePosts, normalizeProviderCapability, normalizeProviders, normalizeSummary } from '../chunk-ZGTJCJ55.js';
|
|
7
9
|
import { createContext, useRef, useState, useEffect, useCallback, useLayoutEffect, useMemo, cloneElement, useContext } from 'react';
|
|
8
10
|
import { useTheme, XStack, Text, YStack, Card, Theme, useThemeName, Portal, Input, Button, Spinner, Popover, Separator, useControllableState } from '@hanzo/gui';
|
|
@@ -578,14 +580,19 @@ function MenuItemView({
|
|
|
578
580
|
hasSubmenu = false,
|
|
579
581
|
onSelect
|
|
580
582
|
}) {
|
|
583
|
+
const track = useEmit();
|
|
584
|
+
const choose = () => {
|
|
585
|
+
track({ component: "MenuItem", action: "select", id: typeof label === "string" ? label : void 0, value: selected });
|
|
586
|
+
onSelect();
|
|
587
|
+
};
|
|
581
588
|
const press = () => {
|
|
582
|
-
if (!disabled)
|
|
589
|
+
if (!disabled) choose();
|
|
583
590
|
};
|
|
584
591
|
const onKeyDown = (e) => {
|
|
585
592
|
if (disabled) return;
|
|
586
593
|
if (e.key === "Enter" || e.key === " ") {
|
|
587
594
|
e.preventDefault();
|
|
588
|
-
|
|
595
|
+
choose();
|
|
589
596
|
}
|
|
590
597
|
};
|
|
591
598
|
const labelColor = destructive ? DANGER : "$color12";
|
|
@@ -789,7 +796,9 @@ function ComboBox({
|
|
|
789
796
|
const anchorRect = useCallback(() => rowRef.current?.getBoundingClientRect() ?? null, []);
|
|
790
797
|
const anchorEl = useCallback(() => rowRef.current, []);
|
|
791
798
|
const filtered = useMemo(() => filterOptions(options, value), [options, value]);
|
|
799
|
+
const track = useEmit();
|
|
792
800
|
const pick = (v) => {
|
|
801
|
+
track({ component: "ComboBox", action: "select", id: v, value: filtered.length });
|
|
793
802
|
onChange(v);
|
|
794
803
|
setOpen(false);
|
|
795
804
|
};
|
|
@@ -817,7 +826,10 @@ function ComboBox({
|
|
|
817
826
|
chromeless: true,
|
|
818
827
|
disabled,
|
|
819
828
|
icon: /* @__PURE__ */ jsx(ChevronDown, { size: 16, opacity: 0.7 }),
|
|
820
|
-
onPress: () =>
|
|
829
|
+
onPress: () => {
|
|
830
|
+
track({ component: "ComboBox", action: open ? "close" : "open" });
|
|
831
|
+
setOpen((o) => !o);
|
|
832
|
+
},
|
|
821
833
|
"aria-label": "Show options"
|
|
822
834
|
}
|
|
823
835
|
)
|
|
@@ -1139,12 +1151,14 @@ function OrgSwitcher({ scope, orgs, pageSize = 20, current: given, create, picke
|
|
|
1139
1151
|
return rows.find((o) => o.name === currentId) ?? { name: currentId, displayName: titleCase(currentId) };
|
|
1140
1152
|
}, [given, rows, currentId]);
|
|
1141
1153
|
const currentLabel = current.displayName || titleCase(current.name);
|
|
1154
|
+
const track = useEmit();
|
|
1142
1155
|
const select = useCallback(
|
|
1143
1156
|
(org) => {
|
|
1157
|
+
track({ component: "OrgSwitcher", action: "select", id: org });
|
|
1144
1158
|
setOpen(false);
|
|
1145
1159
|
scope.switchOrg(org);
|
|
1146
1160
|
},
|
|
1147
|
-
[scope]
|
|
1161
|
+
[scope, track]
|
|
1148
1162
|
);
|
|
1149
1163
|
const submitCreate = async () => {
|
|
1150
1164
|
const name = newName.trim();
|
|
@@ -1644,14 +1658,18 @@ function ConfirmDelete({
|
|
|
1644
1658
|
}) {
|
|
1645
1659
|
const [busy, setBusy] = useState(false);
|
|
1646
1660
|
const [err, setErr] = useState(null);
|
|
1661
|
+
const track = useEmit();
|
|
1647
1662
|
const go = async () => {
|
|
1648
1663
|
setBusy(true);
|
|
1649
1664
|
setErr(null);
|
|
1665
|
+
track({ component: "ConfirmDelete", action: "confirm", id: confirmLabel });
|
|
1650
1666
|
try {
|
|
1651
1667
|
await run();
|
|
1652
1668
|
onDone();
|
|
1653
1669
|
} catch (e) {
|
|
1654
|
-
|
|
1670
|
+
const message2 = classifyBackend(e).message || "Failed to delete.";
|
|
1671
|
+
track({ component: "ConfirmDelete", action: "error", id: confirmLabel, value: message2 });
|
|
1672
|
+
setErr(message2);
|
|
1655
1673
|
setBusy(false);
|
|
1656
1674
|
}
|
|
1657
1675
|
};
|
|
@@ -1669,7 +1687,18 @@ function ConfirmDelete({
|
|
|
1669
1687
|
children: busy ? "Deleting\u2026" : confirmLabel
|
|
1670
1688
|
}
|
|
1671
1689
|
),
|
|
1672
|
-
/* @__PURE__ */ jsx(
|
|
1690
|
+
/* @__PURE__ */ jsx(
|
|
1691
|
+
Button,
|
|
1692
|
+
{
|
|
1693
|
+
chromeless: true,
|
|
1694
|
+
onPress: () => {
|
|
1695
|
+
track({ component: "ConfirmDelete", action: "cancel", id: confirmLabel });
|
|
1696
|
+
onDone();
|
|
1697
|
+
},
|
|
1698
|
+
disabled: busy,
|
|
1699
|
+
children: "Cancel"
|
|
1700
|
+
}
|
|
1701
|
+
)
|
|
1673
1702
|
] })
|
|
1674
1703
|
] });
|
|
1675
1704
|
}
|
|
@@ -1677,8 +1706,10 @@ function Segmented({
|
|
|
1677
1706
|
options,
|
|
1678
1707
|
value,
|
|
1679
1708
|
onChange,
|
|
1680
|
-
size = "$2"
|
|
1709
|
+
size = "$2",
|
|
1710
|
+
name
|
|
1681
1711
|
}) {
|
|
1712
|
+
const track = useEmit();
|
|
1682
1713
|
return /* @__PURE__ */ jsx(XStack, { gap: "$1", flexWrap: "wrap", items: "center", children: options.map((o) => {
|
|
1683
1714
|
const active = o.value === value;
|
|
1684
1715
|
return /* @__PURE__ */ jsx(
|
|
@@ -1689,17 +1720,30 @@ function Segmented({
|
|
|
1689
1720
|
borderWidth: 1,
|
|
1690
1721
|
borderColor: active ? "$color7" : "$borderColor",
|
|
1691
1722
|
"aria-pressed": active,
|
|
1692
|
-
onPress: () =>
|
|
1723
|
+
onPress: () => {
|
|
1724
|
+
track({ component: "Segmented", action: "filter", id: name, value: o.value });
|
|
1725
|
+
onChange(o.value);
|
|
1726
|
+
},
|
|
1693
1727
|
children: /* @__PURE__ */ jsx(Text, { fontSize: "$2", fontWeight: active ? "700" : "500", color: active ? "$color12" : "$color11", children: o.label })
|
|
1694
1728
|
},
|
|
1695
1729
|
o.value
|
|
1696
1730
|
);
|
|
1697
1731
|
}) });
|
|
1698
1732
|
}
|
|
1699
|
-
function SearchInput({
|
|
1733
|
+
function SearchInput({
|
|
1734
|
+
value,
|
|
1735
|
+
onChange,
|
|
1736
|
+
placeholder,
|
|
1737
|
+
name
|
|
1738
|
+
}) {
|
|
1739
|
+
const track = useEmit();
|
|
1740
|
+
const onChangeTracked = (v) => {
|
|
1741
|
+
track({ component: "SearchInput", action: "search", id: name, value: textSize(v) });
|
|
1742
|
+
onChange(v);
|
|
1743
|
+
};
|
|
1700
1744
|
return /* @__PURE__ */ jsxs(XStack, { flex: 1, minW: 180, items: "center", gap: "$2", px: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$4", bg: "$color1", children: [
|
|
1701
1745
|
/* @__PURE__ */ jsx(Search, { size: 15, color: "$color10" }),
|
|
1702
|
-
/* @__PURE__ */ jsx(Input, { flex: 1, value, onChangeText:
|
|
1746
|
+
/* @__PURE__ */ jsx(Input, { flex: 1, value, onChangeText: onChangeTracked, placeholder, borderWidth: 0, bg: "transparent", px: "$0", fontSize: "$3" })
|
|
1703
1747
|
] });
|
|
1704
1748
|
}
|
|
1705
1749
|
|
|
@@ -2136,6 +2180,7 @@ function ToastViewport({ toasts, dismiss }) {
|
|
|
2136
2180
|
);
|
|
2137
2181
|
}
|
|
2138
2182
|
function ToastProvider({ children }) {
|
|
2183
|
+
const track = useEmit();
|
|
2139
2184
|
const [toasts, setToasts] = useState([]);
|
|
2140
2185
|
const timers = useRef(/* @__PURE__ */ new Map());
|
|
2141
2186
|
const seq = useRef(0);
|
|
@@ -2152,6 +2197,7 @@ function ToastProvider({ children }) {
|
|
|
2152
2197
|
const id = ++seq.current;
|
|
2153
2198
|
const kind = input.kind ?? "info";
|
|
2154
2199
|
const durationMs = input.durationMs ?? (kind === "error" ? 6e3 : 3500);
|
|
2200
|
+
track({ component: "Toast", action: kind === "error" ? "error" : "view", id: input.title, value: kind });
|
|
2155
2201
|
setToasts((ts) => [...ts, { id, kind, title: input.title, description: input.description, durationMs }]);
|
|
2156
2202
|
if (durationMs > 0) {
|
|
2157
2203
|
timers.current.set(
|
|
@@ -2160,7 +2206,7 @@ function ToastProvider({ children }) {
|
|
|
2160
2206
|
);
|
|
2161
2207
|
}
|
|
2162
2208
|
},
|
|
2163
|
-
[dismiss]
|
|
2209
|
+
[dismiss, track]
|
|
2164
2210
|
);
|
|
2165
2211
|
useEffect(() => {
|
|
2166
2212
|
const map = timers.current;
|