@bonprix-ds/react-link-group 1.0.1 → 1.0.3

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.d.ts CHANGED
@@ -1,29 +1,2 @@
1
- import { ComponentProps } from 'react';
2
- import { default as default_2 } from 'react';
3
- import { ElementType } from 'react';
4
- import { ReactNode } from 'react';
5
-
6
- declare type ItemProps<C extends ElementType> = LinkGroupItemProps & {
7
- /** The semantic component to render the LinkGroup.Item. Preferrably `"a"` or something like `Link` from NextJS. Native props will be passed to this component. */
8
- component?: C;
9
- } & Omit<ComponentProps<C>, keyof LinkGroupItemProps | "component">;
10
-
11
- declare const LinkGroup: {
12
- ({ children }: LinkGroupProps): default_2.JSX.Element;
13
- Item: <C extends ElementType>({ children, current, component, ...props }: ItemProps<C>) => default_2.JSX.Element;
14
- };
15
- export default LinkGroup;
16
-
17
- export declare interface LinkGroupItemProps {
18
- /** The content of the link. */
19
- children: string;
20
- /** Whether the link is the current page. Will be used to set the `aria-current` attribute. */
21
- current?: boolean;
22
- }
23
-
24
- export declare interface LinkGroupProps {
25
- /** The content of the LinkGroup. Only put `LinkGroup.Item`s inside. */
26
- children: ReactNode;
27
- }
28
-
29
- export { }
1
+ export { default } from "./src/LinkGroup";
2
+ export type { BaseItemProps as LinkGroupItemProps, Props as LinkGroupProps } from "./src/LinkGroup";
package/dist/index.js CHANGED
@@ -1,46 +1,2 @@
1
- import { tabStyleContainerBase as e, tabStyleContainerVariant as t, tabStyleLabelClass as n, tabStyleLabelContainerBase as r, tabStyleLabelContainerVariant as i, tabStyleList as a } from "@bonprix-ds/internal-components";
2
- import "react";
3
- import { tv as o } from "tailwind-variants";
4
- import { jsx as s } from "react/jsx-runtime";
5
- //#region src/LinkGroup.tsx
6
- var c = o({ base: a }), l = ({ children: e }) => /* @__PURE__ */ s("nav", {
7
- "data-bpds": "link-group",
8
- className: "preflight",
9
- children: /* @__PURE__ */ s("ul", {
10
- className: c(),
11
- children: e
12
- })
13
- }), u = o({
14
- slots: {
15
- item: "flex",
16
- link: [e, t],
17
- linkLabel: [
18
- r,
19
- i,
20
- n
21
- ]
22
- },
23
- variants: { current: {
24
- true: { link: "after:border-b-4 after:h-1 after:border-current" },
25
- false: { link: "hover:after:border-b-2 hover:after:border-current" }
26
- } }
27
- });
28
- l.Item = ({ children: e, current: t = !1, component: n = "a", ...r }) => {
29
- let i = n, { link: a, item: o, linkLabel: c } = u({ current: t });
30
- return /* @__PURE__ */ s("li", {
31
- className: o(),
32
- children: /* @__PURE__ */ s(i, {
33
- className: a(),
34
- ...r,
35
- "aria-current": t ? "page" : void 0,
36
- children: /* @__PURE__ */ s("span", {
37
- className: c(),
38
- children: e
39
- })
40
- })
41
- });
42
- };
43
- //#endregion
44
- export { l as default };
45
-
46
- //# sourceMappingURL=index.js.map
1
+ import e from "./src/LinkGroup.js";
2
+ export { e as default };
@@ -0,0 +1,20 @@
1
+ import React, { ComponentProps, ElementType, ReactNode } from "react";
2
+ export interface Props {
3
+ /** The content of the LinkGroup. Only put `LinkGroup.Item`s inside. */
4
+ children: ReactNode;
5
+ }
6
+ declare const LinkGroup: {
7
+ ({ children }: Props): React.JSX.Element;
8
+ Item: <C extends ElementType>({ children, current, component, ...props }: ItemProps<C>) => React.JSX.Element;
9
+ };
10
+ export interface BaseItemProps {
11
+ /** The content of the link. */
12
+ children: string;
13
+ /** Whether the link is the current page. Will be used to set the `aria-current` attribute. */
14
+ current?: boolean;
15
+ }
16
+ type ItemProps<C extends ElementType> = BaseItemProps & {
17
+ /** The semantic component to render the LinkGroup.Item. Preferrably `"a"` or something like `Link` from NextJS. Native props will be passed to this component. */
18
+ component?: C;
19
+ } & Omit<ComponentProps<C>, keyof BaseItemProps | "component">;
20
+ export default LinkGroup;
@@ -0,0 +1,46 @@
1
+ import "react";
2
+ import { tv as e } from "tailwind-variants";
3
+ import { tabStyleContainerBase as t, tabStyleContainerVariant as n, tabStyleLabelClass as r, tabStyleLabelContainerBase as i, tabStyleLabelContainerVariant as a, tabStyleList as o } from "@bonprix-ds/internal-components";
4
+ import { jsx as s } from "react/jsx-runtime";
5
+ //#region src/LinkGroup.tsx
6
+ var c = e({ base: o }), l = ({ children: e }) => /* @__PURE__ */ s("nav", {
7
+ "data-bpds": "link-group",
8
+ className: "preflight",
9
+ children: /* @__PURE__ */ s("ul", {
10
+ className: c(),
11
+ children: e
12
+ })
13
+ }), u = e({
14
+ slots: {
15
+ item: "flex",
16
+ link: [t, n],
17
+ linkLabel: [
18
+ i,
19
+ a,
20
+ r
21
+ ]
22
+ },
23
+ variants: { current: {
24
+ true: { link: "after:h-1 after:border-b-4 after:border-current" },
25
+ false: { link: "hover:after:border-b-2 hover:after:border-current" }
26
+ } }
27
+ });
28
+ l.Item = ({ children: e, current: t = !1, component: n = "a", ...r }) => {
29
+ let i = n, { link: a, item: o, linkLabel: c } = u({ current: t });
30
+ return /* @__PURE__ */ s("li", {
31
+ className: o(),
32
+ children: /* @__PURE__ */ s(i, {
33
+ className: a(),
34
+ ...r,
35
+ "aria-current": t ? "page" : void 0,
36
+ children: /* @__PURE__ */ s("span", {
37
+ className: c(),
38
+ children: e
39
+ })
40
+ })
41
+ });
42
+ };
43
+ //#endregion
44
+ export { l as default };
45
+
46
+ //# sourceMappingURL=LinkGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkGroup.js","names":["generateListClasses","tv","tabStyleList","LinkGroup","generateLinkClasses","tabStyleContainerBase","tabStyleContainerVariant","tabStyleLabelContainerBase","tabStyleLabelContainerVariant","tabStyleLabelClass","props","Component","component","item","link","current","linkLabel"],"sources":["../../src/LinkGroup.tsx"],"sourcesContent":["import React, { ComponentProps, ElementType, ReactNode } from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport {\n tabStyleContainerBase,\n tabStyleContainerVariant,\n tabStyleLabelClass,\n tabStyleLabelContainerBase,\n tabStyleLabelContainerVariant,\n tabStyleList,\n} from \"@bonprix-ds/internal-components\";\n\nexport interface Props {\n /** The content of the LinkGroup. Only put `LinkGroup.Item`s inside. */\n children: ReactNode;\n}\n\nconst generateListClasses = tv({\n base: tabStyleList,\n});\n\nconst LinkGroup = ({ children }: Props) => {\n return (\n <nav data-bpds=\"link-group\" className=\"preflight\">\n <ul className={generateListClasses()}>{children}</ul>\n </nav>\n );\n};\n\n// The links in this component are used in a group on our page, so we exclude `rel` and `target` intentionally here.\nexport interface BaseItemProps {\n /** The content of the link. */\n children: string;\n /** Whether the link is the current page. Will be used to set the `aria-current` attribute. */\n current?: boolean;\n}\n\ntype ItemProps<C extends ElementType> = BaseItemProps & {\n /** The semantic component to render the LinkGroup.Item. Preferrably `\"a\"` or something like `Link` from NextJS. Native props will be passed to this component. */\n component?: C;\n} & Omit<ComponentProps<C>, keyof BaseItemProps | \"component\">;\n\nconst generateLinkClasses = tv({\n slots: {\n item: \"flex\",\n link: [tabStyleContainerBase, tabStyleContainerVariant],\n linkLabel: [tabStyleLabelContainerBase, tabStyleLabelContainerVariant, tabStyleLabelClass],\n },\n variants: {\n current: {\n true: {\n link: \"after:h-1 after:border-b-4 after:border-current\",\n },\n false: {\n link: \"hover:after:border-b-2 hover:after:border-current\",\n },\n },\n },\n});\n\nconst Item = <C extends ElementType>({ children, current = false, component = \"a\" as C, ...props }: ItemProps<C>) => {\n const Component: ElementType = component;\n const { link, item, linkLabel } = generateLinkClasses({ current });\n return (\n <li className={item()}>\n <Component className={link()} {...props} aria-current={current ? \"page\" : undefined}>\n <span className={linkLabel()}>{children}</span>\n </Component>\n </li>\n );\n};\n\nLinkGroup.Item = Item;\n\nexport default LinkGroup;\n"],"mappings":";;;;;AAiBA,IAAMA,IAAsBC,EAAG,EAC7B,MAAMC,EACR,CAAC,GAEKC,KAAa,EAAE,kBAEjB,kBAAC,OAAD;CAAK,aAAU;CAAa,WAAU;CACpC,UAAA,kBAAC,MAAD;EAAI,WAAWH,EAAoB;EAAI;CAAa,CAAA;AACjD,CAAA,GAiBHI,IAAsBH,EAAG;CAC7B,OAAO;EACL,MAAM;EACN,MAAM,CAACI,GAAuBC,CAAwB;EACtD,WAAW;GAACC;GAA4BC;GAA+BC;EAAkB;CAC3F;CACA,UAAU,EACR,SAAS;EACP,MAAM,EACJ,MAAM,kDACR;EACA,OAAO,EACL,MAAM,oDACR;CACF,EACF;AACF,CAAC;AAcD,EAAU,QAZ2B,EAAE,aAAU,aAAU,IAAO,eAAY,KAAU,GAAGC,QAA0B;CACnH,IAAMC,IAAyBC,GACzB,EAAE,SAAM,SAAM,iBAAcR,EAAoB,EAAE,WAAQ,CAAC;CACjE,OACE,kBAAC,MAAD;EAAI,WAAWS,EAAK;EAClB,UAAA,kBAACF,GAAD;GAAW,WAAWG,EAAK;GAAG,GAAIJ;GAAO,gBAAcK,IAAU,SAAS,KAAA;GACxE,UAAA,kBAAC,QAAD;IAAM,WAAWC,EAAU;IAAI;GAAe,CAAA;EACrC,CAAA;CACT,CAAA;AAER"}
package/package.json CHANGED
@@ -1,14 +1,25 @@
1
1
  {
2
2
  "name": "@bonprix-ds/react-link-group",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "LinkGroup component, implemented in React, for the Bonprix Design System.",
5
- "type": "module",
6
- "publishConfig": {
7
- "access": "public",
8
- "provenance": true
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/link-group"
9
12
  },
10
- "module": "./dist/index.js",
13
+ "files": [
14
+ "dist",
15
+ "!dist/tsconfig.tsbuildinfo",
16
+ "!dist/vite.config.d.ts",
17
+ "!dist/**/*.test.d.ts"
18
+ ],
19
+ "type": "module",
11
20
  "sideEffects": false,
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
12
23
  "exports": {
13
24
  ".": {
14
25
  "import": "./dist/index.js",
@@ -16,34 +27,23 @@
16
27
  "default": "./dist/index.js"
17
28
  }
18
29
  },
19
- "types": "./dist/index.d.ts",
20
- "files": [
21
- "dist"
22
- ],
23
- "keywords": [],
24
- "author": "",
25
- "license": "UNLICENSED",
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/bonprix/design-system.git",
29
- "directory": "packages/react/link-group"
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "provenance": true
30
33
  },
