@helpwave/hightide
Version:
helpwave's component and theming library
105 lines (104 loc) • 3.64 kB
JavaScript
;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/components/ChipList.tsx
var ChipList_exports = {};
__export(ChipList_exports, {
Chip: () => Chip,
ChipList: () => ChipList
});
module.exports = __toCommonJS(ChipList_exports);
var import_clsx = __toESM(require("clsx"));
var import_jsx_runtime = require("react/jsx-runtime");
var Chip = ({
children,
trailingIcon,
color = "default",
variant = "normal",
className = "",
...restProps
}) => {
const colorMapping = {
default: "text-tag-default-text bg-tag-default-background",
dark: "text-tag-dark-text bg-tag-dark-background",
red: "text-tag-red-text bg-tag-red-background",
yellow: "text-tag-yellow-text bg-tag-yellow-background",
green: "text-tag-green-text bg-tag-green-background",
blue: "text-tag-blue-text bg-tag-blue-background",
pink: "text-tag-pink-text bg-tag-pink-background"
}[color];
const colorMappingIcon = {
default: "text-tag-default-icon",
dark: "text-tag-dark-icon",
red: "text-tag-red-icon",
yellow: "text-tag-yellow-icon",
green: "text-tag-green-icon",
blue: "text-tag-blue-icon",
pink: "text-tag-pink-icon"
}[color];
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
"div",
{
...restProps,
className: (0, import_clsx.default)(
`row w-fit px-2 py-1`,
colorMapping,
{
"rounded-md": variant === "normal",
"rounded-full": variant === "fullyRounded"
},
className
),
children: [
children,
trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: colorMappingIcon, children: trailingIcon })
]
}
);
};
var ChipList = ({
list,
className = ""
}) => {
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_clsx.default)("flex flex-wrap gap-x-4 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
Chip,
{
...value,
color: value.color ?? "dark",
variant: value.variant ?? "normal",
children: value.children
},
index
)) });
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Chip,
ChipList
});
//# sourceMappingURL=ChipList.js.map