automoby-kit 1.0.38 → 1.0.40

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.
@@ -1 +1 @@
1
- "use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("./utils.js"),a=require("./contexts.js"),n=require("./chunks/chevron-left-Do__K6cA.js");require("./chunks/createLucideIcon-BqJVOzoK.js");const i=r.forwardRef(({items:r,className:i,isMobile:s},l)=>{const c=a.useMobile(),o=s??c;return e.jsx("nav",{ref:l,className:t("flex items-center",o?"gap-1 px-4 py-2.5":"gap-3 pr-1 pt-3 pb-4 pl-0",i),"aria-label":"Breadcrumb navigation",children:e.jsx("ol",{className:"flex items-center gap-inherit",children:r.map((a,i)=>{const s=i===r.length-1,l=!s&&(a.href||a.onClick),c=`${a.label}-${i}`;return e.jsxs("li",{className:"flex items-center gap-inherit",children:[l?e.jsx("a",{href:a.href||"#",className:t("whitespace-nowrap border-0 bg-transparent p-0 no-underline",o?"text-t":"text-s","text-neutral-main","cursor-pointer hover:text-neutral-dark transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm"),onClick:e=>((e,t,a)=>{t!==r.length-1&&e.onClick&&(a.preventDefault(),e.onClick())})(a,i,e),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a.onClick&&a.onClick())},"aria-label":`Go to ${a.label}`,children:a.label}):e.jsx("span",{className:t("whitespace-nowrap",o?"text-t":"text-s","text-neutral-main","font-medium"),"aria-current":s?"page":void 0,"aria-label":s?`Current page: ${a.label}`:void 0,children:a.label}),!s&&e.jsx(n.ChevronLeft,{className:t("text-neutral-main flex-shrink-0",o?"w-2.5 h-2.5":"w-3 h-3"),"aria-hidden":"true"})]},c)})})})});i.displayName="Breadcrumb",exports.Breadcrumb=i;
1
+ "use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("./utils.js"),n=require("./contexts.js"),t=require("./Typography.js"),a=require("./chunks/chevron-left-Do__K6cA.js");require("./chunks/createLucideIcon-BqJVOzoK.js");const s=r.forwardRef(({items:r,className:s,isMobile:l},o)=>{const c=n.useMobile(),u=l??c;return e.jsx("nav",{ref:o,className:i("flex items-center",u?"gap-1 px-4 py-2.5":"gap-3 pr-1 pt-3 pb-4 pl-0",s),"aria-label":"Breadcrumb navigation",children:e.jsx("ol",{className:"flex items-center gap-inherit",children:r.map((n,s)=>{const l=s===r.length-1,o=!l&&!!n.onClick,c=`${n.label}-${s}`,d=n.component??(!l&&n.href?"a":"span"),h=o&&!n.href;return e.jsxs("li",{className:"flex items-center gap-inherit",children:[e.jsx(d,{className:i("whitespace-nowrap text-neutral-main",o?"cursor-pointer hover:text-neutral-dark transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm":void 0),role:h?"button":void 0,tabIndex:h?0:void 0,"aria-current":l?"page":void 0,"aria-label":l?`Current page: ${n.label}`:void 0,title:n.title,href:l?void 0:n.href,onClick:o?e=>((e,i,n)=>{i!==r.length-1&&e.onClick&&(e.href||n.preventDefault(),e.onClick())})(n,s,e):void 0,onKeyDown:h?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.onClick&&n.onClick())}:void 0,children:e.jsx(t.Typography,{variant:u?"body-t-medium":"body-s-medium",children:n.label})}),!l&&e.jsx(a.ChevronLeft,{className:i("text-neutral-main flex-shrink-0",u?"w-2.5 h-2.5":"w-3 h-3"),"aria-hidden":"true"})]},c)})})})});s.displayName="Breadcrumb",exports.Breadcrumb=s;
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import t from"react";import a from"./utils.js";import{useMobile as n}from"./contexts.js";import{C as i}from"./chunks/chevron-left-4HSuTes3.js";import"./chunks/createLucideIcon-DGp0SoUT.js";const l=t.forwardRef(({items:t,className:l,isMobile:o},s)=>{const c=n(),m=o??c;return e("nav",{ref:s,className:a("flex items-center",m?"gap-1 px-4 py-2.5":"gap-3 pr-1 pt-3 pb-4 pl-0",l),"aria-label":"Breadcrumb navigation",children:e("ol",{className:"flex items-center gap-inherit",children:t.map((n,l)=>{const o=l===t.length-1,s=!o&&(n.href||n.onClick),c=`${n.label}-${l}`;return r("li",{className:"flex items-center gap-inherit",children:[s?e("a",{href:n.href||"#",className:a("whitespace-nowrap border-0 bg-transparent p-0 no-underline",m?"text-t":"text-s","text-neutral-main","cursor-pointer hover:text-neutral-dark transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm"),onClick:e=>((e,r,a)=>{r!==t.length-1&&e.onClick&&(a.preventDefault(),e.onClick())})(n,l,e),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.onClick&&n.onClick())},"aria-label":`Go to ${n.label}`,children:n.label}):e("span",{className:a("whitespace-nowrap",m?"text-t":"text-s","text-neutral-main","font-medium"),"aria-current":o?"page":void 0,"aria-label":o?`Current page: ${n.label}`:void 0,children:n.label}),!o&&e(i,{className:a("text-neutral-main flex-shrink-0",m?"w-2.5 h-2.5":"w-3 h-3"),"aria-hidden":"true"})]},c)})})})});l.displayName="Breadcrumb";export{l as Breadcrumb};
1
+ "use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import t from"react";import i from"./utils.js";import{useMobile as n}from"./contexts.js";import{Typography as o}from"./Typography.js";import{C as a}from"./chunks/chevron-left-4HSuTes3.js";import"./chunks/createLucideIcon-DGp0SoUT.js";const l=t.forwardRef(({items:t,className:l,isMobile:s},c)=>{const m=n(),p=s??m;return e("nav",{ref:c,className:i("flex items-center",p?"gap-1 px-4 py-2.5":"gap-3 pr-1 pt-3 pb-4 pl-0",l),"aria-label":"Breadcrumb navigation",children:e("ol",{className:"flex items-center gap-inherit",children:t.map((n,l)=>{const s=l===t.length-1,c=!s&&!!n.onClick,m=`${n.label}-${l}`,u=n.component??(!s&&n.href?"a":"span"),d=c&&!n.href;return r("li",{className:"flex items-center gap-inherit",children:[e(u,{className:i("whitespace-nowrap text-neutral-main",c?"cursor-pointer hover:text-neutral-dark transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm":void 0),role:d?"button":void 0,tabIndex:d?0:void 0,"aria-current":s?"page":void 0,"aria-label":s?`Current page: ${n.label}`:void 0,title:n.title,href:s?void 0:n.href,onClick:c?e=>((e,r,i)=>{r!==t.length-1&&e.onClick&&(e.href||i.preventDefault(),e.onClick())})(n,l,e):void 0,onKeyDown:d?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.onClick&&n.onClick())}:void 0,children:e(o,{variant:p?"body-t-medium":"body-s-medium",children:n.label})}),!s&&e(a,{className:i("text-neutral-main flex-shrink-0",p?"w-2.5 h-2.5":"w-3 h-3"),"aria-hidden":"true"})]},m)})})})});l.displayName="Breadcrumb";export{l as Breadcrumb};
@@ -2,6 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import cn from './utils.js';
4
4
  import { useMobile } from './contexts.js';
