@bonprix-ds/react-wrapper-link 0.0.0-stage → 1.0.0
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.
- package/dist/index.js +2 -0
- package/dist/no-styles.js +1 -0
- package/dist/src/Link.js +41 -0
- package/dist/src/Link.js.map +1 -0
- package/dist/src/LinkRegistration.js +11 -0
- package/dist/src/LinkRegistration.js.map +1 -0
- package/dist/styles.js +1 -0
- package/package.json +57 -3
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/Link.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import e from "./LinkRegistration.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { ArrowLeftIcon as t, ArrowRightIcon as n } from "@bonprix-ds/react-icon/icons";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/Link.tsx
|
|
6
|
+
var a = "h-4 w-4 fill-current", o = ({ component: o = "a", children: s, showArrow: c = !1, arrowPosition: l = "left", small: u = !1, hideUnderline: d = !1, inverted: f, srLabel: p, ...m }) => {
|
|
7
|
+
let h = o, { type: g, ..._ } = m;
|
|
8
|
+
return /* @__PURE__ */ i("bpds-link", {
|
|
9
|
+
className: "preflight",
|
|
10
|
+
small: u ? "true" : "false",
|
|
11
|
+
"hide-underline": d ? "true" : "false",
|
|
12
|
+
inverted: f ? "true" : "false",
|
|
13
|
+
children: [/* @__PURE__ */ i(h, {
|
|
14
|
+
..._,
|
|
15
|
+
type: o === "button" ? g ?? "button" : g,
|
|
16
|
+
"data-bpds": "link",
|
|
17
|
+
"data-bpds-small": u,
|
|
18
|
+
"data-bpds-hide-underline": d,
|
|
19
|
+
"data-bpds-arrow-position": l,
|
|
20
|
+
"data-bpds-show-arrow": c,
|
|
21
|
+
"data-bpds-inverted": f,
|
|
22
|
+
children: [
|
|
23
|
+
c && l === "left" && /* @__PURE__ */ r(t, { className: a }),
|
|
24
|
+
p && /* @__PURE__ */ r("span", {
|
|
25
|
+
className: "sr-only",
|
|
26
|
+
children: p
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ r("span", {
|
|
29
|
+
"aria-hidden": p ? "true" : void 0,
|
|
30
|
+
children: s
|
|
31
|
+
}),
|
|
32
|
+
c && l === "right" && /* @__PURE__ */ r(n, { className: a })
|
|
33
|
+
]
|
|
34
|
+
}), /* @__PURE__ */ r(e, {})]
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
o.displayName = "Link";
|
|
38
|
+
//#endregion
|
|
39
|
+
export { o as default };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=Link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.js","names":["LinkRegistration","ICON_CLASSES","Link","props","Component","component","nativeProps","small","hideUnderline","inverted","type","arrowPosition","showArrow","ArrowLeftIcon","srLabel","ArrowRightIcon"],"sources":["../../src/Link.tsx"],"sourcesContent":["import React, { type ComponentProps, type ElementType } from \"react\";\n\nimport { ArrowLeftIcon, ArrowRightIcon } from \"@bonprix-ds/react-icon/icons\";\nimport type { LinkBaseProps } from \"@bonprix-ds/react-link\";\n\nimport LinkRegistration from \"./LinkRegistration\";\n\nexport type Props<C extends ElementType = \"a\"> = LinkBaseProps & {\n /** The semantic component to render the Link. Preferably `\"a\"`, `\"button\"` or something like `Link` from NextJS. Native props will be passed to this component. */\n component?: C;\n} & Omit<ComponentProps<C>, keyof LinkBaseProps | \"component\">;\n\n// The Tailwind preset makes the icon's own size and fill `!important`, so the stylesheet cannot\n// change them. These outrank them because the icon component sets its defaults inside `:where()`.\nconst ICON_CLASSES = \"h-4 w-4 fill-current\";\n\n// No \"use client\" here: a Server Component has to be able to pass a component such as Next's `Link`.\n// `LinkRegistration` is rendered rather than only imported, which puts its client reference into the\n// RSC payload, so the browser loads the stylesheet and registers the element.\nconst Link = <C extends ElementType = \"a\">({\n component = \"a\" as C,\n children,\n showArrow = false,\n arrowPosition = \"left\",\n small = false,\n hideUnderline = false,\n inverted,\n srLabel,\n ...props\n}: Props<C>) => {\n const Component: ElementType = component;\n const { type, ...nativeProps } = props as { type?: string };\n\n return (\n <bpds-link\n className=\"preflight\"\n small={small ? \"true\" : \"false\"}\n hide-underline={hideUnderline ? \"true\" : \"false\"}\n inverted={inverted ? \"true\" : \"false\"}\n >\n <Component\n {...nativeProps}\n type={component === \"button\" ? (type ?? \"button\") : type}\n data-bpds=\"link\"\n data-bpds-small={small}\n data-bpds-hide-underline={hideUnderline}\n data-bpds-arrow-position={arrowPosition}\n data-bpds-show-arrow={showArrow}\n data-bpds-inverted={inverted}\n >\n {showArrow && arrowPosition === \"left\" && <ArrowLeftIcon className={ICON_CLASSES} />}\n {srLabel && <span className=\"sr-only\">{srLabel}</span>}\n <span aria-hidden={srLabel ? \"true\" : undefined}>{children}</span>\n {showArrow && arrowPosition === \"right\" && <ArrowRightIcon className={ICON_CLASSES} />}\n </Component>\n <LinkRegistration />\n </bpds-link>\n );\n};\n\nLink.displayName = \"Link\";\n\nexport default Link;\n"],"mappings":";;;;;AAcA,IAAMC,IAAe,wBAKfC,KAAqC,EACzC,eAAY,KACZ,aACA,eAAY,IACZ,mBAAgB,QAChB,WAAQ,IACR,mBAAgB,IAChB,aACA,YACA,GAAGC,QACW;CACd,IAAMC,IAAyBC,GACzB,EAAE,SAAM,GAAGC,MAAgBH;CAEjC,OACE,kBAAC,aAAD;EACE,WAAU;EACV,OAAOI,IAAQ,SAAS;EACxB,kBAAgBC,IAAgB,SAAS;EACzC,UAAUC,IAAW,SAAS;EAJhC,UAAA,CAME,kBAACL,GAAD;GACE,GAAIE;GACJ,MAAMD,MAAc,WAAYK,KAAQ,WAAYA;GACpD,aAAU;GACV,mBAAiBH;GACjB,4BAA0BC;GAC1B,4BAA0BG;GAC1B,wBAAsBC;GACtB,sBAAoBH;GARtB,UAAA;IAUGG,KAAaD,MAAkB,UAAU,kBAACE,GAAD,EAAe,WAAWZ,EAAe,CAAA;IAClFa,KAAW,kBAAC,QAAD;KAAM,WAAU;KAAW,UAAAA;IAAc,CAAA;IACrD,kBAAC,QAAD;KAAM,eAAaA,IAAU,SAAS,KAAA;KAAY;IAAe,CAAA;IAChEF,KAAaD,MAAkB,WAAW,kBAACI,GAAD,EAAgB,WAAWd,EAAe,CAAA;GAC5E;EACX,CAAA,GAAA,kBAACD,GAAD,CAAmB,CAAA,CACV;;AAEf;AAEA,EAAK,cAAc"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "#styles";
|
|
3
|
+
//#region src/LinkRegistration.tsx
|
|
4
|
+
typeof window < "u" && import("@bonprix-ds/bpds-link").then(({ Link: e }) => {
|
|
5
|
+
customElements.get("bpds-link") || customElements.define("bpds-link", e);
|
|
6
|
+
});
|
|
7
|
+
var e = () => null;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { e as default };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=LinkRegistration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkRegistration.js","names":["LinkElement","LinkRegistration"],"sources":["../../src/LinkRegistration.tsx"],"sourcesContent":["\"use client\";\n\nimport \"@bonprix-ds/bpds-link/link.css\";\n\n// The element class is loaded lazily and only in the browser: `class X extends HTMLElement` is\n// evaluated at module scope, and `HTMLElement` does not exist in Node. The registry check sits inside\n// the callback because the tag can be taken during the await, and `define` throws on a duplicate name.\nif (typeof window !== \"undefined\") {\n void import(\"@bonprix-ds/bpds-link\").then(({ Link: LinkElement }) => {\n if (!customElements.get(\"bpds-link\")) customElements.define(\"bpds-link\", LinkElement);\n });\n}\n\nconst LinkRegistration = () => null;\n\nexport default LinkRegistration;\n"],"mappings":";;;AAOI,OAAO,SAAW,OACpB,OAAY,wBAAwB,CAAC,MAAM,EAAE,MAAMA,QAAkB;CACnE,AAAK,eAAe,IAAI,WAAW,KAAG,eAAe,OAAO,aAAaA,CAAW;AACtF,CAAC;AAGH,IAAMC,UAAyB"}
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@bonprix-ds/bpds-link/link.css";
|
package/package.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonprix-ds/react-wrapper-link",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Link component, implemented as a React wrapper around bpds-link, for the Bonprix Design System.",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"author": "",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/bonprix/design-system.git",
|
|
11
|
+
"directory": "packages/react-wrappers/link"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"!dist/tsconfig.tsbuildinfo",
|
|
16
|
+
"!dist/vite.config.d.ts",
|
|
17
|
+
"!dist/**/*.test.d.ts"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"**/*.css",
|
|
22
|
+
"./dist/styles.js"
|
|
23
|
+
],
|
|
24
|
+
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"imports": {
|
|
27
|
+
"#styles": {
|
|
28
|
+
"browser": "./dist/styles.js",
|
|
29
|
+
"default": "./dist/no-styles.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"import": "./dist/index.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"provenance": true
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@bonprix-ds/react-icon": "1.3.1",
|
|
45
|
+
"@bonprix-ds/react-link": "1.0.5",
|
|
46
|
+
"@bonprix-ds/bpds-link": "1.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/react": "19.3.0",
|
|
50
|
+
"vite": "8.3.3",
|
|
51
|
+
"@bonprix-ds/vite-config": "0.0.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": "^19",
|
|
55
|
+
"react-dom": "^19"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "vite build"
|
|
59
|
+
}
|
|
6
60
|
}
|
package/README.md
DELETED