31
34
  "dependencies": {
32
- "@bonprix-ds/internal-components": "0.2.0"
35
+ "@bonprix-ds/internal-components": "0.2.2"
36
+ },
37
+ "devDependencies": {
38
+ "@types/react": "19.3.0",
39
+ "vite": "8.3.2",
40
+ "@bonprix-ds/vite-config": "0.0.0"
33
41
  },
34
42
  "peerDependencies": {
35
- "react": "^19.0.0",
36
- "react-dom": "^19.0.0",
43
+ "react": "^19",
44
+ "react-dom": "^19",
37
45
  "tailwind-variants": "0.3.1"
38
46
  },
39
- "devDependencies": {
40
- "vite": "8.2.2",
41
- "@types/react": "19.2.18",
42
- "@vitejs/plugin-react": "6.1.1",
43
- "rollup-preserve-directives": "1.1.3",
44
- "unplugin-dts": "1.1.0",
45
- "@microsoft/api-extractor": "7.59.1"
46
- },
47
47
  "scripts": {
48
48
  "build": "vite build"
49
49
  }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/LinkGroup.tsx"],"sourcesContent":["import {\n tabStyleContainerBase,\n tabStyleContainerVariant,\n tabStyleLabelClass,\n tabStyleLabelContainerBase,\n tabStyleLabelContainerVariant,\n tabStyleList,\n} from \"@bonprix-ds/internal-components\";\nimport React, { ComponentProps, ElementType, ReactNode } from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nexport interface Props {\n /** The content of the LinkGroup. Only put `LinkGroup.Item`s inside. */\n children: ReactNode;\n}\n\nconst generateListClasses = tv({\n base: tabStyleList,\n});\n\nconst LinkGroup = ({ children }: Props) => {\n return (\n <nav data-bpds=\"link-group\" className=\"preflight\">\n <ul className={generateListClasses()}>{children}</ul>\n </nav>\n );\n};\n\n// The links in this component are used in a group on our page, so we exclude `rel` and `target` intentionally here.\nexport interface BaseItemProps {\n /** The content of the link. */\n children: string;\n /** Whether the link is the current page. Will be used to set the `aria-current` attribute. */\n current?: boolean;\n}\n\ntype ItemProps<C extends ElementType> = BaseItemProps & {\n /** The semantic component to render the LinkGroup.Item. Preferrably `\"a\"` or something like `Link` from NextJS. Native props will be passed to this component. */\n component?: C;\n} & Omit<ComponentProps<C>, keyof BaseItemProps | \"component\">;\n\nconst generateLinkClasses = tv({\n slots: {\n item: \"flex\",\n link: [tabStyleContainerBase, tabStyleContainerVariant],\n linkLabel: [tabStyleLabelContainerBase, tabStyleLabelContainerVariant, tabStyleLabelClass],\n },\n variants: {\n current: {\n true: {\n link: \"after:border-b-4 after:h-1 after:border-current\",\n },\n false: {\n link: \"hover:after:border-b-2 hover:after:border-current\",\n },\n },\n },\n});\n\nconst Item = <C extends ElementType>({ children, current = false, component = \"a\" as C, ...props }: ItemProps<C>) => {\n const Component: ElementType = component;\n const { link, item, linkLabel } = generateLinkClasses({ current });\n return (\n <li className={item()}>\n <Component className={link()} {...props} aria-current={current ? \"page\" : undefined}>\n <span className={linkLabel()}>{children}</span>\n </Component>\n </li>\n );\n};\n\nLinkGroup.Item = Item;\n\nexport default LinkGroup;\n"],"mappings":";;;;;AAgBA,IAAM,IAAsB,EAAG,EAC7B,MAAM,EACR,CAAC,GAEK,KAAa,EAAE,kBAEjB,kBAAC,OAAD;CAAK,aAAU;CAAa,WAAU;CACpC,UAAA,kBAAC,MAAD;EAAI,WAAW,EAAoB;EAAI;CAAa,CAAA;AACjD,CAAA,GAiBH,IAAsB,EAAG;CAC7B,OAAO;EACL,MAAM;EACN,MAAM,CAAC,GAAuB,CAAwB;EACtD,WAAW;GAAC;GAA4B;GAA+B;EAAkB;CAC3F;CACA,UAAU,EACR,SAAS;EACP,MAAM,EACJ,MAAM,kDACR;EACA,OAAO,EACL,MAAM,oDACR;CACF,EACF;AACF,CAAC;AAcD,EAAU,QAZ2B,EAAE,aAAU,aAAU,IAAO,eAAY,KAAU,GAAG,QAA0B;CACnH,IAAM,IAAyB,GACzB,EAAE,SAAM,SAAM,iBAAc,EAAoB,EAAE,WAAQ,CAAC;CACjE,OACE,kBAAC,MAAD;EAAI,WAAW,EAAK;EAClB,UAAA,kBAAC,GAAD;GAAW,WAAW,EAAK;GAAG,GAAI;GAAO,gBAAc,IAAU,SAAS,KAAA;GACxE,UAAA,kBAAC,QAAD;IAAM,WAAW,EAAU;IAAI;GAAe,CAAA;EACrC,CAAA;CACT,CAAA;AAER"}