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

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
@@ -3,17 +3,10 @@ import { default as default_2 } from 'react';
3
3
  import { ElementType } from 'react';
4
4
  import { ReactNode } from 'react';
5
5
 
6
- declare interface BaseItemProps {
7
- /** The content of the link. */
8
- children: string;
9
- /** Whether the link is the current page. Will be used to set the `aria-current` attribute. */
10
- current?: boolean;
11
- }
12
-
13
- declare type ItemProps<C extends ElementType> = BaseItemProps & {
6
+ declare type ItemProps<C extends ElementType> = LinkGroupItemProps & {
14
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. */
15
8
  component?: C;
16
- } & Omit<ComponentProps<C>, keyof BaseItemProps | "component">;
9
+ } & Omit<ComponentProps<C>, keyof LinkGroupItemProps | "component">;
17
10
 
18
11
  declare const LinkGroup: {
19
12
  ({ children }: LinkGroupProps): default_2.JSX.Element;
@@ -21,6 +14,13 @@ declare const LinkGroup: {
21
14
  };
22
15
  export default LinkGroup;
23
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
24
  export declare interface LinkGroupProps {
25
25
  /** The content of the LinkGroup. Only put `LinkGroup.Item`s inside. */
26
26
  children: ReactNode;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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.\ninterface 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"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonprix-ds/react-link-group",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "LinkGroup component, implemented in React, for the Bonprix Design System.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -29,7 +29,7 @@
29
29
  "directory": "packages/react/link-group"
30
30
  },
31
31
  "dependencies": {
32
- "@bonprix-ds/internal-components": "0.1.5"
32
+ "@bonprix-ds/internal-components": "0.2.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "^19.0.0",
@@ -41,8 +41,8 @@
41
41
  "@types/react": "19.2.18",
42
42
  "@vitejs/plugin-react": "6.1.1",
43
43
  "rollup-preserve-directives": "1.1.3",
44
- "unplugin-dts": "1.0.3",
45
- "@microsoft/api-extractor": "7.59.0"
44
+ "unplugin-dts": "1.1.0",
45
+ "@microsoft/api-extractor": "7.59.1"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "vite build"