@huin-core/react-breadcrumb 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # `react-breadcrumb`
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ $ yarn add @huin-core/react-breadcrumb
7
+ # or
8
+ $ npm install @huin-core/react-breadcrumb
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ View docs [here](https://huinhub.com/primitives/docs/components/breadcrumb).
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@huin-core/react-breadcrumb",
3
+ "version": "1.0.1",
4
+ "license": "MIT",
5
+ "exports": {
6
+ ".": {
7
+ "import": {
8
+ "types": "./dist/index.d.mts",
9
+ "default": "./dist/index.mjs"
10
+ },
11
+ "require": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ }
16
+ },
17
+ "source": "./src/index.ts",
18
+ "main": "./dist/index.js",
19
+ "module": "./dist/index.mjs",
20
+ "types": "./dist/index.d.ts",
21
+ "files": [
22
+ "src",
23
+ "dist"
24
+ ],
25
+ "sideEffects": false,
26
+ "scripts": {
27
+ "clean": "rm -rf dist",
28
+ "version": "yarn version"
29
+ },
30
+ "dependencies": {
31
+ "@huin-core/primitive": "workspace:*",
32
+ "@huin-core/react-compose-refs": "workspace:*",
33
+ "@huin-core/react-context": "workspace:*",
34
+ "@huin-core/react-primitive": "workspace:*",
35
+ "@huin-core/react-slot": "workspace:*"
36
+ },
37
+ "peerDependencies": {
38
+ "@types/react": "*",
39
+ "@types/react-dom": "*",
40
+ "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
41
+ "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "@types/react": {
45
+ "optional": true
46
+ },
47
+ "@types/react-dom": {
48
+ "optional": true
49
+ }
50
+ },
51
+ "homepage": "https://huinhub.com/primitives",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/firatorhan/huin-core.git"
55
+ },
56
+ "bugs": {
57
+ "url": "https://github.com/firatorhan/huin-core/issues"
58
+ }
59
+ }
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ import { Primitive } from "@huin-core/react-primitive";
3
+
4
+ /* -------------------------------------------------------------------------------------------------
5
+ * Breadcrumb
6
+ * -----------------------------------------------------------------------------------------------*/
7
+
8
+ const ROOT_NAME = "Breadcrumb";
9
+ const Breadcrumb = React.forwardRef<
10
+ HTMLElement,
11
+ React.ComponentPropsWithoutRef<"nav"> & {
12
+ separator?: React.ReactNode;
13
+ }
14
+ >(({ ...props }, ref) => (
15
+ <Primitive.nav ref={ref} aria-label="breadcrumb" {...props} />
16
+ ));
17
+ Breadcrumb.displayName = ROOT_NAME;
18
+
19
+ export { Breadcrumb };
@@ -0,0 +1,20 @@
1
+ import { Primitive } from "@huin-core/react-primitive";
2
+ import React from "react";
3
+
4
+ const ELLIPSISNAME = "BreadcrumbElipssis";
5
+ const BreadcrumbEllipsis = React.forwardRef<
6
+ HTMLSpanElement,
7
+ React.ComponentPropsWithoutRef<typeof Primitive.span>
8
+ >(({ className, ...props }, ref) => (
9
+ <Primitive.span
10
+ role="presentation"
11
+ aria-hidden="true"
12
+ {...props}
13
+ />
14
+
15
+
16
+ ));
17
+
18
+ BreadcrumbEllipsis.displayName = ELLIPSISNAME;
19
+
20
+ export { BreadcrumbEllipsis };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { Primitive } from "@huin-core/react-primitive";
3
+
4
+ const ITEM_NAME = "BreadcrumbItem";
5
+ const BreadcrumbItem = React.forwardRef<
6
+ HTMLLIElement,
7
+ React.ComponentPropsWithoutRef<"li">
8
+ >(({ ...props }, ref) => <Primitive.li ref={ref} {...props} />);
9
+ BreadcrumbItem.displayName = ITEM_NAME;
10
+
11
+ export { BreadcrumbItem };
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { Slot } from "@huin-core/react-slot";
3
+ import { Primitive } from "@huin-core/react-primitive";
4
+
5
+ const LINK_NAME = "BreadcrumbLink";
6
+ const BreadcrumbLink = React.forwardRef<
7
+ HTMLAnchorElement,
8
+ React.ComponentPropsWithoutRef<typeof Primitive.a> & {
9
+ asChild?: boolean;
10
+ }
11
+ >(({ asChild, ...props }, ref) => {
12
+ const Comp = asChild ? Slot : Primitive.a;
13
+
14
+ return <Comp ref={ref} {...props} />;
15
+ });
16
+ BreadcrumbLink.displayName = LINK_NAME;
17
+
18
+ export { BreadcrumbLink };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { Primitive } from "@huin-core/react-primitive";
3
+
4
+ const LIST_NAME = "BreadcrumbList";
5
+ const BreadcrumbList = React.forwardRef<
6
+ HTMLOListElement,
7
+ React.ComponentPropsWithoutRef<"ol">
8
+ >(({ ...props }, ref) => <Primitive.ol ref={ref} {...props} />);
9
+ BreadcrumbList.displayName = LIST_NAME;
10
+
11
+ export { BreadcrumbList };
@@ -0,0 +1,19 @@
1
+ import { Primitive } from "@huin-core/react-primitive";
2
+ import React from "react";
3
+
4
+ const PAGE_NAME = "BreadcrumbPage";
5
+ const BreadcrumbPage = React.forwardRef<
6
+ HTMLSpanElement,
7
+ React.ComponentPropsWithoutRef<typeof Primitive.span>
8
+ >(({ ...props }, ref) => (
9
+ <Primitive.span
10
+ ref={ref}
11
+ role="link"
12
+ aria-disabled="true"
13
+ aria-current="page"
14
+ {...props}
15
+ />
16
+ ));
17
+ BreadcrumbPage.displayName = PAGE_NAME;
18
+
19
+ export { BreadcrumbPage };
@@ -0,0 +1,14 @@
1
+ import { Primitive } from "@huin-core/react-primitive";
2
+ import React from "react";
3
+
4
+ const SEPARATOR_NAME = "BreadcrumbSeparator";
5
+ const BreadcrumbSeparator = React.forwardRef<
6
+ HTMLLIElement,
7
+ React.ComponentPropsWithoutRef<typeof Primitive.li>
8
+ >(({ children, ...props }, ref) => (
9
+ <Primitive.li role="presentation" ref={ref} aria-hidden="true" {...props} />
10
+ ));
11
+
12
+ BreadcrumbSeparator.displayName = SEPARATOR_NAME;
13
+
14
+ export { BreadcrumbSeparator };
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ export { Breadcrumb } from "./Breadcrumb";
3
+ export { BreadcrumbList } from "./BreadcrumbList";
4
+ export { BreadcrumbItem } from "./BreadcrumbItem";
5
+ export { BreadcrumbLink } from "./BreadcrumbLink";
6
+ export { BreadcrumbPage } from "./BreadcrumbPage";
7
+ export { BreadcrumbSeparator } from "./BreadcrumbSeparator";
8
+ export { BreadcrumbEllipsis } from "./BreadcrumbEllipsis";
9
+
10
+ export type {} from "./Breadcrumb";