@phila/phila-ui-breadcrumbs 0.0.3 → 0.1.0-beta.2

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/README.md CHANGED
@@ -1,11 +1,14 @@
1
1
  # Breadcrumbs Component
2
2
 
3
- A simple, customizable Vue 3. Breadcrumbs component built with TypeScript and Vite.
4
- A breadcrumb component for Phila UI
3
+ A responsive breadcrumb navigation component for Phila UI built with Vue 3 and TypeScript. Features automatic mobile optimization and accessibility support.
5
4
 
6
5
  ## Features
7
6
 
8
7
  - 🎯 TypeScript support with full type definitions
8
+ - 📱 Responsive design with mobile-specific navigation
9
+ - ♿ Full accessibility support with ARIA labels
10
+ - 🏠 Built-in home icon link
11
+ - 🔗 Flexible link structure
9
12
 
10
13
  ## Installation
11
14
 
@@ -22,27 +25,66 @@ pnpm add @phila/phila-ui-breadcrumbs
22
25
  ```vue
23
26
  <script setup lang="ts">
24
27
  import { Breadcrumbs } from "@phila/phila-ui-breadcrumbs";
28
+
29
+ const breadcrumbItems = [
30
+ { label: "Services", href: "/services" },
31
+ { label: "Cars, parking & transportation", href: "/transportation" },
32
+ { label: "Apply for a parking permit", href: "/parking-permit" },
33
+ ];
25
34
  </script>
26
- <template>...Add basic component template here...</template>
35
+
36
+ <template>
37
+ <Breadcrumbs :items="breadcrumbItems" />
38
+ </template>
27
39
  ```
28
40
 
29
41
  ## Props
30
42
 
31
- | Prop | Type | Default | Description |
32
- | ---- | ---- | ------- | ----------- |
43
+ ### Breadcrumbs
33
44
 
34
- | ...Add props here...
45
+ | Prop | Type | Default | Description |
46
+ | ----------- | ------------------ | ------- | ------------------------------------ |
47
+ | `items` | `BreadcrumbItem[]` | `[]` | Array of breadcrumb items to display |
48
+ | `className` | `string` | `""` | Additional CSS classes to apply |
49
+ | `homeHref` | `string` | `"/"` | URL for the home icon link |
35
50
 
36
- ## Events
51
+ ### BreadcrumbItem Interface
52
+
53
+ ```typescript
54
+ interface BreadcrumbItem {
55
+ label: string; // Display text for the breadcrumb
56
+ href?: string; // Optional URL (last item is treated as current page)
57
+ }
58
+ ```
37
59
 
38
- | Event | Payload | Description |
39
- | ----- | ------- | ----------- |
60
+ ## Events
40
61
 
41
- | ...Add events here...
62
+ This component does not emit custom events. Navigation is handled through standard anchor tag clicks.
42
63
 
43
64
  ## Examples
44
65
 
45
- ...Add examples here...
66
+ ### Basic Usage
67
+
68
+ ```vue
69
+ <Breadcrumbs :items="[{ label: 'Services', href: '/services' }, { label: 'Current Page' }]" />
70
+ ```
71
+
72
+ ### Custom Home Link
73
+
74
+ ```vue
75
+ <Breadcrumbs :items="breadcrumbItems" home-href="/dashboard" />
76
+ ```
77
+
78
+ ### With Custom Classes
79
+
80
+ ```vue
81
+ <Breadcrumbs :items="breadcrumbItems" class-name="my-custom-breadcrumbs" />
82
+ ```
83
+
84
+ ## Responsive Behavior
85
+
86
+ - **Desktop**: Shows full breadcrumb trail with home icon and all items
87
+ - **Mobile (≤768px)**: Shows only a "back" link to the parent page with left arrow icon
46
88
 
47
89
  ## Development
48
90
 
