automoby-kit 1.0.39 → 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.
package/dist/cjs/Breadcrumb.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),
|
|
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;
|
package/dist/esm/Breadcrumb.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import t from"react";import
|
|
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};
|
package/dist/types/Breadcrumb.js
CHANGED
|
@@ -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,7 +14,10 @@ const Breadcrumb = React.forwardRef(({ items, className, isMobile }, ref) => {
|
|
|
13
14
|
if (index === items.length - 1)
|
|
14
15
|
return;
|
|
15
16
|
if (item.onClick) {
|
|
16
|
-
|
|
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
23
|
};
|
|
@@ -25,11 +29,15 @@ const Breadcrumb = React.forwardRef(({ items, className, isMobile }, ref) => {
|
|
|
25
29
|
const isLast = index === items.length - 1;
|
|
26
30
|
const isClickable = !isLast && !!item.onClick;
|
|
27
31
|
const itemKey = `${item.label}-${index}`;
|
|
28
|
-
|
|
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
|
|
29
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'
|
|
30
|
-
: undefined),
|
|
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
|
|
31
39
|
? (e) => handleItemClick(item, index, e)
|
|
32
|
-
: undefined, onKeyDown:
|
|
40
|
+
: undefined, onKeyDown: isButtonLike
|
|
33
41
|
? (e) => {
|
|
34
42
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
35
43
|
e.preventDefault();
|
|
@@ -38,7 +46,7 @@ const Breadcrumb = React.forwardRef(({ items, className, isMobile }, ref) => {
|
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
}
|
|
41
|
-
: 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',
|
|
42
50
|
// Responsive icon size
|
|
43
51
|
actualIsMobile ? 'w-2.5 h-2.5' : 'w-3 h-3'), "aria-hidden": "true" }))] }, itemKey));
|
|
44
52
|
}) }) }));
|
|
@@ -2,6 +2,12 @@ import React from 'react';
|
|
|
2
2
|
export interface BreadcrumbItem {
|
|
3
3
|
label: string;
|
|
4
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;
|
|
5
11
|
}
|
|
6
12
|
export interface BreadcrumbProps {
|
|
7
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:
|
|
6
|
+
component: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
|
|
6
7
|
parameters: {
|
|
7
8
|
docs: {
|
|
8
9
|
description: {
|
|
@@ -36,9 +37,13 @@ declare const _default: {
|
|
|
36
37
|
args: {
|
|
37
38
|
items: ({
|
|
38
39
|
label: string;
|
|
40
|
+
href: string;
|
|
41
|
+
title: string;
|
|
39
42
|
onClick: () => void;
|
|
40
43
|
} | {
|
|
41
44
|
label: string;
|
|
45
|
+
href?: undefined;
|
|
46
|
+
title?: undefined;
|
|
42
47
|
onClick?: undefined;
|
|
43
48
|
})[];
|
|
44
49
|
isMobile: boolean;
|
|
@@ -51,9 +56,18 @@ export declare const Default: {
|
|
|
51
56
|
args: {
|
|
52
57
|
items: ({
|
|
53
58
|
label: string;
|
|
59
|
+
href: string;
|
|
60
|
+
title: string;
|
|
54
61
|
onClick: () => void;
|
|
55
62
|
} | {
|
|
56
63
|
label: string;
|
|
64
|
+
onClick: () => void;
|
|
65
|
+
href?: undefined;
|
|
66
|
+
title?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
label: string;
|
|
69
|
+
href?: undefined;
|
|
70
|
+
title?: undefined;
|
|
57
71
|
onClick?: undefined;
|
|
58
72
|
})[];
|
|
59
73
|
};
|
|
@@ -64,10 +78,12 @@ export declare const ShortBreadcrumb: {
|
|
|
64
78
|
args: {
|
|
65
79
|
items: ({
|
|
66
80
|
label: string;
|
|
67
|
-
|
|
81
|
+
href: string;
|
|
82
|
+
title: string;
|
|
68
83
|
} | {
|
|
69
84
|
label: string;
|
|
70
|
-
|
|
85
|
+
href?: undefined;
|
|
86
|
+
title?: undefined;
|
|
71
87
|
})[];
|
|
72
88
|
};
|
|
73
89
|
};
|
|
@@ -77,10 +93,10 @@ export declare const LongBreadcrumb: {
|
|
|
77
93
|
args: {
|
|
78
94
|
items: ({
|
|
79
95
|
label: string;
|
|
80
|
-
|
|
96
|
+
href: string;
|
|
81
97
|
} | {
|
|
82
98
|
label: string;
|
|
83
|
-
|
|
99
|
+
href?: undefined;
|
|
84
100
|
})[];
|
|
85
101
|
};
|
|
86
102
|
};
|
|
@@ -90,10 +106,19 @@ export declare const WithClickHandlers: {
|
|
|
90
106
|
args: {
|
|
91
107
|
items: ({
|
|
92
108
|
label: string;
|
|
109
|
+
href: string;
|
|
110
|
+
onClick: () => void;
|
|
111
|
+
title?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
label: string;
|
|
114
|
+
href: string;
|
|
115
|
+
title: string;
|
|
93
116
|
onClick: () => void;
|
|
94
117
|
} | {
|
|
95
118
|
label: string;
|
|
119
|
+
href?: undefined;
|
|
96
120
|
onClick?: undefined;
|
|
121
|
+
title?: undefined;
|
|
97
122
|
})[];
|
|
98
123
|
};
|
|
99
124
|
};
|
|
@@ -103,9 +128,11 @@ export declare const WithMixedNavigation: {
|
|
|
103
128
|
args: {
|
|
104
129
|
items: ({
|
|
105
130
|
label: string;
|
|
131
|
+
href: string;
|
|
106
132
|
onClick: () => void;
|
|
107
133
|
} | {
|
|
108
134
|
label: string;
|
|
135
|
+
href?: undefined;
|
|
109
136
|
onClick?: undefined;
|
|
110
137
|
})[];
|
|
111
138
|
};
|
|
@@ -115,10 +142,19 @@ export declare const EnglishContent: {
|
|
|
115
142
|
storyName: string;
|
|
116
143
|
args: {
|
|
117
144
|
items: ({
|
|
145
|
+
label: string;
|
|
146
|
+
href: string;
|
|
147
|
+
title: string;
|
|
148
|
+
onClick?: undefined;
|
|
149
|
+
} | {
|
|
118
150
|
label: string;
|
|
119
151
|
onClick: () => void;
|
|
152
|
+
href?: undefined;
|
|
153
|
+
title?: undefined;
|
|
120
154
|
} | {
|
|
121
155
|
label: string;
|
|
156
|
+
href?: undefined;
|
|
157
|
+
title?: undefined;
|
|
122
158
|
onClick?: undefined;
|
|
123
159
|
})[];
|
|
124
160
|
};
|
|
@@ -130,10 +166,16 @@ export declare const DesktopView: {
|
|
|
130
166
|
isMobile: boolean;
|
|
131
167
|
items: ({
|
|
132
168
|
label: string;
|
|
133
|
-
|
|
169
|
+
href: string;
|
|
170
|
+
title: string;
|
|
134
171
|
} | {
|
|
135
172
|
label: string;
|
|
136
|
-
|
|
173
|
+
href: string;
|
|
174
|
+
title?: undefined;
|
|
175
|
+
} | {
|
|
176
|
+
label: string;
|
|
177
|
+
href?: undefined;
|
|
178
|
+
title?: undefined;
|
|
137
179
|
})[];
|
|
138
180
|
};
|
|
139
181
|
};
|
|
@@ -144,10 +186,16 @@ export declare const MobileView: {
|
|
|
144
186
|
isMobile: boolean;
|
|
145
187
|
items: ({
|
|
146
188
|
label: string;
|
|
147
|
-
|
|
189
|
+
href: string;
|
|
190
|
+
title: string;
|
|
148
191
|
} | {
|
|
149
192
|
label: string;
|
|
150
|
-
|
|
193
|
+
href: string;
|
|
194
|
+
title?: undefined;
|
|
195
|
+
} | {
|
|
196
|
+
label: string;
|
|
197
|
+
href?: undefined;
|
|
198
|
+
title?: undefined;
|
|
151
199
|
})[];
|
|
152
200
|
};
|
|
153
201
|
};
|
|
@@ -155,3 +203,20 @@ export declare const ResponsiveComparison: {
|
|
|
155
203
|
(): import("react/jsx-runtime").JSX.Element;
|
|
156
204
|
storyName: string;
|
|
157
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
|
+
};
|