@abumble/design-system 0.0.27 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
export interface BackLinkProps extends React.ComponentProps<'a'> {
|
|
2
3
|
/** Link text, e.g. "Back to properties". */
|
|
3
4
|
label: string;
|
|
@@ -17,5 +18,5 @@ export interface BackLinkProps extends React.ComponentProps<'a'> {
|
|
|
17
18
|
* // Plain link:
|
|
18
19
|
* <BackLink href="/properties" label="Back to properties" />
|
|
19
20
|
*/
|
|
20
|
-
export declare function BackLink({ label, asChild, className, ...props }: BackLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function BackLink({ label, asChild, className, children, ...props }: BackLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
21
22
|
//# sourceMappingURL=BackLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackLink.d.ts","sourceRoot":"","sources":["../../../src/components/BackLink/BackLink.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BackLink.d.ts","sourceRoot":"","sources":["../../../src/components/BackLink/BackLink.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC;IAC/D,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAA;IACb,gGAAgG;IAChG,OAAO,CAAC,EAAE,OAAO,CAAA;CACjB;AASD;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,EACxB,KAAK,EACL,OAAe,EACf,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACR,EAAE,aAAa,2CA0Bf"}
|
package/dist/shared/BackLink.js
CHANGED
|
@@ -1,30 +1,42 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsxs as d, jsx as t, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { c as h } from "./utils.js";
|
|
3
|
+
import { ChevronLeft as k } from "lucide-react";
|
|
4
|
+
import * as s from "react";
|
|
5
|
+
const o = (e) => /* @__PURE__ */ d(f, { children: [
|
|
6
|
+
/* @__PURE__ */ t(k, { className: "size-4 shrink-0", "aria-hidden": !0 }),
|
|
7
|
+
/* @__PURE__ */ t("span", { children: e })
|
|
8
|
+
] });
|
|
9
|
+
function g({
|
|
10
|
+
label: e,
|
|
11
|
+
asChild: a = !1,
|
|
12
|
+
className: i,
|
|
13
|
+
children: c,
|
|
9
14
|
...n
|
|
10
15
|
}) {
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
const r = h(
|
|
17
|
+
"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",
|
|
18
|
+
i
|
|
19
|
+
);
|
|
20
|
+
if (a) {
|
|
21
|
+
const l = s.Children.only(c), m = {
|
|
22
|
+
"data-slot": "back-link",
|
|
23
|
+
className: r,
|
|
24
|
+
...n,
|
|
25
|
+
children: o(e)
|
|
26
|
+
};
|
|
27
|
+
return s.cloneElement(l, m);
|
|
28
|
+
}
|
|
29
|
+
return /* @__PURE__ */ t(
|
|
30
|
+
"a",
|
|
13
31
|
{
|
|
14
32
|
"data-slot": "back-link",
|
|
15
|
-
className:
|
|
16
|
-
"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",
|
|
17
|
-
o
|
|
18
|
-
),
|
|
33
|
+
className: r,
|
|
19
34
|
...n,
|
|
20
|
-
children:
|
|
21
|
-
/* @__PURE__ */ e(m, { className: "size-4 shrink-0", "aria-hidden": !0 }),
|
|
22
|
-
/* @__PURE__ */ e("span", { children: r })
|
|
23
|
-
]
|
|
35
|
+
children: o(e)
|
|
24
36
|
}
|
|
25
37
|
);
|
|
26
38
|
}
|
|
27
39
|
export {
|
|
28
|
-
|
|
40
|
+
g as B
|
|
29
41
|
};
|
|
30
42
|
//# sourceMappingURL=BackLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackLink.js","sources":["../../src/components/BackLink/BackLink.tsx"],"sourcesContent":["import { cn } from '@/utils'\nimport {
|
|
1
|
+
{"version":3,"file":"BackLink.js","sources":["../../src/components/BackLink/BackLink.tsx"],"sourcesContent":["import { cn } from '@/utils'\nimport { ChevronLeft } from 'lucide-react'\nimport * as React from 'react'\n\nexport interface BackLinkProps extends React.ComponentProps<'a'> {\n\t/** Link text, e.g. \"Back to properties\". */\n\tlabel: string\n\t/** If true, renders the provided child element as the link. Use with router Link components. */\n\tasChild?: boolean\n}\n\nconst slotContent = (label: string) => (\n\t<>\n\t\t<ChevronLeft className=\"size-4 shrink-0\" aria-hidden />\n\t\t<span>{label}</span>\n\t</>\n)\n\n/**\n * Back link with chevron icon. Router-agnostic via asChild pattern.\n *\n * @example\n * // With TanStack Router:\n * <BackLink asChild label=\"Back to properties\">\n * <Link to=\"..\" replace />\n * </BackLink>\n *\n * @example\n * // Plain link:\n * <BackLink href=\"/properties\" label=\"Back to properties\" />\n */\nexport function BackLink({\n\tlabel,\n\tasChild = false,\n\tclassName,\n\tchildren,\n\t...props\n}: BackLinkProps) {\n\tconst slotClassName = cn(\n\t\t'inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground',\n\t\tclassName,\n\t)\n\n\tif (asChild) {\n\t\tconst child = React.Children.only(children) as React.ReactElement\n\t\tconst mergedProps = {\n\t\t\t'data-slot': 'back-link',\n\t\t\tclassName: slotClassName,\n\t\t\t...props,\n\t\t\tchildren: slotContent(label),\n\t\t}\n\t\treturn React.cloneElement(child, mergedProps)\n\t}\n\n\treturn (\n\t\t<a\n\t\t\tdata-slot=\"back-link\"\n\t\t\tclassName={slotClassName}\n\t\t\t{...props}\n\t\t>\n\t\t\t{slotContent(label)}\n\t\t</a>\n\t)\n}\n"],"names":["slotContent","label","jsxs","Fragment","jsx","ChevronLeft","BackLink","asChild","className","children","props","slotClassName","cn","child","React","mergedProps"],"mappings":";;;;AAWA,MAAMA,IAAc,CAACC,MACpB,gBAAAC,EAAAC,GAAA,EACC,UAAA;AAAA,EAAA,gBAAAC,EAACC,GAAA,EAAY,WAAU,mBAAkB,eAAW,IAAC;AAAA,EACrD,gBAAAD,EAAC,UAAM,UAAAH,EAAA,CAAM;AAAA,GACd;AAgBM,SAASK,EAAS;AAAA,EACxB,OAAAL;AAAA,EACA,SAAAM,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACJ,GAAkB;AACjB,QAAMC,IAAgBC;AAAA,IACrB;AAAA,IACAJ;AAAA,EAAA;AAGD,MAAID,GAAS;AACZ,UAAMM,IAAQC,EAAM,SAAS,KAAKL,CAAQ,GACpCM,IAAc;AAAA,MACnB,aAAa;AAAA,MACb,WAAWJ;AAAA,MACX,GAAGD;AAAA,MACH,UAAUV,EAAYC,CAAK;AAAA,IAAA;AAE5B,WAAOa,EAAM,aAAaD,GAAOE,CAAW;AAAA,EAC7C;AAEA,SACC,gBAAAX;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,aAAU;AAAA,MACV,WAAWO;AAAA,MACV,GAAGD;AAAA,MAEH,YAAYT,CAAK;AAAA,IAAA;AAAA,EAAA;AAGrB;"}
|