@@ -0,0 +1,7 @@
1
+ import { BreadcrumbLinkProps } from './index';
2
+ declare const _default: import('vue').DefineComponent<BreadcrumbLinkProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BreadcrumbLinkProps> & Readonly<{}>, {
3
+ isMobile: boolean;
4
+ isCurrentPage: boolean;
5
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
6
+ export default _default;
7
+ //# sourceMappingURL=BreadcrumbLink.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreadcrumbLink.vue.d.ts","sourceRoot":"","sources":["../src/BreadcrumbLink.vue"],"names":[],"mappings":"AAOA;AAoBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;;;;;AA2EnD,wBAOG"}
@@ -1,4 +1,8 @@
1
- import { BreadcrumbsProps } from './index';
2
- declare const _default: import('vue').DefineComponent<BreadcrumbsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BreadcrumbsProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLSpanElement>;
1
+ import { BreadcrumbsProps, BreadcrumbItem } from './index';
2
+ declare const _default: import('vue').DefineComponent<BreadcrumbsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BreadcrumbsProps> & Readonly<{}>, {
3
+ items: BreadcrumbItem[];
4
+ className: string;
5
+ homeHref: string;
6
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
3
7
  export default _default;
4
8
  //# sourceMappingURL=Breadcrumbs.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.vue.d.ts","sourceRoot":"","sources":["../src/Breadcrumbs.vue"],"names":[],"mappings":"AAGA;AAgCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;;AA+DhD,wBASG"}
1
+ {"version":3,"file":"Breadcrumbs.vue.d.ts","sourceRoot":"","sources":["../src/Breadcrumbs.vue"],"names":[],"mappings":"AAwBA;AAgGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;;;;;;AAiIrE,wBAQG"}
package/dist/index.css CHANGED
@@ -0,0 +1 @@
1
+ nav[data-v-64268cf1]{padding:var(--spacing-s)}ul[data-v-64268cf1]{list-style:none;display:flex;flex-wrap:wrap;padding:0;margin:0}li[data-v-64268cf1]{align-items:center;white-space:nowrap;display:flex}li[data-v-64268cf1]:not(:last-child):after{content:"/";margin:0 var(--spacing-s) 0 var(--spacing-m)}.breadcrumb-mobile[data-v-64268cf1]{display:none}@media(max-width:768px){ul[data-v-64268cf1]{display:none}.breadcrumb-mobile[data-v-64268cf1]{display:block}}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,17 @@
1
1
  import { BaseProps } from '@phila/phila-ui-core';
2
2
  export { default as Breadcrumbs } from './Breadcrumbs.vue';
3
+ export interface BreadcrumbItem {
4
+ label: string;
5
+ href?: string;
6
+ }
3
7
  export interface BreadcrumbsProps extends BaseProps {
8
+ items: BreadcrumbItem[];
9
+ className?: string;
10
+ homeHref?: string;
11
+ }
12
+ export interface BreadcrumbLinkProps {
13
+ item: BreadcrumbItem;
14
+ isMobile?: boolean;
15
+ isCurrentPage?: boolean;
4
16
  }
5
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAI3D,MAAM,WAAW,gBAAiB,SAAQ,SAAS;CAElD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),a=require("@phila/phila-ui-core"),n=e.defineComponent({__name:"Breadcrumbs",props:{className:{}},setup(s,{emit:c}){const r=s,t=e.computed(()=>a.cn("default-class",r.className));return(o,m)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(t.value)}," Hello world! I am Breadcrumbs ",2))}}),l=(s,c)=>{const r=s.__vccOpts||s;for(const[t,o]of c)r[t]=o;return r},u=l(n,[["__scopeId","data-v-eb21bb54"]]);exports.Breadcrumbs=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("vue"),m=require("@phila/phila-ui-core"),i=require("@phila/phila-ui-link");var u={prefix:"fas",iconName:"angle-left",icon:[256,512,[8249],"f104","M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"]},f={prefix:"fas",iconName:"house",icon:[512,512,[127968,63498,63500,"home","home-alt","home-lg-alt"],"f015","M277.8 8.6c-12.3-11.4-31.3-11.4-43.5 0l-224 208c-9.6 9-12.8 22.9-8 35.1S18.8 272 32 272l16 0 0 176c0 35.3 28.7 64 64 64l288 0c35.3 0 64-28.7 64-64l0-176 16 0c13.2 0 25-8.1 29.8-20.3s1.6-26.2-8-35.1l-224-208zM240 320l32 0c26.5 0 48 21.5 48 48l0 96-128 0 0-96c0-26.5 21.5-48 48-48z"]};const d={key:0,class:"has-text-body-small"},c=e.defineComponent({__name:"BreadcrumbLink",props:{item:{},isMobile:{type:Boolean,default:!1},isCurrentPage:{type:Boolean,default:!1}},setup(n){return(t,l)=>n.isCurrentPage?(e.openBlock(),e.createElementBlock("span",d,e.toDisplayString(n.item.label),1)):(e.openBlock(),e.createBlock(e.unref(i.PhilaLink),{key:1,href:n.item.href,size:"small","icon-definition":n.isMobile?e.unref(u):null},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.item.label),1)]),_:1},8,["href","icon-definition"]))}}),h={"aria-label":"breadcrumb"},p={class:"breadcrumb-mobile"},b=["aria-current"],g=e.defineComponent({__name:"Breadcrumbs",props:{items:{default:()=>[]},className:{default:""},homeHref:{default:"/"}},setup(n){const t=n,l=e.computed(()=>m.cn(t.className+" content")),a=()=>t.items.length>1?t.items[t.items.length-2]:{label:"Home",href:t.homeHref};return(o,B)=>(e.openBlock(),e.createElementBlock("nav",h,[e.createElementVNode("div",p,[e.createVNode(c,{item:a(),"is-mobile":""},null,8,["item"])]),e.createElementVNode("ul",{class:e.normalizeClass(l.value)},[e.createElementVNode("li",null,[e.createVNode(e.unref(i.PhilaLink),{href:t.homeHref||"/","icon-definition":e.unref(f),"icon-only":"",size:"small","aria-label":"Home"},null,8,["href","icon-definition"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(s,r)=>(e.openBlock(),e.createElementBlock("li",{key:r,class:"breadcrumb-item","aria-current":r===t.items.length-1?"page":void 0},[e.createVNode(c,{item:s,"is-current-page":r===t.items.length-1},null,8,["item","is-current-page"])],8,b))),128))],2)]))}}),_=(n,t)=>{const l=n.__vccOpts||n;for(const[a,o]of t)l[a]=o;return l},k=_(g,[["__scopeId","data-v-64268cf1"]]);exports.Breadcrumbs=k;
package/dist/index.mjs CHANGED
@@ -1,22 +1,88 @@
1
- import { defineComponent as r, computed as a, createElementBlock as n, openBlock as m, normalizeClass as l } from "vue";
2
- import { cn as p } from "@phila/phila-ui-core";
3
- import './index.css';const _ = /* @__PURE__ */ r({
1
+ import { defineComponent as d, createElementBlock as n, createBlock as p, openBlock as a, toDisplayString as f, unref as r, withCtx as _, createTextVNode as g, computed as k, createElementVNode as s, createVNode as c, normalizeClass as v, Fragment as y, renderList as B } from "vue";
2
+ import { cn as x } from "@phila/phila-ui-core";
3
+ import { PhilaLink as h } from "@phila/phila-ui-link";
4
+ import './index.css';var N = {
5
+ prefix: "fas",
6
+ iconName: "angle-left",
7
+ icon: [256, 512, [8249], "f104", "M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"]
8
+ }, z = {
9
+ prefix: "fas",
10
+ iconName: "house",
11
+ icon: [512, 512, [127968, 63498, 63500, "home", "home-alt", "home-lg-alt"], "f015", "M277.8 8.6c-12.3-11.4-31.3-11.4-43.5 0l-224 208c-9.6 9-12.8 22.9-8 35.1S18.8 272 32 272l16 0 0 176c0 35.3 28.7 64 64 64l288 0c35.3 0 64-28.7 64-64l0-176 16 0c13.2 0 25-8.1 29.8-20.3s1.6-26.2-8-35.1l-224-208zM240 320l32 0c26.5 0 48 21.5 48 48l0 96-128 0 0-96c0-26.5 21.5-48 48-48z"]
12
+ };
13
+ const H = {
14
+ key: 0,
15
+ class: "has-text-body-small"
16
+ }, u = /* @__PURE__ */ d({
17
+ __name: "BreadcrumbLink",
18
+ props: {
19
+ item: {},
20
+ isMobile: { type: Boolean, default: !1 },
21
+ isCurrentPage: { type: Boolean, default: !1 }
22
+ },
23
+ setup(t) {
24
+ return (e, l) => t.isCurrentPage ? (a(), n("span", H, f(t.item.label), 1)) : (a(), p(r(h), {
25
+ key: 1,
26
+ href: t.item.href,
27
+ size: "small",
28
+ "icon-definition": t.isMobile ? r(N) : null
29
+ }, {
30
+ default: _(() => [
31
+ g(f(t.item.label), 1)
32
+ ]),
33
+ _: 1
34
+ }, 8, ["href", "icon-definition"]));
35
+ }
36
+ }), C = { "aria-label": "breadcrumb" }, L = { class: "breadcrumb-mobile" }, M = ["aria-current"], P = /* @__PURE__ */ d({
4
37
  __name: "Breadcrumbs",
5
38
  props: {
6
- className: {}
39
+ items: { default: () => [] },
40
+ className: { default: "" },
41
+ homeHref: { default: "/" }
7
42
  },
8
- setup(e, { emit: c }) {
9
- const s = e, t = a(() => p("default-class", s.className));
10
- return (o, d) => (m(), n("span", {
11
- class: l(t.value)
12
- }, " Hello world! I am Breadcrumbs ", 2));
43
+ setup(t) {
44
+ const e = t, l = k(() => x(e.className + " content")), i = () => e.items.length > 1 ? e.items[e.items.length - 2] : {
45
+ label: "Home",
46
+ href: e.homeHref
47
+ };
48
+ return (m, E) => (a(), n("nav", C, [
49
+ s("div", L, [
50
+ c(u, {
51
+ item: i(),
52
+ "is-mobile": ""
53
+ }, null, 8, ["item"])
54
+ ]),
55
+ s("ul", {
56
+ class: v(l.value)
57
+ }, [
58
+ s("li", null, [
59
+ c(r(h), {
60
+ href: e.homeHref || "/",
61
+ "icon-definition": r(z),
62
+ "icon-only": "",
63
+ size: "small",
64
+ "aria-label": "Home"
65
+ }, null, 8, ["href", "icon-definition"])
66
+ ]),
67
+ (a(!0), n(y, null, B(e.items, (b, o) => (a(), n("li", {
68
+ key: o,
69
+ class: "breadcrumb-item",
70
+ "aria-current": o === e.items.length - 1 ? "page" : void 0
71
+ }, [
72
+ c(u, {
73
+ item: b,
74
+ "is-current-page": o === e.items.length - 1
75
+ }, null, 8, ["item", "is-current-page"])
76
+ ], 8, M))), 128))
77
+ ], 2)
78
+ ]));
13
79
  }
14
- }), u = (e, c) => {
15
- const s = e.__vccOpts || e;
16
- for (const [t, o] of c)
17
- s[t] = o;
18
- return s;
19
- }, b = /* @__PURE__ */ u(_, [["__scopeId", "data-v-eb21bb54"]]);
80
+ }), V = (t, e) => {
81
+ const l = t.__vccOpts || t;
82
+ for (const [i, m] of e)
83
+ l[i] = m;
84
+ return l;
85
+ }, w = /* @__PURE__ */ V(P, [["__scopeId", "data-v-64268cf1"]]);
20
86
  export {
21
- b as Breadcrumbs
87
+ w as Breadcrumbs
22
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phila/phila-ui-breadcrumbs",
3
- "version": "0.0.3",
3
+ "version": "0.1.0-beta.2",
4
4
  "type": "module",
5
5
  "description": "A breadcrumb component for Phila UI",
6
6
  "main": "./dist/index.js",
@@ -25,12 +25,18 @@
25
25
  "author": "",
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
+ "@fortawesome/vue-fontawesome": "^3.1.2",
28
29
  "vue": "^3.0.0"
29
30
  },
30
31
  "dependencies": {
31
- "@phila/phila-ui-core": "2.1.2"
32
+ "@phila/phila-ui-core": "2.2.0-beta.2",
33
+ "@phila/phila-ui-link": "1.0.0-beta.0"
32
34
  },
33
35
  "devDependencies": {
36
+ "@fortawesome/fontawesome-svg-core": "^7.1.0",
37
+ "@fortawesome/pro-regular-svg-icons": "^7.1.0",
38
+ "@fortawesome/pro-solid-svg-icons": "^7.1.0",
39
+ "@fortawesome/vue-fontawesome": "^3.1.2",
34
40
  "@types/node": "^24.0.0",
35
41
  "@vitejs/plugin-vue": "^6.0.1",
36
42
  "eslint": "^9.0.0",