analytica-frontend-lib
Version:
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino
74 lines (70 loc) • 1.96 kB
JavaScript
import {
Menu,
MenuContent,
MenuItem
} from "./chunk-WI3GQX74.mjs";
// src/components/PeriodSelector/PeriodSelector.tsx
import { useMemo } from "react";
// src/components/PeriodSelector/types.ts
var Period = /* @__PURE__ */ ((Period2) => {
Period2["SEVEN_DAYS"] = "7_DAYS";
Period2["ONE_MONTH"] = "1_MONTH";
Period2["THREE_MONTHS"] = "3_MONTHS";
Period2["SIX_MONTHS"] = "6_MONTHS";
Period2["ONE_YEAR"] = "1_YEAR";
return Period2;
})(Period || {});
var PERIOD_OPTIONS = [
{ value: "7_DAYS" /* SEVEN_DAYS */, label: "7 dias" },
{ value: "1_MONTH" /* ONE_MONTH */, label: "1 m\xEAs" },
{ value: "3_MONTHS" /* THREE_MONTHS */, label: "3 meses" },
{ value: "6_MONTHS" /* SIX_MONTHS */, label: "6 meses" },
{ value: "1_YEAR" /* ONE_YEAR */, label: "1 ano" }
];
// src/components/PeriodSelector/PeriodSelector.tsx
import { jsx } from "react/jsx-runtime";
function PeriodSelector({
value,
onChange,
defaultValue = "1_MONTH",
options = PERIOD_OPTIONS,
excludeValues = [],
className
}) {
const filteredOptions = useMemo(() => {
if (excludeValues.length === 0) {
return options;
}
return options.filter(
(opt) => !excludeValues.includes(opt.value)
);
}, [options, excludeValues]);
return /* @__PURE__ */ jsx(
Menu,
{
defaultValue,
value,
variant: "breadcrumb",
className: `!px-0 ${className ?? ""}`,
onValueChange: onChange,
children: /* @__PURE__ */ jsx(MenuContent, { className: "!px-0", children: filteredOptions.map((tab) => /* @__PURE__ */ jsx(
MenuItem,
{
variant: "menu2",
value: tab.value,
className: "w-full flex items-center justify-center",
children: tab.label
},
tab.value
)) })
}
);
}
var PeriodSelector_default = PeriodSelector;
export {
Period,
PERIOD_OPTIONS,
PeriodSelector,
PeriodSelector_default
};
//# sourceMappingURL=chunk-I3TCUZIY.mjs.map