analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
83 lines (80 loc) • 2.83 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/components/NavButton/NavButton.tsx
var NavButton_exports = {};
__export(NavButton_exports, {
default: () => NavButton_default
});
module.exports = __toCommonJS(NavButton_exports);
var import_react = require("react");
// src/utils/utils.ts
var import_clsx = require("clsx");
var import_tailwind_merge = require("tailwind-merge");
function cn(...inputs) {
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
}
// src/components/NavButton/NavButton.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var NavButton = (0, import_react.forwardRef)(
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
const baseClasses = [
"flex",
"flex-col",
"items-center",
"justify-center",
"gap-0.5",
"px-12",
"py-1",
"rounded-sm",
"cursor-pointer",
"text-text-950",
"text-xs",
"font-medium",
"hover:text-text",
"hover:bg-primary-600",
"focus-visible:outline-none",
"focus-visible:ring-2",
"focus-visible:ring-offset-0",
"focus-visible:ring-indicator-info",
"disabled:opacity-50",
"disabled:cursor-not-allowed",
"disabled:pointer-events-none"
];
const stateClasses = selected ? ["bg-primary-50", "text-primary-950"] : [];
const allClasses = [...baseClasses, ...stateClasses].join(" ");
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
"button",
{
ref,
type: "button",
className: cn(allClasses, className),
disabled,
"aria-pressed": selected,
...props,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "whitespace-nowrap", children: label })
]
}
);
}
);
NavButton.displayName = "NavButton";
var NavButton_default = NavButton;
//# sourceMappingURL=index.js.map