UNPKG

analytica-frontend-lib

Version:

Repositório público dos componentes utilizados nas plataformas da Analytica Ensino

66 lines (63 loc) 2.66 kB
"use strict"; 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/Chips/Chips.tsx var Chips_exports = {}; __export(Chips_exports, { default: () => Chips_default }); module.exports = __toCommonJS(Chips_exports); var import_phosphor_react = require("phosphor-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/Chips/Chips.tsx var import_jsx_runtime = require("react/jsx-runtime"); var STATE_CLASSES = { default: "bg-background text-text-950 border border-border-100 hover:bg-secondary-50 hover:border-border-300", selected: "bg-info-background text-primary-950 border-2 border-primary-950 hover:bg-secondary-50 focus-visible:border-0" }; var Chips = ({ children, selected = false, className = "", disabled, type = "button", ...props }) => { const stateClasses = selected ? STATE_CLASSES.selected : STATE_CLASSES.default; const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-normal text-sm px-4 py-2 gap-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-primary-600 disabled:opacity-40 disabled:cursor-not-allowed"; return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)( "button", { className: cn(baseClasses, stateClasses, className), disabled, type, ...props, children: [ selected && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `flex items-center`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_phosphor_react.Check, { weight: "bold", size: 16 }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "flex-1", children }) ] } ); }; var Chips_default = Chips; //# sourceMappingURL=index.js.map