@flytedan/flytebot-design-system 0.11.6 → 0.12.0
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/index.cjs +56 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +74 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +18 -0
package/dist/index.cjs
CHANGED
|
@@ -1092,8 +1092,34 @@ function Tabs({ tabs = [], value, onChange, className = "", ...rest }) {
|
|
|
1092
1092
|
// src/components/navigation/Topbar.tsx
|
|
1093
1093
|
var React5 = __toESM(require("react"), 1);
|
|
1094
1094
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1095
|
-
function
|
|
1096
|
-
|
|
1095
|
+
function useIsNarrow(breakpoint) {
|
|
1096
|
+
const [narrow, setNarrow] = React5.useState(
|
|
1097
|
+
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(`(max-width: ${breakpoint}px)`).matches
|
|
1098
|
+
);
|
|
1099
|
+
React5.useEffect(() => {
|
|
1100
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1101
|
+
const mq = window.matchMedia(`(max-width: ${breakpoint}px)`);
|
|
1102
|
+
const apply = () => setNarrow(mq.matches);
|
|
1103
|
+
apply();
|
|
1104
|
+
mq.addEventListener("change", apply);
|
|
1105
|
+
return () => mq.removeEventListener("change", apply);
|
|
1106
|
+
}, [breakpoint]);
|
|
1107
|
+
return narrow;
|
|
1108
|
+
}
|
|
1109
|
+
function Topbar({
|
|
1110
|
+
crumbs = [],
|
|
1111
|
+
actions,
|
|
1112
|
+
overflowActions,
|
|
1113
|
+
overflowBreakpoint = 640,
|
|
1114
|
+
loading = false,
|
|
1115
|
+
onMenu,
|
|
1116
|
+
className = "",
|
|
1117
|
+
...rest
|
|
1118
|
+
}) {
|
|
1119
|
+
const narrow = useIsNarrow(overflowBreakpoint);
|
|
1120
|
+
const [moreOpen, setMoreOpen] = React5.useState(false);
|
|
1121
|
+
const moreRef = React5.useRef(null);
|
|
1122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("header", { className: ["fd-topbar", narrow ? "is-narrow" : "", className].filter(Boolean).join(" "), ...rest, children: [
|
|
1097
1123
|
onMenu ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", className: "fd-btn-icon", "aria-label": "Menu", onClick: onMenu, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("i", { className: "ph ph-list" }) }) : null,
|
|
1098
1124
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("nav", { className: "fd-crumb", "aria-label": "Breadcrumb", children: crumbs.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(React5.Fragment, { children: [
|
|
1099
1125
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("i", { className: "ph ph-caret-right", style: { fontSize: 11, opacity: 0.6 }, "aria-hidden": "true" }) : null,
|
|
@@ -1110,6 +1136,34 @@ function Topbar({ crumbs = [], actions, loading = false, onMenu, className = "",
|
|
|
1110
1136
|
)
|
|
1111
1137
|
] }, i)) }),
|
|
1112
1138
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { flex: 1 } }),
|
|
1139
|
+
overflowActions != null ? narrow ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1140
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1141
|
+
"button",
|
|
1142
|
+
{
|
|
1143
|
+
type: "button",
|
|
1144
|
+
ref: moreRef,
|
|
1145
|
+
className: "fd-btn-icon",
|
|
1146
|
+
"aria-label": "More actions",
|
|
1147
|
+
"aria-haspopup": "dialog",
|
|
1148
|
+
"aria-expanded": moreOpen,
|
|
1149
|
+
onClick: () => setMoreOpen((v) => !v),
|
|
1150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("i", { className: "ph ph-dots-three-vertical", "aria-hidden": "true" })
|
|
1151
|
+
}
|
|
1152
|
+
),
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1154
|
+
Popover,
|
|
1155
|
+
{
|
|
1156
|
+
open: moreOpen,
|
|
1157
|
+
anchorRef: moreRef,
|
|
1158
|
+
onClose: () => setMoreOpen(false),
|
|
1159
|
+
placement: "bottom-end",
|
|
1160
|
+
padded: true,
|
|
1161
|
+
label: "More actions",
|
|
1162
|
+
className: "fd-topbar-overflow",
|
|
1163
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "fd-stack fd-topbar-overflow-list", children: overflowActions })
|
|
1164
|
+
}
|
|
1165
|
+
)
|
|
1166
|
+
] }) : overflowActions : null,
|
|
1113
1167
|
actions,
|
|
1114
1168
|
loading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "fd-topload", "aria-hidden": "true" }) : null
|
|
1115
1169
|
] });
|