UNPKG

@konstructio/ui

Version:

A set of reusable and customizable React components built for konstruct.io

110 lines (109 loc) 3.04 kB
import { jsx as a, jsxs as y } from "react/jsx-runtime"; import d, { forwardRef as O, useId as j, Fragment as w } from "react"; import { cn as c } from "../../utils/index.js"; import { chevronVariants as x, breadcrumbVariants as P, breadcrumbWrapperVariants as T } from "./Breadcrumb.variants.js"; import { Item as k } from "./components/Item/Item.js"; import { P as s } from "../../index-C5psggHV.js"; import { useTheme as N } from "../../contexts/theme.hook.js"; function h() { return h = Object.assign || function(e) { for (var n = 1; n < arguments.length; n++) { var r = arguments[n]; for (var t in r) Object.prototype.hasOwnProperty.call(r, t) && (e[t] = r[t]); } return e; }, h.apply(this, arguments); } function _(e, n) { if (e == null) return {}; var r = L(e, n), t, o; if (Object.getOwnPropertySymbols) { var i = Object.getOwnPropertySymbols(e); for (o = 0; o < i.length; o++) t = i[o], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (r[t] = e[t]); } return r; } function L(e, n) { if (e == null) return {}; var r = {}, t = Object.keys(e), o, i; for (i = 0; i < t.length; i++) o = t[i], !(n.indexOf(o) >= 0) && (r[o] = e[o]); return r; } var p = O(function(e, n) { var r = e.color, t = r === void 0 ? "currentColor" : r, o = e.size, i = o === void 0 ? 24 : o, l = _(e, ["color", "size"]); return /* @__PURE__ */ d.createElement("svg", h({ ref: n, xmlns: "http://www.w3.org/2000/svg", width: i, height: i, viewBox: "0 0 24 24", fill: "none", stroke: t, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, l), /* @__PURE__ */ d.createElement("polyline", { points: "9 18 15 12 9 6" })); }); p.propTypes = { color: s.string, size: s.oneOfType([s.string, s.number]) }; p.displayName = "ChevronRight"; const V = ({ className: e, size: n, steps: r, theme: t, "aria-label": o = "breadcrumb", wrapperClassName: i, ...l }) => { const g = j(), { theme: v } = N(), m = t ?? v; return /* @__PURE__ */ a( "nav", { "aria-label": o, className: c( T({ className: i, theme: m }) ), children: /* @__PURE__ */ a( "ol", { className: c( P({ theme: m, className: e, size: n }) ), ...l, children: r.map(({ label: f, ...b }, u) => /* @__PURE__ */ y(w, { children: [ /* @__PURE__ */ a( k, { ...b, label: f, isLast: u === r.length - 1, size: n, theme: m } ), u !== r.length - 1 && /* @__PURE__ */ a("li", { "aria-hidden": "true", children: /* @__PURE__ */ a( p, { className: c(x({ size: n, theme: m })) } ) }) ] }, `${g}-${f}`)) } ) } ); }; export { V as Breadcrumb };