From f391ad76dd21f5ccd7b85ea57505f291ce64a008 Mon Sep 17 00:00:00 2001
From: Hunter Johnston <64506580+huntabyte@users.noreply.github.com>
Date: Mon, 11 Mar 2024 00:15:16 -0400
Subject: [PATCH] feat: Breadcrumb (#885)
---
apps/www/__registry__/index.js | 120 ++++++++++++++++++
apps/www/package.json | 2 +-
apps/www/src/content/changelog.md | 10 ++
apps/www/src/content/components/breadcrumb.md | 114 +++++++++++++++++
.../lib/components/docs/charts/metric.svelte | 2 +-
apps/www/src/lib/config/docs.ts | 6 +
.../default/example/breadcrumb-demo.svelte | 34 +++++
.../example/breadcrumb-dropdown.svelte | 36 ++++++
.../example/breadcrumb-ellipsis.svelte | 23 ++++
.../default/example/breadcrumb-link.svelte | 23 ++++
.../example/breadcrumb-responsive.svelte | 95 ++++++++++++++
.../example/breadcrumb-separator.svelte | 24 ++++
.../ui/breadcrumb/breadcrumb-ellipsis.svelte | 24 ++++
.../ui/breadcrumb/breadcrumb-item.svelte | 16 +++
.../ui/breadcrumb/breadcrumb-link.svelte | 31 +++++
.../ui/breadcrumb/breadcrumb-list.svelte | 23 ++++
.../ui/breadcrumb/breadcrumb-page.svelte | 23 ++++
.../ui/breadcrumb/breadcrumb-separator.svelte | 25 ++++
.../default/ui/breadcrumb/breadcrumb.svelte | 15 +++
.../registry/default/ui/breadcrumb/index.ts | 25 ++++
.../new-york/example/breadcrumb-demo.svelte | 34 +++++
.../example/breadcrumb-dropdown.svelte | 36 ++++++
.../example/breadcrumb-ellipsis.svelte | 23 ++++
.../new-york/example/breadcrumb-link.svelte | 23 ++++
.../example/breadcrumb-responsive.svelte | 95 ++++++++++++++
.../example/breadcrumb-separator.svelte | 24 ++++
.../ui/breadcrumb/breadcrumb-ellipsis.svelte | 24 ++++
.../ui/breadcrumb/breadcrumb-item.svelte | 16 +++
.../ui/breadcrumb/breadcrumb-link.svelte | 31 +++++
.../ui/breadcrumb/breadcrumb-list.svelte | 23 ++++
.../ui/breadcrumb/breadcrumb-page.svelte | 23 ++++
.../ui/breadcrumb/breadcrumb-separator.svelte | 25 ++++
.../new-york/ui/breadcrumb/breadcrumb.svelte | 15 +++
.../registry/new-york/ui/breadcrumb/index.ts | 25 ++++
apps/www/static/registry/index.json | 16 +++
.../styles/default-js/breadcrumb.json | 40 ++++++
.../registry/styles/default/breadcrumb.json | 40 ++++++
.../styles/new-york-js/breadcrumb.json | 40 ++++++
.../registry/styles/new-york/breadcrumb.json | 40 ++++++
pnpm-lock.yaml | 14 +-
40 files changed, 1269 insertions(+), 9 deletions(-)
create mode 100644 apps/www/src/content/components/breadcrumb.md
create mode 100644 apps/www/src/lib/registry/default/example/breadcrumb-demo.svelte
create mode 100644 apps/www/src/lib/registry/default/example/breadcrumb-dropdown.svelte
create mode 100644 apps/www/src/lib/registry/default/example/breadcrumb-ellipsis.svelte
create mode 100644 apps/www/src/lib/registry/default/example/breadcrumb-link.svelte
create mode 100644 apps/www/src/lib/registry/default/example/breadcrumb-responsive.svelte
create mode 100644 apps/www/src/lib/registry/default/example/breadcrumb-separator.svelte
create mode 100644 apps/www/src/lib/registry/default/ui/breadcrumb/breadcrumb-ellipsis.svelte
create mode 100644 apps/www/src/lib/registry/default/ui/breadcrumb/breadcrumb-item.svelte
create mode 100644 apps/www/src/lib/registry/default/ui/breadcrumb/breadcrumb-link.svelte
create mode 100644 apps/www/src/lib/registry/default/ui/breadcrumb/breadcrumb-list.svelte
create mode 100644 apps/www/src/lib/registry/default/ui/breadcrumb/breadcrumb-page.svelte
create mode 100644 apps/www/src/lib/registry/default/ui/breadcrumb/breadcrumb-separator.svelte
create mode 100644 apps/www/src/lib/registry/default/ui/breadcrumb/breadcrumb.svelte
create mode 100644 apps/www/src/lib/registry/default/ui/breadcrumb/index.ts
create mode 100644 apps/www/src/lib/registry/new-york/example/breadcrumb-demo.svelte
create mode 100644 apps/www/src/lib/registry/new-york/example/breadcrumb-dropdown.svelte
create mode 100644 apps/www/src/lib/registry/new-york/example/breadcrumb-ellipsis.svelte
create mode 100644 apps/www/src/lib/registry/new-york/example/breadcrumb-link.svelte
create mode 100644 apps/www/src/lib/registry/new-york/example/breadcrumb-responsive.svelte
create mode 100644 apps/www/src/lib/registry/new-york/example/breadcrumb-separator.svelte
create mode 100644 apps/www/src/lib/registry/new-york/ui/breadcrumb/breadcrumb-ellipsis.svelte
create mode 100644 apps/www/src/lib/registry/new-york/ui/breadcrumb/breadcrumb-item.svelte
create mode 100644 apps/www/src/lib/registry/new-york/ui/breadcrumb/breadcrumb-link.svelte
create mode 100644 apps/www/src/lib/registry/new-york/ui/breadcrumb/breadcrumb-list.svelte
create mode 100644 apps/www/src/lib/registry/new-york/ui/breadcrumb/breadcrumb-page.svelte
create mode 100644 apps/www/src/lib/registry/new-york/ui/breadcrumb/breadcrumb-separator.svelte
create mode 100644 apps/www/src/lib/registry/new-york/ui/breadcrumb/breadcrumb.svelte
create mode 100644 apps/www/src/lib/registry/new-york/ui/breadcrumb/index.ts
create mode 100644 apps/www/static/registry/styles/default-js/breadcrumb.json
create mode 100644 apps/www/static/registry/styles/default/breadcrumb.json
create mode 100644 apps/www/static/registry/styles/new-york-js/breadcrumb.json
create mode 100644 apps/www/static/registry/styles/new-york/breadcrumb.json
diff --git a/apps/www/__registry__/index.js b/apps/www/__registry__/index.js
index 02959d349..8002fce11 100644
--- a/apps/www/__registry__/index.js
+++ b/apps/www/__registry__/index.js
@@ -102,6 +102,66 @@ export const Index = {
),
files: ["../src/lib/registry/default/example/badge-secondary.svelte"],
},
+ "breadcrumb-demo": {
+ name: "breadcrumb-demo",
+ type: "components:example",
+ registryDependencies: ["breadcrumb", "dropdown-menu"],
+ component: () =>
+ import("../src/lib/registry/default/example/breadcrumb-demo.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/default/example/breadcrumb-demo.svelte"],
+ },
+ "breadcrumb-dropdown": {
+ name: "breadcrumb-dropdown",
+ type: "components:example",
+ registryDependencies: ["breadcrumb", "dropdown-menu"],
+ component: () =>
+ import("../src/lib/registry/default/example/breadcrumb-dropdown.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/default/example/breadcrumb-dropdown.svelte"],
+ },
+ "breadcrumb-ellipsis": {
+ name: "breadcrumb-ellipsis",
+ type: "components:example",
+ registryDependencies: ["breadcrumb"],
+ component: () =>
+ import("../src/lib/registry/default/example/breadcrumb-ellipsis.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/default/example/breadcrumb-ellipsis.svelte"],
+ },
+ "breadcrumb-link": {
+ name: "breadcrumb-link",
+ type: "components:example",
+ registryDependencies: ["breadcrumb"],
+ component: () =>
+ import("../src/lib/registry/default/example/breadcrumb-link.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/default/example/breadcrumb-link.svelte"],
+ },
+ "breadcrumb-responsive": {
+ name: "breadcrumb-responsive",
+ type: "components:example",
+ registryDependencies: ["breadcrumb", "drawer", "dropdown-menu", "button"],
+ component: () =>
+ import("../src/lib/registry/default/example/breadcrumb-responsive.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/default/example/breadcrumb-responsive.svelte"],
+ },
+ "breadcrumb-separator": {
+ name: "breadcrumb-separator",
+ type: "components:example",
+ registryDependencies: ["breadcrumb"],
+ component: () =>
+ import("../src/lib/registry/default/example/breadcrumb-separator.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/default/example/breadcrumb-separator.svelte"],
+ },
"button-demo": {
name: "button-demo",
type: "components:example",
@@ -1324,6 +1384,66 @@ export const Index = {
),
files: ["../src/lib/registry/new-york/example/badge-secondary.svelte"],
},
+ "breadcrumb-demo": {
+ name: "breadcrumb-demo",
+ type: "components:example",
+ registryDependencies: ["breadcrumb", "dropdown-menu"],
+ component: () =>
+ import("../src/lib/registry/new-york/example/breadcrumb-demo.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/new-york/example/breadcrumb-demo.svelte"],
+ },
+ "breadcrumb-dropdown": {
+ name: "breadcrumb-dropdown",
+ type: "components:example",
+ registryDependencies: ["breadcrumb", "dropdown-menu"],
+ component: () =>
+ import("../src/lib/registry/new-york/example/breadcrumb-dropdown.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/new-york/example/breadcrumb-dropdown.svelte"],
+ },
+ "breadcrumb-ellipsis": {
+ name: "breadcrumb-ellipsis",
+ type: "components:example",
+ registryDependencies: ["breadcrumb"],
+ component: () =>
+ import("../src/lib/registry/new-york/example/breadcrumb-ellipsis.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/new-york/example/breadcrumb-ellipsis.svelte"],
+ },
+ "breadcrumb-link": {
+ name: "breadcrumb-link",
+ type: "components:example",
+ registryDependencies: ["breadcrumb"],
+ component: () =>
+ import("../src/lib/registry/new-york/example/breadcrumb-link.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/new-york/example/breadcrumb-link.svelte"],
+ },
+ "breadcrumb-responsive": {
+ name: "breadcrumb-responsive",
+ type: "components:example",
+ registryDependencies: ["breadcrumb", "drawer", "dropdown-menu", "button"],
+ component: () =>
+ import("../src/lib/registry/new-york/example/breadcrumb-responsive.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/new-york/example/breadcrumb-responsive.svelte"],
+ },
+ "breadcrumb-separator": {
+ name: "breadcrumb-separator",
+ type: "components:example",
+ registryDependencies: ["breadcrumb"],
+ component: () =>
+ import("../src/lib/registry/new-york/example/breadcrumb-separator.svelte").then(
+ (m) => m.default
+ ),
+ files: ["../src/lib/registry/new-york/example/breadcrumb-separator.svelte"],
+ },
"button-demo": {
name: "button-demo",
type: "components:example",
diff --git a/apps/www/package.json b/apps/www/package.json
index 92876ea86..054723300 100644
--- a/apps/www/package.json
+++ b/apps/www/package.json
@@ -79,7 +79,7 @@
"@internationalized/date": "^3.5.2",
"@unovis/svelte": "1.3.6-beta.1",
"@unovis/ts": "1.3.6-beta.1",
- "bits-ui": "0.19.3",
+ "bits-ui": "0.19.6",
"clsx": "^2.1.0",
"cmdk-sv": "^0.0.15",
"d3-scale": "^4.0.2",
diff --git a/apps/www/src/content/changelog.md b/apps/www/src/content/changelog.md
index 0e71ff16f..673e05b5e 100644
--- a/apps/www/src/content/changelog.md
+++ b/apps/www/src/content/changelog.md
@@ -9,6 +9,16 @@ description: Latest updates and announcements.
## March 2024
+### New Component: Breadcrumb
+
+We've added a new component to the project, [Breadcrumb](/docs/components/breadcrumb).
+
+
+
+
+
+
+
### New Component: Scroll Area
We've added a new component to the project, [Scroll Area](/docs/components/scroll-area), which is built on top of the [Scroll Area](https://bits-ui.com/docs/components/scroll-area) component from Bits UI.
diff --git a/apps/www/src/content/components/breadcrumb.md b/apps/www/src/content/components/breadcrumb.md
new file mode 100644
index 000000000..12dba7a59
--- /dev/null
+++ b/apps/www/src/content/components/breadcrumb.md
@@ -0,0 +1,114 @@
+---
+title: Breadcrumb
+description: Displays the path to the current resource using a hierarchy of links.
+component: true
+source: https://github.com/huntabyte/shadcn-svelte/tree/main/apps/www/src/lib/registry/default/ui/breadcrumb
+---
+
+
+
+
+
+
+
+
+
+## Installation
+
+```bash
+npx shadcn-svelte@latest add breadcrumb
+```
+
+
+
+1. Copy and paste the component source files linked at the top of this page into your project.
+
+
+
+## Usage
+
+```svelte
+
+
+
+
+
+ Home
+
+
+
+ Components
+
+
+
+ Breadcrumb
+
+
+
+```
+
+## Examples
+
+### Custom separator
+
+Use a custom component in the `` of `` to create a custom separator.
+
+
+
+
+
+
+
+---
+
+### Dropdown
+
+You can compose `` with a `` to create a dropdown in the breadcrumb.
+
+
+
+
+
+
+
+---
+
+### Collapsed
+
+We provide a `` component to show a collapsed state when the breadcrumb is too long.
+
+
+
+
+
+
+
+---
+
+### Link component
+
+To use a custom link component from your routing library, you can use the `asChild` prop on ``.
+
+
+
+
+
+
+
+---
+
+### Responsive
+
+Here's an example of a responsive breadcrumb that composes `` with ``, ``, and ``.
+
+It displays a dropdown on desktop and a drawer on mobile.
+
+
+
+
+
+
diff --git a/apps/www/src/lib/components/docs/charts/metric.svelte b/apps/www/src/lib/components/docs/charts/metric.svelte
index 7cb45c52e..f34c42f2b 100644
--- a/apps/www/src/lib/components/docs/charts/metric.svelte
+++ b/apps/www/src/lib/components/docs/charts/metric.svelte
@@ -43,7 +43,7 @@
-