@helpwave/hightide
Version:
helpwave's component and theming library
132 lines (129 loc) • 4.41 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/SortButton.tsx
var SortButton_exports = {};
__export(SortButton_exports, {
SortButton: () => SortButton
});
module.exports = __toCommonJS(SortButton_exports);
var import_lucide_react = require("lucide-react");
// src/components/Button.tsx
var import_clsx = __toESM(require("clsx"));
var import_jsx_runtime = require("react/jsx-runtime");
var ButtonSizePaddings = {
small: "btn-sm",
medium: "btn-md",
large: "btn-lg"
};
var TextButton = ({
children,
disabled = false,
color = "neutral",
size = "medium",
startIcon,
endIcon,
onClick,
className,
...restProps
}) => {
const colorClasses = {
negative: "bg-transparent text-button-text-negative-text",
neutral: "bg-transparent text-button-text-neutral-text"
}[color];
const iconColorClasses = {
negative: "text-button-text-negative-icon",
neutral: "text-button-text-neutral-icon"
}[color];
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
"button",
{
onClick: disabled ? void 0 : onClick,
disabled: disabled || onClick === void 0,
className: (0, import_clsx.default)(
className,
{
"text-disabled-text": disabled,
[(0, import_clsx.default)(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
},
ButtonSizePaddings[size]
),
...restProps,
children: [
startIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"span",
{
className: (0, import_clsx.default)({
[iconColorClasses]: !disabled,
[`text-disabled-icon`]: disabled
}),
children: startIcon
}
),
children,
endIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"span",
{
className: (0, import_clsx.default)({
[iconColorClasses]: !disabled,
[`text-disabled-icon`]: disabled
}),
children: endIcon
}
)
]
}
);
};
// src/components/SortButton.tsx
var import_jsx_runtime2 = require("react/jsx-runtime");
var SortButton = ({
children,
ascending,
color,
onClick,
...buttonProps
}) => {
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
TextButton,
{
color,
onClick: () => onClick(ascending === "descending" ? "ascending" : "descending"),
...buttonProps,
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "row gap-x-2", children: [
children,
ascending === "ascending" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronUp, {}) : !ascending ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronsUpDown, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.ChevronDown, {})
] })
}
);
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SortButton
});
//# sourceMappingURL=SortButton.js.map