mywhy-ui 0.5.2 → 0.6.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/README.md +2 -1
- package/dist/index.cjs +53 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,8 @@ React component library for the [mywhy](https://github.com/mywhy/mywhy) robotics
|
|
|
8
8
|
npm install mywhy-ui
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
**Peer dependencies:** `react >= 18` and `react-dom >= 18`
|
|
11
|
+
**Peer dependencies:** `react >= 18` and `react-dom >= 18`
|
|
12
|
+
**Node.js support:** `>= 24.0.0`
|
|
12
13
|
|
|
13
14
|
## Setup
|
|
14
15
|
|
package/dist/index.cjs
CHANGED
|
@@ -787,6 +787,58 @@ function FormControl({
|
|
|
787
787
|
helperText && !error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-ink-light", children: helperText })
|
|
788
788
|
] });
|
|
789
789
|
}
|
|
790
|
+
function Navbar({
|
|
791
|
+
left,
|
|
792
|
+
center,
|
|
793
|
+
right,
|
|
794
|
+
brand,
|
|
795
|
+
items,
|
|
796
|
+
sticky = false,
|
|
797
|
+
bordered = true,
|
|
798
|
+
className = "",
|
|
799
|
+
...props
|
|
800
|
+
}) {
|
|
801
|
+
const classes = [
|
|
802
|
+
"w-full h-16 bg-surface",
|
|
803
|
+
bordered ? "border-b border-outline" : "",
|
|
804
|
+
sticky ? "sticky top-0" : "",
|
|
805
|
+
"flex items-center px-6 gap-4",
|
|
806
|
+
"z-40",
|
|
807
|
+
className
|
|
808
|
+
].filter(Boolean).join(" ");
|
|
809
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("nav", { className: classes, ...props, children: [
|
|
810
|
+
(brand || left) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-4 flex-shrink-0", children: [
|
|
811
|
+
brand && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-lg font-semibold text-text-primary", children: brand }),
|
|
812
|
+
left && /* @__PURE__ */ jsxRuntime.jsx("div", { children: left })
|
|
813
|
+
] }),
|
|
814
|
+
center && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center", children: center }),
|
|
815
|
+
items && items.length > 0 && !center && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center gap-1", children: items.map((item, idx) => /* @__PURE__ */ jsxRuntime.jsx(NavbarItemComponent, { item }, idx)) }),
|
|
816
|
+
right && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-4 flex-shrink-0 ml-auto", children: right })
|
|
817
|
+
] });
|
|
818
|
+
}
|
|
819
|
+
function NavbarItemComponent({ item }) {
|
|
820
|
+
const classes = [
|
|
821
|
+
"px-4 py-2 rounded-md text-sm font-medium",
|
|
822
|
+
"transition-colors",
|
|
823
|
+
item.disabled ? "text-text-muted cursor-not-allowed" : "text-text-secondary hover:bg-surface-hover hover:text-text-primary cursor-pointer"
|
|
824
|
+
].join(" ");
|
|
825
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
826
|
+
item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2", children: item.icon }),
|
|
827
|
+
item.label
|
|
828
|
+
] });
|
|
829
|
+
if (item.href) {
|
|
830
|
+
return /* @__PURE__ */ jsxRuntime.jsx("a", { href: item.href, className: classes, onClick: item.onClick, children: content });
|
|
831
|
+
}
|
|
832
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
833
|
+
"button",
|
|
834
|
+
{
|
|
835
|
+
className: classes,
|
|
836
|
+
onClick: item.onClick,
|
|
837
|
+
disabled: item.disabled,
|
|
838
|
+
children: content
|
|
839
|
+
}
|
|
840
|
+
);
|
|
841
|
+
}
|
|
790
842
|
function Tabs({
|
|
791
843
|
tabs,
|
|
792
844
|
activeTab,
|
|
@@ -3287,6 +3339,7 @@ exports.Input = Input;
|
|
|
3287
3339
|
exports.Kbd = Kbd;
|
|
3288
3340
|
exports.Link = Link;
|
|
3289
3341
|
exports.MultiSelect = MultiSelect;
|
|
3342
|
+
exports.Navbar = Navbar;
|
|
3290
3343
|
exports.NumberInput = NumberInput;
|
|
3291
3344
|
exports.Pagination = Pagination;
|
|
3292
3345
|
exports.Progress = Progress;
|