UNPKG

@spark-ui/components

Version:

Spark (Leboncoin design system) components.

99 lines (95 loc) 3.21 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/text-link/index.ts var text_link_exports = {}; __export(text_link_exports, { TextLink: () => TextLink }); module.exports = __toCommonJS(text_link_exports); // src/text-link/TextLink.tsx var import_class_variance_authority = require("class-variance-authority"); // src/slot/Slot.tsx var import_radix_ui = require("radix-ui"); var import_react = require("react"); var import_jsx_runtime = require("react/jsx-runtime"); var Slottable = import_radix_ui.Slot.Slottable; var Slot = ({ ref, ...props }) => { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props }); }; // src/text-link/TextLink.tsx var import_jsx_runtime2 = require("react/jsx-runtime"); var textLinkStyles = (0, import_class_variance_authority.cva)(["inline-flex items-center focus-visible:u-outline"], { variants: { intent: { current: "text-current hover:opacity-dim-1", main: "text-main hover:text-main-hovered", support: "text-support hover:text-support-hovered", accent: "text-accent hover:text-accent-hovered", basic: "text-basic hover:text-basic-hovered", success: "text-success hover:text-success-hovered", alert: "text-alert hover:text-alert-hovered", danger: "text-error hover:text-error-hovered", info: "text-info hover:text-info-hovered", neutral: "text-neutral hover:text-neutral-hovered" }, /** By default, TextLink inherits the current font weight. Use `bold` to highlight it. */ bold: { true: "font-bold" }, /** * Underline is enabled by default. * You can remove it, but be careful about a11y, as you should make obvious to users what is a link or not. */ underline: { true: "underline", false: "hover:underline focus:underline" } }, defaultVariants: { intent: "current", bold: false, underline: true } }); var TextLink = ({ asChild = false, bold = false, children, className, intent = "current", underline = true, ref, ...props }) => { const Component = asChild ? Slot : "a"; return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( Component, { ref, className: textLinkStyles({ className, bold, intent, underline }), ...props, children } ); }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { TextLink }); //# sourceMappingURL=index.js.map