@hanzo/ui 8.0.8 → 8.0.11
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/{chunk-HSPMQQVJ.cjs → chunk-M2ILMK44.cjs} +54 -16
- package/dist/chunk-M2ILMK44.cjs.map +1 -0
- package/dist/{chunk-GDGVXU7W.js → chunk-YSURJUOA.js} +53 -17
- package/dist/chunk-YSURJUOA.js.map +1 -0
- package/dist/index.cjs +73 -65
- package/dist/index.js +1 -1
- package/dist/oss/blueprint.d.ts +37 -0
- package/dist/oss/catalog.d.ts +67 -0
- package/dist/oss.cjs +190 -0
- package/dist/oss.cjs.map +1 -0
- package/dist/oss.d.ts +2 -0
- package/dist/oss.js +180 -0
- package/dist/oss.js.map +1 -0
- package/dist/product/OrgMark.d.ts +21 -0
- package/dist/product/OrgSwitcher.d.ts +8 -1
- package/dist/product/index.cjs +73 -65
- package/dist/product/index.d.ts +1 -0
- package/dist/product/index.js +1 -1
- package/dist/telemetry.cjs +15 -0
- package/dist/telemetry.cjs.map +1 -0
- package/dist/telemetry.d.ts +1 -0
- package/dist/telemetry.js +4 -0
- package/dist/telemetry.js.map +1 -0
- package/package.json +15 -2
- package/dist/chunk-GDGVXU7W.js.map +0 -1
- package/dist/chunk-HSPMQQVJ.cjs.map +0 -1
|
@@ -968,6 +968,44 @@ function AppHeader({
|
|
|
968
968
|
] })
|
|
969
969
|
] });
|
|
970
970
|
}
|
|
971
|
+
function monogram(name) {
|
|
972
|
+
const words = name.trim().split(/[\s._/-]+/).filter(Boolean);
|
|
973
|
+
const letters = words.slice(0, 2).map((w) => w[0] ?? "").join("");
|
|
974
|
+
return (letters || name.trim().slice(0, 2)).toUpperCase();
|
|
975
|
+
}
|
|
976
|
+
function OrgMark({ org, size = 22, maxW }) {
|
|
977
|
+
if (org.logo) {
|
|
978
|
+
return /* @__PURE__ */ jsx(
|
|
979
|
+
"img",
|
|
980
|
+
{
|
|
981
|
+
src: org.logo,
|
|
982
|
+
alt: "",
|
|
983
|
+
style: {
|
|
984
|
+
height: size,
|
|
985
|
+
width: maxW ? "auto" : size,
|
|
986
|
+
maxWidth: maxW ?? size,
|
|
987
|
+
objectFit: "contain",
|
|
988
|
+
display: "block",
|
|
989
|
+
borderRadius: 6,
|
|
990
|
+
flexShrink: 0
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
);
|
|
994
|
+
}
|
|
995
|
+
return /* @__PURE__ */ jsx(
|
|
996
|
+
YStack,
|
|
997
|
+
{
|
|
998
|
+
width: size,
|
|
999
|
+
height: size,
|
|
1000
|
+
rounded: "$3",
|
|
1001
|
+
bg: "$color4",
|
|
1002
|
+
items: "center",
|
|
1003
|
+
justify: "center",
|
|
1004
|
+
style: { flexShrink: 0 },
|
|
1005
|
+
children: /* @__PURE__ */ jsx(Text, { fontSize: Math.round(size * 0.4), fontWeight: "800", color: "$color12", children: monogram(org.displayName || org.name) })
|
|
1006
|
+
}
|
|
1007
|
+
);
|
|
1008
|
+
}
|
|
971
1009
|
|
|
972
1010
|
// src/product/scope.ts
|
|
973
1011
|
function browserStorage() {
|
|
@@ -1037,14 +1075,7 @@ function filterOrgs(orgs, query) {
|
|
|
1037
1075
|
);
|
|
1038
1076
|
}
|
|
1039
1077
|
var titleCase = (s) => s ? s[0].toUpperCase() + s.slice(1) : s;
|
|
1040
|
-
|
|
1041
|
-
function OrgAvatar({ org, size = 22 }) {
|
|
1042
|
-
if (org.logo) {
|
|
1043
|
-
return /* @__PURE__ */ jsx("img", { src: org.logo, alt: "", style: { height: size, width: size, objectFit: "contain", display: "block", borderRadius: 6 } });
|
|
1044
|
-
}
|
|
1045
|
-
return /* @__PURE__ */ jsx(YStack, { width: size, height: size, rounded: "$3", bg: "$color4", items: "center", justify: "center", children: /* @__PURE__ */ jsx(Text, { fontSize: "$1", fontWeight: "800", color: "$color12", children: initialsOf(org) }) });
|
|
1046
|
-
}
|
|
1047
|
-
function OrgSwitcher({ scope, orgs, pageSize = 20, create, picker = false }) {
|
|
1078
|
+
function OrgSwitcher({ scope, orgs, pageSize = 20, current: given, create, picker = false }) {
|
|
1048
1079
|
const currentId = scope.currentOrg();
|
|
1049
1080
|
const [open, setOpen] = useState(false);
|
|
1050
1081
|
const [query, setQuery] = useState("");
|
|
@@ -1104,10 +1135,11 @@ function OrgSwitcher({ scope, orgs, pageSize = 20, create, picker = false }) {
|
|
|
1104
1135
|
if (orgs) return filterOrgs(rows, query);
|
|
1105
1136
|
return [{ name: currentId, displayName: titleCase(currentId) }];
|
|
1106
1137
|
}, [orgs, rows, query, currentId]);
|
|
1107
|
-
const current = useMemo(
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
);
|
|
1138
|
+
const current = useMemo(() => {
|
|
1139
|
+
if (given && given.name === currentId) return given;
|
|
1140
|
+
return rows.find((o) => o.name === currentId) ?? { name: currentId, displayName: titleCase(currentId) };
|
|
1141
|
+
}, [given, rows, currentId]);
|
|
1142
|
+
const currentLabel = current.displayName || titleCase(current.name);
|
|
1111
1143
|
const select = useCallback(
|
|
1112
1144
|
(org) => {
|
|
1113
1145
|
setOpen(false);
|
|
@@ -1129,7 +1161,11 @@ function OrgSwitcher({ scope, orgs, pageSize = 20, create, picker = false }) {
|
|
|
1129
1161
|
}
|
|
1130
1162
|
};
|
|
1131
1163
|
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, placement: "bottom-start", children: [
|
|
1132
|
-
/* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, {
|
|
1164
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { chromeless: true, height: 44, px: "$2", justify: "flex-start", "aria-label": `${currentLabel} \xB7 switch organization`, children: /* @__PURE__ */ jsxs(XStack, { items: "center", gap: "$2.5", flex: 1, minW: 0, children: [
|
|
1165
|
+
/* @__PURE__ */ jsx(OrgMark, { org: current, size: 30 }),
|
|
1166
|
+
/* @__PURE__ */ jsx(Text, { flex: 1, minW: 0, fontSize: "$4", fontWeight: "800", color: "$color12", numberOfLines: 1, children: currentLabel }),
|
|
1167
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { size: 15, color: "$color9" })
|
|
1168
|
+
] }) }) }),
|
|
1133
1169
|
/* @__PURE__ */ jsx(Popover.Content, { bordered: true, elevate: true, p: "$2", width: 300, bg: "$color2", borderColor: "$borderColor", children: creating ? /* @__PURE__ */ jsxs(YStack, { gap: "$2", children: [
|
|
1134
1170
|
/* @__PURE__ */ jsx(Text, { fontSize: "$2", color: "$color12", fontWeight: "700", children: "Create organization" }),
|
|
1135
1171
|
/* @__PURE__ */ jsx(
|
|
@@ -1200,7 +1236,7 @@ function OrgSwitcher({ scope, orgs, pageSize = 20, create, picker = false }) {
|
|
|
1200
1236
|
bg: org.name === currentId ? "$color4" : "transparent",
|
|
1201
1237
|
hoverStyle: { bg: "$color5" },
|
|
1202
1238
|
children: [
|
|
1203
|
-
/* @__PURE__ */ jsx(
|
|
1239
|
+
/* @__PURE__ */ jsx(OrgMark, { org }),
|
|
1204
1240
|
/* @__PURE__ */ jsx(Text, { flex: 1, fontSize: "$2", color: "$color12", numberOfLines: 1, children: org.displayName || org.name }),
|
|
1205
1241
|
org.name === currentId ? /* @__PURE__ */ jsx(Check, { size: 15 }) : null
|
|
1206
1242
|
]
|
|
@@ -1994,6 +2030,6 @@ function useToast() {
|
|
|
1994
2030
|
return ctx;
|
|
1995
2031
|
}
|
|
1996
2032
|
|
|
1997
|
-
export { AppHeader, BarChart, BarRows, BrandMark, CHART_OTHER, CHART_PALETTE, ComboBox, ContextMenu, DataTable, Donut, Donut2, DropdownMenu, EmptyState, FadeIn, FieldRow, FieldSelect, FieldSlider, FieldSwitch, FieldText, FieldTextArea, FloatingMenu, GenericLogo, HanzoMark, HintButton, LG, LegendDot, LineChart, MenuItemView, MenuLabelView, MenuPanel, MenuSeparatorView, MetricCard, MiniBars, OrgSwitcher, PageHeader, Panel, PortalTheme, PrimaryButton, ProductIcon, ProviderLogo, Reorder, SERIES, SURFACES, SelectMenu, SlideOver, Sparkline, Sparkline2, StatusTag, ToastProvider, UtilBar, asColor, colorForIndex, filterOptions, filterOrgs, isKnownOption, orgScope, otherSurfaces, providerInitials, renderMenuItems, rowShift, targetIndex, useToast, utilColor };
|
|
1998
|
-
//# sourceMappingURL=chunk-
|
|
1999
|
-
//# sourceMappingURL=chunk-
|
|
2033
|
+
export { AppHeader, BarChart, BarRows, BrandMark, CHART_OTHER, CHART_PALETTE, ComboBox, ContextMenu, DataTable, Donut, Donut2, DropdownMenu, EmptyState, FadeIn, FieldRow, FieldSelect, FieldSlider, FieldSwitch, FieldText, FieldTextArea, FloatingMenu, GenericLogo, HanzoMark, HintButton, LG, LegendDot, LineChart, MenuItemView, MenuLabelView, MenuPanel, MenuSeparatorView, MetricCard, MiniBars, OrgMark, OrgSwitcher, PageHeader, Panel, PortalTheme, PrimaryButton, ProductIcon, ProviderLogo, Reorder, SERIES, SURFACES, SelectMenu, SlideOver, Sparkline, Sparkline2, StatusTag, ToastProvider, UtilBar, asColor, colorForIndex, filterOptions, filterOrgs, isKnownOption, monogram, orgScope, otherSurfaces, providerInitials, renderMenuItems, rowShift, targetIndex, useToast, utilColor };
|
|
2034
|
+
//# sourceMappingURL=chunk-YSURJUOA.js.map
|
|
2035
|
+
//# sourceMappingURL=chunk-YSURJUOA.js.map
|