@purpurds/breadcrumbs 5.11.0 → 5.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpurds/breadcrumbs",
3
- "version": "5.11.0",
3
+ "version": "5.11.1",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "./dist/breadcrumbs.cjs.js",
6
6
  "types": "./dist/breadcrumbs.d.ts",
@@ -15,30 +15,30 @@
15
15
  "source": "src/breadcrumbs.tsx",
16
16
  "dependencies": {
17
17
  "classnames": "~2.5.0",
18
- "@purpurds/tokens": "5.11.0",
19
- "@purpurds/icon": "5.11.0"
18
+ "@purpurds/tokens": "5.11.1",
19
+ "@purpurds/icon": "5.11.1"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@rushstack/eslint-patch": "~1.10.0",
23
- "@storybook/blocks": "~7.6.0",
24
- "@storybook/react": "~7.6.0",
23
+ "@storybook/react": "^8.2.6",
24
+ "storybook": "^8.2.6",
25
25
  "@telia/base-rig": "~8.2.0",
26
26
  "@telia/react-rig": "~3.2.0",
27
27
  "@testing-library/dom": "~9.3.3",
28
28
  "@testing-library/jest-dom": "~6.4.0",
29
29
  "@testing-library/react": "~14.3.0",
30
30
  "@types/node": "20.12.12",
31
- "@types/react-dom": "~18.3.0",
32
- "@types/react": "~18.3.0",
31
+ "@types/react-dom": "^18.3.0",
32
+ "@types/react": "^18.3.3",
33
33
  "eslint-plugin-testing-library": "~6.2.0",
34
- "eslint": "~8.57.0",
34
+ "eslint": "^8.57.0",
35
35
  "jsdom": "~22.1.0",
36
36
  "lint-staged": "~10.5.3",
37
37
  "prettier": "~2.8.8",
38
- "react-dom": "~18.3.0",
39
- "react": "~18.3.0",
40
- "typescript": "~5.4.2",
41
- "vite": "~5.2.2",
38
+ "react-dom": "^18.3.1",
39
+ "react": "^18.3.1",
40
+ "typescript": "^5.5.4",
41
+ "vite": "5.3.4",
42
42
  "vitest": "~1.5.0",
43
43
  "@purpurds/component-rig": "1.0.0"
44
44
  },
@@ -2,11 +2,14 @@ import React, { ReactElement, ReactNode, useEffect, useState } from "react";
2
2
  import type { Meta, StoryObj } from "@storybook/react";
3
3
 
4
4
  import "@purpurds/icon/styles";
5
- import { Breadcrumbs, BreadcrumbsItemProps } from "./breadcrumbs";
5
+ import { Breadcrumbs, BreadcrumbsItem, BreadcrumbsItemProps } from "./breadcrumbs";
6
6
 
7
- const meta: Meta<typeof Breadcrumbs> = {
7
+ const meta = {
8
8
  title: "Components/Breadcrumbs",
9
9
  component: Breadcrumbs,
10
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
11
+ //@ts-ignore
12
+ subcomponents: { "Breadcrumbs.Item": BreadcrumbsItem },
10
13
  parameters: {
11
14
  design: [
12
15
  {
@@ -15,9 +18,35 @@ const meta: Meta<typeof Breadcrumbs> = {
15
18
  url: "https://www.figma.com/file/XEaIIFskrrxIBHMZDkIuIg/Purpur-DS---Component-library-%26-guidelines?node-id=27132%3A14635&mode=dev",
16
19
  },
17
20
  ],
21
+ docs: {
22
+ description: {
23
+ component: `When a website has a lot of pages, breadcrumbs can help a user find their current location within the overal hierarchy. This page shows how you can make breadcrumbs accessible to all users. Use them when you have several levels of navigation and want to make the parent pages available as navigation.
24
+
25
+ Accessibility
26
+ The Purpur breadcrumbs are accessible by default according to best practices. The last BreadcrumbsItem is the one belonging to the page the user is currently on.
27
+
28
+
29
+ Meta Data & SEO
30
+ Another benefit of helping the user find their way, is that we also help the search engines increasing understanding of our site.
31
+
32
+ By default, the breadcrumbs will render a JSON+LD [script tag](https://purpur.telia.io/iframe.html?path=/story/components-breadcrumbs--breadcrumb-meta-data) with [structured meta data](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb#json-ld) extracted from the breadcrumb items.
33
+
34
+ Custom Link Component
35
+ If you need a custom link, perhaps to use a router, like the next/link component, you can simply pass your custom link component and skip the href property on Breadcrumbs.Item, only passing it directly to Link.`,
36
+ },
37
+ },
38
+ },
39
+ argTypes: {
40
+ children: {
41
+ table: {
42
+ type: {
43
+ summary: "ReactNode | ReactNode[]",
44
+ },
45
+ },
46
+ },
18
47
  },
19
48
  args: { negative: false },
20
- };
49
+ } satisfies Meta<typeof Breadcrumbs>;
21
50
 
22
51
  export default meta;
23
52
 
@@ -97,8 +126,7 @@ const Renderer =
97
126
  </>
98
127
  );