5
+ import { Typography } from './Typography.js';
5
6
  import { C as ChevronLeft } from './chevron-left-Ck6O99eF.js';
6
7
  import './createLucideIcon-D-q73LTT.js';
7
8
 
@@ -13,10 +14,12 @@ const Breadcrumb = React.forwardRef(({ items, className, isMobile }, ref) => {
13
14
  if (index === items.length - 1)
14
15
  return;
15
16
  if (item.onClick) {
16
- e.preventDefault();
17
+ // If there is no href, we fully handle the click
18
+ if (!item.href) {
19
+ e.preventDefault();
20
+ }
17
21
  item.onClick();
18
22
  }
19
- // If item has href, let the anchor tag handle navigation naturally
20
23
  };
21
24
  return (jsx("nav", { ref: ref, className: cn(
22
25
  // Base layout - rely on page RTL direction; no manual row-reverse
@@ -24,32 +27,26 @@ const Breadcrumb = React.forwardRef(({ items, className, isMobile }, ref) => {
24
27
  // Responsive gap and padding based on mobile state
25
28
  actualIsMobile ? 'gap-1 px-4 py-2.5' : 'gap-3 pr-1 pt-3 pb-4 pl-0', className), "aria-label": "Breadcrumb navigation", children: jsx("ol", { className: "flex items-center gap-inherit", children: items.map((item, index) => {
26
29
  const isLast = index === items.length - 1;
27
- const isClickable = !isLast && (item.href || item.onClick);
30
+ const isClickable = !isLast && !!item.onClick;
28
31
  const itemKey = `${item.label}-${index}`;
29
- return (jsxs("li", { className: "flex items-center gap-inherit", children: [isClickable ? (jsx("a", { href: item.href || '#', className: cn(
30
- // Base styles
31
- 'whitespace-nowrap border-0 bg-transparent p-0 no-underline',
32
- // Responsive font size based on mobile state
33
- actualIsMobile ? 'text-t' : 'text-s',
34
- // Color
35
- 'text-neutral-main',
36
- // Cursor and hover effects for clickable items
37
- 'cursor-pointer hover:text-neutral-dark transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm'), onClick: (e) => handleItemClick(item, index, e), onKeyDown: (e) => {
38
- if (e.key === 'Enter' || e.key === ' ') {
39
- e.preventDefault();
40
- if (item.onClick) {
41
- item.onClick();
32
+ const ItemElement = item.component ?? (!isLast && item.href ? 'a' : 'span');
33
+ const isButtonLike = isClickable && !item.href;
34
+ return (jsxs("li", { className: "flex items-center gap-inherit", children: [jsx(ItemElement, { className: cn('whitespace-nowrap text-neutral-main', isClickable
35
+ ? 'cursor-pointer hover:text-neutral-dark transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm'
36
+ : undefined),
37
+ // Accessibility only for non-link button-like behavior
38
+ role: isButtonLike ? 'button' : undefined, tabIndex: isButtonLike ? 0 : undefined, "aria-current": isLast ? 'page' : undefined, "aria-label": isLast ? `Current page: ${item.label}` : undefined, title: item.title, href: !isLast ? item.href : undefined, onClick: isClickable
39
+ ? (e) => handleItemClick(item, index, e)
40
+ : undefined, onKeyDown: isButtonLike
41
+ ? (e) => {
42
+ if (e.key === 'Enter' || e.key === ' ') {
43
+ e.preventDefault();
44
+ if (item.onClick) {
45
+ item.onClick();
46
+ }
42
47
  }
43
48
  }
44
- }, "aria-label": `Go to ${item.label}`, children: item.label })) : (jsx("span", { className: cn(
45
- // Base styles
46
- 'whitespace-nowrap',
47
- // Responsive font size based on mobile state
48
- actualIsMobile ? 'text-t' : 'text-s',
49
- // Color
50
- 'text-neutral-main',
51
- // Different styles for current page (last item)
52
- 'font-medium'), "aria-current": isLast ? 'page' : undefined, "aria-label": isLast ? `Current page: ${item.label}` : undefined, children: item.label })), !isLast && (jsx(ChevronLeft, { className: cn('text-neutral-main flex-shrink-0',
49
+ : undefined, children: jsx(Typography, { variant: actualIsMobile ? 'body-t-medium' : 'body-s-medium', children: item.label }) }), !isLast && (jsx(ChevronLeft, { className: cn('text-neutral-main flex-shrink-0',
53
50
  // Responsive icon size
54
51
  actualIsMobile ? 'w-2.5 h-2.5' : 'w-3 h-3'), "aria-hidden": "true" }))] }, itemKey));
55
52
  }) }) }));
@@ -1,8 +1,13 @@
1
1
  import React from 'react';
2
2
  export interface BreadcrumbItem {
3
3
  label: string;
4
- href?: string;
5
4
  onClick?: () => void;
5
+ /** Optional href for link-like items */
6
+ href?: string;
7
+ /** Optional title attribute passed to the rendered item component */
8
+ title?: string;
9
+ /** Optional custom component to render the item (e.g., Link) */
10
+ component?: React.ElementType;
6
11
  }
7
12
  export interface BreadcrumbProps {
8
13
  items: BreadcrumbItem[];
@@ -1,8 +1,9 @@
1
+ import React from 'react';
1
2
  import { BreadcrumbProps } from './Breadcrumb';
2
3
  type StoryArgs = BreadcrumbProps;
3
4
  declare const _default: {
4
5
  title: string;
5
- component: import("react").ForwardRefExoticComponent<BreadcrumbProps & import("react").RefAttributes<HTMLElement>>;
6
+ component: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
6
7
  parameters: {
7
8
  docs: {
8
9
  description: {
@@ -37,10 +38,12 @@ declare const _default: {
37
38
  items: ({
38
39
  label: string;
39
40
  href: string;
41
+ title: string;
40
42
  onClick: () => void;
41
43
  } | {
42
44
  label: string;
43
45
  href?: undefined;
46
+ title?: undefined;
44
47
  onClick?: undefined;
45
48
  })[];
46
49
  isMobile: boolean;
@@ -54,10 +57,17 @@ export declare const Default: {
54
57
  items: ({
55
58
  label: string;
56
59
  href: string;
60
+ title: string;
57
61
  onClick: () => void;
62
+ } | {
63
+ label: string;
64
+ onClick: () => void;
65
+ href?: undefined;
66
+ title?: undefined;
58
67
  } | {
59
68
  label: string;
60
69
  href?: undefined;
70
+ title?: undefined;
61
71
  onClick?: undefined;
62
72
  })[];
63
73
  };
@@ -69,11 +79,11 @@ export declare const ShortBreadcrumb: {
69
79
  items: ({
70
80
  label: string;
71
81
  href: string;
72
- onClick: () => void;
82
+ title: string;
73
83
  } | {
74
84
  label: string;
75
85
  href?: undefined;
76
- onClick?: undefined;
86
+ title?: undefined;
77
87
  })[];
78
88
  };
79
89
  };
@@ -84,11 +94,9 @@ export declare const LongBreadcrumb: {
84
94
  items: ({
85
95
  label: string;
86
96
  href: string;
87
- onClick: () => void;
88
97
  } | {
89
98
  label: string;
90
99
  href?: undefined;
91
- onClick?: undefined;
92
100
  })[];
93
101
  };
94
102
  };
@@ -98,10 +106,19 @@ export declare const WithClickHandlers: {
98
106
  args: {
99
107
  items: ({
100
108
  label: string;
109
+ href: string;
110
+ onClick: () => void;
111
+ title?: undefined;
112
+ } | {
113
+ label: string;
114
+ href: string;
115
+ title: string;
101
116
  onClick: () => void;
102
117
  } | {
103
118
  label: string;
119
+ href?: undefined;
104
120
  onClick?: undefined;
121
+ title?: undefined;
105
122
  })[];
106
123
  };
107
124
  };
@@ -110,14 +127,6 @@ export declare const WithMixedNavigation: {
110
127
  storyName: string;
111
128
  args: {
112
129
  items: ({
113
- label: string;
114
- href: string;
115
- onClick?: undefined;
116
- } | {
117
- label: string;
118
- onClick: () => void;
119
- href?: undefined;
120
- } | {
121
130
  label: string;
122
131
  href: string;
123
132
  onClick: () => void;
@@ -135,10 +144,17 @@ export declare const EnglishContent: {
135
144
  items: ({
136
145
  label: string;
137
146
  href: string;
147
+ title: string;
148
+ onClick?: undefined;
149
+ } | {
150
+ label: string;
138
151
  onClick: () => void;
152
+ href?: undefined;
153
+ title?: undefined;
139
154
  } | {
140
155
  label: string;
141
156
  href?: undefined;
157
+ title?: undefined;
142
158
  onClick?: undefined;
143
159
  })[];
144
160
  };
@@ -150,10 +166,16 @@ export declare const DesktopView: {
150
166
  isMobile: boolean;
151
167
  items: ({
152
168
  label: string;
153
- onClick: () => void;
169
+ href: string;
170
+ title: string;
154
171
  } | {
155
172
  label: string;
156
- onClick?: undefined;
173
+ href: string;
174
+ title?: undefined;
175
+ } | {
176
+ label: string;
177
+ href?: undefined;
178
+ title?: undefined;
157
179
  })[];
158
180
  };
159
181
  };
@@ -164,10 +186,16 @@ export declare const MobileView: {
164
186
  isMobile: boolean;
165
187
  items: ({
166
188
  label: string;
167
- onClick: () => void;
189
+ href: string;
190
+ title: string;
168
191
  } | {
169
192
  label: string;
170
- onClick?: undefined;
193
+ href: string;
194
+ title?: undefined;
195
+ } | {
196
+ label: string;
197
+ href?: undefined;
198
+ title?: undefined;
171
199
  })[];
172
200
  };
173
201
  };
@@ -175,3 +203,20 @@ export declare const ResponsiveComparison: {
175
203
  (): import("react/jsx-runtime").JSX.Element;
176
204
  storyName: string;
177
205
  };
206
+ export declare const WithCustomComponent: {
207
+ (args: StoryArgs): import("react/jsx-runtime").JSX.Element;
208
+ storyName: string;
209
+ args: {
210
+ items: ({
211
+ label: string;
212
+ href: string;
213
+ component: React.FC<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">>;
214
+ title: string;
215
+ } | {
216
+ label: string;
217
+ href?: undefined;
218
+ component?: undefined;
219
+ title?: undefined;
220
+ })[];
221
+ };
222
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automoby-kit",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "A comprehensive React UI component library - created in war 2025",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",