99
128
 
100
- export const DefaultVariant: Story = {
101
- name: "Default variant",
129
+ export const Showcase: Story = {
102
130
  args: {
103
131
  meta: true,
104
132
  children: [
@@ -116,25 +144,6 @@ export const DefaultVariant: Story = {
116
144
  render: Renderer(false),
117
145
  };
118
146
 
119
- export const NegativeVariant: Story = {
120
- name: "Negative variant",
121
- args: {
122
- negative: true,
123
- children: [
124
- <Breadcrumbs.Item href="/galaxies" key={0}>
125
- Galaxies
126
- </Breadcrumbs.Item>,
127
- <Breadcrumbs.Item href="/outer-rim" key={1}>
128
- Outer Rim
129
- </Breadcrumbs.Item>,
130
- <Breadcrumbs.Item href="/mandalore" key={2}>
131
- Mandalore
132
- </Breadcrumbs.Item>,
133
- ],
134
- },
135
- render: Renderer(false),
136
- };
137
-
138
147
  export const CustomItem: Story = {
139
148
  name: "Custom Breadcrumb Items",
140
149
  args: {
@@ -162,4 +162,4 @@ const Item = ({
162
162
 
163
163
  Breadcrumbs.Item = Item;
164
164
 
165
- export { Breadcrumbs };
165
+ export { Breadcrumbs, Item as BreadcrumbsItem };
package/readme.mdx DELETED
@@ -1,91 +0,0 @@
1
- import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";
2
-
3
- import * as BreadcrumbsStories from "./src/breadcrumbs.stories";
4
- import packageInfo from "./package.json";
5
-
6
- <Meta name="Docs" title="Components/Breadcrumbs" of={BreadcrumbsStories} />
7
-
8
- # Breadcrumbs
9
-
10
- <Subtitle>Version {packageInfo.version}</Subtitle>
11
-
12
- When a website has a lot of pages, breadcrumbs can help a user find their current location within the overal hierarchy. This page shows how you can make breadcrumbs accessible to all users.
13
-
14
- Use them when you have several levels of navigation and want to make the parent pages available as navigation.
15
-
16
- ### Accessibility
17
-
18
- The Purpur breadcrumbs are accessible by default according to best practices. The last BreadcrumbsItem is the one belonging to the page the user is currently on.
19
-
20
- ### Meta Data & SEO
21
-
22
- Another benefit of helping the user find their way, is that we also help the search engines increasing understanding of our site.
23
-
24
- By default, the breadcrumbs will render a [`JSON+LD` script tag](?path=/story/components-breadcrumbs--breadcrumb-meta-data) with [structured meta data](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb#json-ld) extracted from the breadcrumb items.
25
-
26
- ### Custom Link Component
27
-
28
- If you need a [custom link](#custom-link), perhaps to use a router, like the `next/link` component, you can simply [pass your custom link](#custom-link) component and skip the `href` property on Breadcrumbs.Item, only passing it directly to `<Link />`.
29
-
30
- ### Showcase
31
-
32
- <Primary />
33
-
34
- ### Properties
35
-
36
- <ArgTypes />
37
-
38
- ### Installation
39
-
40
- #### Via NPM
41
-
42
- Add the dependency to your consumer app like `"@purpurds/purpur": "^x.y.z"`
43
-
44
- In MyApp.tsx
45
-
46
- ```tsx
47
- import "@purpurds/purpur/styles";
48
- ```
49
-
50
- In MyComponent.tsx
51
-
52
- ```tsx
53
- import { Breadcrumbs } from "@purpurds/purpur";
54
-
55
- export const MyComponent = () => {
56
- return (
57
- <Breadcrumbs>
58
- <Breadcrumbs.Item href="/ships" onClick={() => console.log("clicking on ships")}>
59
- Ships
60
- </Breadcrumbs.Item>
61
- <Breadcrumbs.Item href="/ships/twin-seaters/">Twin Seaters</Breadcrumbs.Item>
62
- <Breadcrumbs.Item href="/ships/twin-seaters/naboo-n1">N1 Starfighter</Breadcrumbs.Item>
63
- </Breadcrumbs>
64
- );
65
- };
66
- ```
67
-
68
- ### Custom Link
69
-
70
- With a custom link component such as `next/link`:
71
-
72
- ```tsx
73
- import { Breadcrumbs } from "@purpurds/breadcrumbs";
74
- import Link from "next/link";
75
-
76
- export const MyComponent = () => {
77
- return (
78
- <Breadcrumbs>
79
- <Breadcrumbs.Item>
80
- <Link href="/ships">Ships</Link>
81
- </Breadcrumbs.Item>
82
- <Breadcrumbs.Item>
83
- <Link href="/ships/twin-seaters">Twin Seaters</Link>
84
- </Breadcrumbs.Item>
85
- <Breadcrumbs.Item>
86
- <Link href="/ships/twin-seaters/naboo-n1">N1 Starfighter</Link>
87
- </Breadcrumbs.Item>
88
- </Breadcrumbs>
89
- );
90
- };
91
- ```