automoby-kit 1.0.3 → 1.0.5
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 +2 -10
- package/dist/cjs/Accordion.js +1 -0
- package/dist/cjs/Backdrop.js +1 -0
- package/dist/cjs/Breadcrumb.js +1 -0
- package/dist/cjs/Button.js +1 -0
- package/dist/cjs/Chips.js +1 -0
- package/dist/cjs/Divider.js +1 -0
- package/dist/cjs/Drawer.js +1 -0
- package/dist/cjs/Input.js +1 -0
- package/dist/cjs/Menu.js +1 -0
- package/dist/cjs/Pagination.js +1 -0
- package/dist/cjs/ProtectedComponent.js +1 -0
- package/dist/cjs/RadioGroup.js +1 -0
- package/dist/cjs/Tabs.js +1 -0
- package/dist/cjs/Typography.js +1 -0
- package/dist/cjs/chunks/MobileContext-eI2eV1-F.js +1 -0
- package/dist/cjs/chunks/chevron-left-Do__K6cA.js +1 -0
- package/dist/cjs/chunks/createLucideIcon-BqJVOzoK.js +1 -0
- package/dist/cjs/chunks/jsx-runtime-Bgd4cJfV.js +1 -0
- package/dist/cjs/contexts.js +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/licensing.js +1 -0
- package/dist/cjs/utils.js +1 -0
- package/dist/esm/Accordion.js +1 -0
- package/dist/esm/Backdrop.js +1 -0
- package/dist/esm/Breadcrumb.js +1 -0
- package/dist/esm/Button.js +1 -0
- package/dist/esm/Chips.js +1 -0
- package/dist/esm/Divider.js +1 -0
- package/dist/esm/Drawer.js +1 -0
- package/dist/esm/Input.js +1 -0
- package/dist/esm/Menu.js +1 -0
- package/dist/esm/Pagination.js +1 -0
- package/dist/esm/ProtectedComponent.js +1 -0
- package/dist/esm/RadioGroup.js +1 -0
- package/dist/esm/Tabs.js +1 -0
- package/dist/esm/Typography.js +1 -0
- package/dist/esm/chunks/MobileContext-BLAyX72S.js +1 -0
- package/dist/esm/chunks/chevron-left-4HSuTes3.js +1 -0
- package/dist/esm/chunks/createLucideIcon-DGp0SoUT.js +1 -0
- package/dist/esm/chunks/jsx-runtime-DZXOD2H9.js +1 -0
- package/dist/esm/contexts.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/licensing.js +1 -0
- package/dist/esm/utils.js +1 -0
- package/dist/types/Accordion.js +54 -0
- package/dist/types/Backdrop.js +24 -0
- package/dist/types/Breadcrumb.js +56 -0
- package/dist/types/Button.js +46 -0
- package/dist/types/Chips.js +109 -0
- package/dist/types/Divider.js +21 -0
- package/dist/types/Drawer.js +107 -0
- package/dist/types/Input.js +78 -0
- package/dist/types/Menu.js +120 -0
- package/dist/types/MobileContext-BkG7_94E.js +1478 -0
- package/dist/types/Pagination.js +183 -0
- package/dist/types/ProtectedComponent.js +33 -0
- package/dist/types/RadioGroup.js +68 -0
- package/dist/types/Tabs.js +49 -0
- package/dist/types/Typography.js +60 -0
- package/dist/types/chevron-left-Ck6O99eF.js +14 -0
- package/dist/types/contexts/MobileContext.d.ts +0 -1
- package/dist/types/contexts/index.d.ts +1 -1
- package/dist/types/contexts.js +3 -0
- package/dist/types/createLucideIcon-D-q73LTT.js +112 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.js +38 -0
- package/dist/types/jsx-runtime-BiC2V0nk.js +430 -0
- package/dist/types/licensing.js +125 -0
- package/dist/types/utils.js +7 -0
- package/package.json +90 -4
- package/dist/index.cjs.js +0 -1
- package/dist/index.esm.js +0 -1
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from './jsx-runtime-BiC2V0nk.js';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import cn from './utils.js';
|
|
4
|
+
import { c as createLucideIcon } from './createLucideIcon-D-q73LTT.js';
|
|
5
|
+
import { C as ChevronLeft } from './chevron-left-Ck6O99eF.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @license lucide-react v0.522.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const __iconNode$3 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
16
|
+
const ChevronRight = createLucideIcon("chevron-right", __iconNode$3);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @license lucide-react v0.522.0 - ISC
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the ISC license.
|
|
22
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
const __iconNode$2 = [
|
|
27
|
+
["path", { d: "m11 17-5-5 5-5", key: "13zhaf" }],
|
|
28
|
+
["path", { d: "m18 17-5-5 5-5", key: "h8a8et" }]
|
|
29
|
+
];
|
|
30
|
+
const ChevronsLeft = createLucideIcon("chevrons-left", __iconNode$2);
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @license lucide-react v0.522.0 - ISC
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the ISC license.
|
|
36
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const __iconNode$1 = [
|
|
41
|
+
["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
|
|
42
|
+
["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }]
|
|
43
|
+
];
|
|
44
|
+
const ChevronsRight = createLucideIcon("chevrons-right", __iconNode$1);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @license lucide-react v0.522.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
const __iconNode = [
|
|
55
|
+
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
|
|
56
|
+
["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
|
|
57
|
+
["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
|
|
58
|
+
];
|
|
59
|
+
const Ellipsis = createLucideIcon("ellipsis", __iconNode);
|
|
60
|
+
|
|
61
|
+
function PaginationRoot({ className, ...props }) {
|
|
62
|
+
return (jsxRuntimeExports.jsx("nav", { role: "navigation", "aria-label": "pagination", "data-slot": "pagination", className: cn('mx-auto flex w-full justify-center', className), ...props }));
|
|
63
|
+
}
|
|
64
|
+
function PaginationContent({ className, device, ...props }) {
|
|
65
|
+
return (jsxRuntimeExports.jsx("ul", { "data-slot": "pagination-content", className: cn('flex flex-row items-center', device === 'mobile' ? 'gap-[6px]' : 'gap-2', className), ...props }));
|
|
66
|
+
}
|
|
67
|
+
function PaginationItem({ ...props }) {
|
|
68
|
+
return jsxRuntimeExports.jsx("li", { "data-slot": "pagination-item", ...props });
|
|
69
|
+
}
|
|
70
|
+
function PaginationLink({ className, device, variant, isActive, ...props }) {
|
|
71
|
+
return (jsxRuntimeExports.jsx("a", { "aria-current": isActive ? 'page' : undefined, "data-slot": "pagination-link", "data-active": isActive, className: cn(buttonVariants({
|
|
72
|
+
variant: variant === 'nextPrev' ? variant : isActive ? 'active' : 'outline',
|
|
73
|
+
device,
|
|
74
|
+
}), className), tabIndex: props['aria-disabled'] ? -1 : 0, ...props }));
|
|
75
|
+
}
|
|
76
|
+
function PaginationPrevious({ className, device, variant, ...props }) {
|
|
77
|
+
const isMobile = device === 'mobile';
|
|
78
|
+
const content = {
|
|
79
|
+
mobile: jsxRuntimeExports.jsx(ChevronRight, { size: 18 }),
|
|
80
|
+
desktop: (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(ChevronsRight, { size: 20 }), " ", jsxRuntimeExports.jsx("span", { children: "\u0642\u0628\u0644\u06CC" })] })),
|
|
81
|
+
};
|
|
82
|
+
return (jsxRuntimeExports.jsx(PaginationLink, { "aria-label": "Go to previous page", className: !isMobile
|
|
83
|
+
? 'flex justify-center items-center gap-2 w-[89px] h-[48px] ml-4'
|
|
84
|
+
: 'ml-2.5', device: device, variant: "nextPrev", ...props, children: device === 'mobile' ? content.mobile : content.desktop }));
|
|
85
|
+
}
|
|
86
|
+
function PaginationNext({ className, device, variant, ...props }) {
|
|
87
|
+
const isMobile = device === 'mobile';
|
|
88
|
+
const content = {
|
|
89
|
+
mobile: jsxRuntimeExports.jsx(ChevronLeft, { size: 18 }),
|
|
90
|
+
desktop: (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("span", { children: "\u0628\u0639\u062F\u06CC" }), jsxRuntimeExports.jsx(ChevronsLeft, { size: 20 })] })),
|
|
91
|
+
};
|
|
92
|
+
return (jsxRuntimeExports.jsx(PaginationLink, { "aria-label": "Go to next page", className: !isMobile
|
|
93
|
+
? 'flex justify-center items-center gap-2 w-[89px] h-[48px] mr-4'
|
|
94
|
+
: 'mr-2.5', device: device, variant: "nextPrev", ...props, children: device === 'mobile' ? content.mobile : content.desktop }));
|
|
95
|
+
}
|
|
96
|
+
function PaginationEllipsis({ className, ...props }) {
|
|
97
|
+
return (jsxRuntimeExports.jsx("span", { "aria-hidden": true, "data-slot": "pagination-ellipsis", className: cn('flex size-9 items-center justify-center', className), ...props, children: jsxRuntimeExports.jsx(Ellipsis, { className: "size-4" }) }));
|
|
98
|
+
}
|
|
99
|
+
function buttonVariants({ variant, device, }) {
|
|
100
|
+
const isMobile = device === 'mobile';
|
|
101
|
+
const base = cn({
|
|
102
|
+
'flex items-center justify-center rounded-[6px]': true,
|
|
103
|
+
'w-[40px] h-[40px] text-s font-heavy': isMobile,
|
|
104
|
+
'w-[48px] h-[48px] text-l font-heavy': !isMobile,
|
|
105
|
+
});
|
|
106
|
+
const variants = {
|
|
107
|
+
outline: 'border border-neutral-light bg-white text-neutral-darker',
|
|
108
|
+
active: 'bg-primary text-white',
|
|
109
|
+
nextPrev: 'border border-neutral-light bg-white text-neutral-darker',
|
|
110
|
+
};
|
|
111
|
+
return [base, variants[variant]].join(' ');
|
|
112
|
+
}
|
|
113
|
+
const Pagination = ({ pageCount, page: controlledPage, defaultPage = 1, onPageChange, className, isMobile, ...navProps }) => {
|
|
114
|
+
const isControlled = controlledPage !== undefined;
|
|
115
|
+
const [internalPage, setInternalPage] = useState(defaultPage);
|
|
116
|
+
const page = isControlled ? controlledPage : internalPage;
|
|
117
|
+
const device = isMobile ? 'mobile' : 'desktop';
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (!isControlled)
|
|
120
|
+
setInternalPage(defaultPage);
|
|
121
|
+
}, [defaultPage, isControlled]);
|
|
122
|
+
const changePage = (newPage) => {
|
|
123
|
+
if (!isControlled)
|
|
124
|
+
setInternalPage(newPage);
|
|
125
|
+
onPageChange?.(newPage);
|
|
126
|
+
};
|
|
127
|
+
function renderPages() {
|
|
128
|
+
const items = [];
|
|
129
|
+
if (pageCount <= 5) {
|
|
130
|
+
for (let i = 1; i <= pageCount; i++) {
|
|
131
|
+
items.push(jsxRuntimeExports.jsx(PaginationItem, { children: jsxRuntimeExports.jsx(PaginationLink, { href: "#", isActive: page === i, variant: "main", device: device, onClick: (e) => {
|
|
132
|
+
e.preventDefault();
|
|
133
|
+
if (page !== i)
|
|
134
|
+
changePage(i);
|
|
135
|
+
}, "aria-disabled": page === i, tabIndex: page === i ? -1 : 0, children: i }) }, i));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// First page
|
|
140
|
+
items.push(jsxRuntimeExports.jsx(PaginationItem, { children: jsxRuntimeExports.jsx(PaginationLink, { href: "#", isActive: page === 1, device: device, variant: "main", onClick: (e) => {
|
|
141
|
+
e.preventDefault();
|
|
142
|
+
if (page !== 1)
|
|
143
|
+
changePage(1);
|
|
144
|
+
}, "aria-disabled": page === 1, tabIndex: page === 1 ? -1 : 0, children: "1" }) }, 1));
|
|
145
|
+
// Ellipsis start
|
|
146
|
+
if (page > 3) {
|
|
147
|
+
items.push(jsxRuntimeExports.jsx(PaginationItem, { children: jsxRuntimeExports.jsx(PaginationEllipsis, {}) }, "start-ellipsis"));
|
|
148
|
+
}
|
|
149
|
+
// Middle pages
|
|
150
|
+
const start = Math.max(2, page - 1);
|
|
151
|
+
const end = Math.min(pageCount - 1, page + 1);
|
|
152
|
+
for (let i = start; i <= end; i++) {
|
|
153
|
+
items.push(jsxRuntimeExports.jsx(PaginationItem, { children: jsxRuntimeExports.jsx(PaginationLink, { href: "#", isActive: page === i, device: device, variant: "main", onClick: (e) => {
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
if (page !== i)
|
|
156
|
+
changePage(i);
|
|
157
|
+
}, "aria-disabled": page === i, tabIndex: page === i ? -1 : 0, children: i }) }, i));
|
|
158
|
+
}
|
|
159
|
+
// Ellipsis end
|
|
160
|
+
if (page < pageCount - 2) {
|
|
161
|
+
items.push(jsxRuntimeExports.jsx(PaginationItem, { children: jsxRuntimeExports.jsx(PaginationEllipsis, {}) }, "end-ellipsis"));
|
|
162
|
+
}
|
|
163
|
+
// Last page
|
|
164
|
+
items.push(jsxRuntimeExports.jsx(PaginationItem, { children: jsxRuntimeExports.jsx(PaginationLink, { href: "#", isActive: page === pageCount, device: device, variant: "main", onClick: (e) => {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
if (page !== pageCount)
|
|
167
|
+
changePage(pageCount);
|
|
168
|
+
}, "aria-disabled": page === pageCount, tabIndex: page === pageCount ? -1 : 0, children: pageCount }) }, pageCount));
|
|
169
|
+
}
|
|
170
|
+
return items;
|
|
171
|
+
}
|
|
172
|
+
return (jsxRuntimeExports.jsx(PaginationRoot, { className: className, ...navProps, children: jsxRuntimeExports.jsxs(PaginationContent, { device: "mobile", children: [jsxRuntimeExports.jsx(PaginationItem, { children: jsxRuntimeExports.jsx(PaginationPrevious, { href: "#", onClick: (e) => {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
if (page > 1)
|
|
175
|
+
changePage(page - 1);
|
|
176
|
+
}, variant: "nextPrev", device: device, "aria-disabled": page === 1, tabIndex: page === 1 ? -1 : 0 }) }), renderPages(), jsxRuntimeExports.jsx(PaginationItem, { children: jsxRuntimeExports.jsx(PaginationNext, { href: "#", onClick: (e) => {
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
if (page < pageCount)
|
|
179
|
+
changePage(page + 1);
|
|
180
|
+
}, variant: "nextPrev", device: device, "aria-disabled": page === pageCount, tabIndex: page === pageCount ? -1 : 0 }) })] }) }));
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export { Pagination };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from './jsx-runtime-BiC2V0nk.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { canUseComponents } from './licensing.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Higher-order component that protects components with license validation
|
|
7
|
+
*/
|
|
8
|
+
function withLicenseProtection(Component, componentName) {
|
|
9
|
+
const ProtectedComponent = React.forwardRef((props, ref) => {
|
|
10
|
+
if (!canUseComponents()) {
|
|
11
|
+
// Return a placeholder component with error styling
|
|
12
|
+
return (jsxRuntimeExports.jsxs("div", { style: {
|
|
13
|
+
padding: '16px',
|
|
14
|
+
border: '2px dashed #ef4444',
|
|
15
|
+
borderRadius: '8px',
|
|
16
|
+
backgroundColor: '#fef2f2',
|
|
17
|
+
color: '#dc2626',
|
|
18
|
+
textAlign: 'center',
|
|
19
|
+
fontFamily: 'system-ui, sans-serif',
|
|
20
|
+
fontSize: '14px',
|
|
21
|
+
maxWidth: '400px',
|
|
22
|
+
margin: '16px auto',
|
|
23
|
+
}, children: [jsxRuntimeExports.jsx("div", { style: { fontWeight: 'bold', marginBottom: '8px' }, children: "\uD83D\uDD12 License Required" }), jsxRuntimeExports.jsxs("div", { style: { marginBottom: '8px' }, children: ["Component \"", componentName, "\" requires a valid license key."] }), jsxRuntimeExports.jsx("div", { style: { fontSize: '12px', opacity: 0.8 }, children: "Please initialize Automoby Kit with your license key before using components." })] }));
|
|
24
|
+
}
|
|
25
|
+
// If license is valid, render the actual component
|
|
26
|
+
// Use type assertion to handle the generic component props properly
|
|
27
|
+
return jsxRuntimeExports.jsx(Component, { ...props, ref: ref });
|
|
28
|
+
});
|
|
29
|
+
ProtectedComponent.displayName = `Protected(${componentName})`;
|
|
30
|
+
return ProtectedComponent;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { withLicenseProtection };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from './jsx-runtime-BiC2V0nk.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import cn from './utils.js';
|
|
4
|
+
|
|
5
|
+
const RadioButton = ({ selected, disabled, isMobile, }) => {
|
|
6
|
+
const size = isMobile ? 'size-5' : 'size-6';
|
|
7
|
+
if (selected) {
|
|
8
|
+
return (jsxRuntimeExports.jsxs("div", { className: cn('relative flex items-center justify-center', size), children: [jsxRuntimeExports.jsx("div", { className: cn('absolute inset-0 rounded-full border-2', disabled
|
|
9
|
+
? 'bg-neutral-light border-neutral-light'
|
|
10
|
+
: 'bg-primary border-primary') }), jsxRuntimeExports.jsx("div", { className: cn('absolute rounded-full bg-white', isMobile ? 'inset-[5px]' : 'inset-1.5') })] }));
|
|
11
|
+
}
|
|
12
|
+
return (jsxRuntimeExports.jsx("div", { className: cn('relative flex items-center justify-center', size), children: jsxRuntimeExports.jsx("div", { className: cn('absolute inset-0 rounded-full border', isMobile ? 'border' : 'border-[1.5px]', disabled ? 'border-neutral-light' : 'border-midnight') }) }));
|
|
13
|
+
};
|
|
14
|
+
const RadioOptionComponent = ({ option, selected, disabled, onClick, name, isMobile, }) => {
|
|
15
|
+
const [isHovered, setIsHovered] = React.useState(false);
|
|
16
|
+
const handleKeyDown = (e) => {
|
|
17
|
+
if ((e.key === 'Enter' || e.key === ' ') && !disabled) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
onClick();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const getBackgroundColor = () => {
|
|
23
|
+
if (disabled)
|
|
24
|
+
return 'bg-neutral-lighter';
|
|
25
|
+
if (selected)
|
|
26
|
+
return 'bg-primary-lightest';
|
|
27
|
+
if (isHovered)
|
|
28
|
+
return 'bg-primary-lightest/20';
|
|
29
|
+
return 'bg-white';
|
|
30
|
+
};
|
|
31
|
+
const getBorderColor = () => {
|
|
32
|
+
if (selected)
|
|
33
|
+
return 'border-primary';
|
|
34
|
+
return 'border-transparent';
|
|
35
|
+
};
|
|
36
|
+
const getTextColor = () => {
|
|
37
|
+
if (disabled)
|
|
38
|
+
return 'text-midnight';
|
|
39
|
+
if (selected)
|
|
40
|
+
return 'text-primary';
|
|
41
|
+
return 'text-neutral-dark';
|
|
42
|
+
};
|
|
43
|
+
const getShadow = () => {
|
|
44
|
+
if (disabled)
|
|
45
|
+
return '';
|
|
46
|
+
return 'shadow-[0px_2px_4px_0px_rgba(0,0,0,0.08)]';
|
|
47
|
+
};
|
|
48
|
+
return (jsxRuntimeExports.jsx("div", { className: cn('relative rounded-lg border-[1.5px] cursor-pointer transition-all duration-200', getBackgroundColor(), getBorderColor(), getShadow(), disabled && 'cursor-not-allowed'), onClick: disabled ? undefined : onClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onKeyDown: handleKeyDown, tabIndex: disabled ? -1 : 0, role: "radio", "aria-checked": selected, "aria-disabled": disabled, children: jsxRuntimeExports.jsx("div", { className: "flex flex-row items-center justify-end relative w-full", children: jsxRuntimeExports.jsx("div", { className: cn('box-border flex flex-row items-center justify-end relative w-full', isMobile ? 'gap-2 px-4 py-3' : 'gap-4 px-6 py-4'), children: jsxRuntimeExports.jsxs("div", { className: cn('flex flex-row items-center justify-end p-0 relative shrink-0', isMobile ? 'gap-2' : 'gap-3'), children: [jsxRuntimeExports.jsx("input", { type: "radio", name: name, value: option.id, checked: selected, disabled: disabled, onChange: onClick, className: "sr-only", "aria-label": option.label }), jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-0.5 items-end justify-start p-0 relative shrink-0", children: jsxRuntimeExports.jsx("div", { className: cn('font-sans font-bold text-nowrap text-right transition-colors duration-200', isMobile
|
|
49
|
+
? 'text-[14px] leading-[24px]'
|
|
50
|
+
: 'text-[16px] leading-normal', getTextColor()), children: jsxRuntimeExports.jsx("p", { className: "whitespace-pre", dir: "auto", children: option.label }) }) }), option.icon && (jsxRuntimeExports.jsx("div", { className: cn('flex items-center justify-center shrink-0 transition-colors duration-200', isMobile ? 'size-6' : 'size-7', getTextColor()), children: option.icon })), jsxRuntimeExports.jsx("div", { className: "flex flex-col items-start justify-start p-0 relative shrink-0", children: jsxRuntimeExports.jsx(RadioButton, { selected: selected, disabled: disabled, isMobile: isMobile }) })] }) }) }) }));
|
|
51
|
+
};
|
|
52
|
+
const RadioGroup = React.forwardRef(({ options, value, onChange, name, disabled = false, className, isMobile, direction = 'vertical', ...props }, ref) => {
|
|
53
|
+
const handleOptionClick = (optionId) => {
|
|
54
|
+
if (!disabled && onChange) {
|
|
55
|
+
onChange(optionId);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const getContainerClasses = () => {
|
|
59
|
+
if (direction === 'horizontal') {
|
|
60
|
+
return cn('flex flex-row gap-2', isMobile ? 'flex-wrap' : 'flex-nowrap', className);
|
|
61
|
+
}
|
|
62
|
+
return cn('flex flex-col gap-2', className);
|
|
63
|
+
};
|
|
64
|
+
return (jsxRuntimeExports.jsx("div", { ref: ref, className: getContainerClasses(), role: "radiogroup", ...props, children: options.map((option) => (jsxRuntimeExports.jsx(RadioOptionComponent, { option: option, selected: value === option.id, disabled: disabled || option.disabled, onClick: () => handleOptionClick(option.id), name: name, isMobile: isMobile }, option.id))) }));
|
|
65
|
+
});
|
|
66
|
+
RadioGroup.displayName = 'RadioGroup';
|
|
67
|
+
|
|
68
|
+
export { RadioGroup };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from './jsx-runtime-BiC2V0nk.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import cn from './utils.js';
|
|
4
|
+
|
|
5
|
+
// Helper functions moved outside component
|
|
6
|
+
const handleTabClick = (tabId, disabled, onTabChange) => {
|
|
7
|
+
if (!disabled) {
|
|
8
|
+
onTabChange(tabId);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const handleKeyDown = (e, tabId, disabled, onTabChange) => {
|
|
12
|
+
if ((e.key === 'Enter' || e.key === ' ') && !disabled) {
|
|
13
|
+
e.preventDefault();
|
|
14
|
+
onTabChange(tabId);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const renderBadge = (count, isActive, disabled, isMobile) => {
|
|
18
|
+
if (count === undefined)
|
|
19
|
+
return null;
|
|
20
|
+
return (jsxRuntimeExports.jsx("div", { className: cn('flex items-center justify-center rounded-[5px] font-sans font-bold text-white', 'transition-colors duration-200', isMobile
|
|
21
|
+
? 'size-6 text-[14px] pt-0.5'
|
|
22
|
+
: 'size-[25px] text-[14px] pt-[3px]', disabled ? 'bg-midnight' : isActive ? 'bg-primary' : 'bg-neutral-main'), children: jsxRuntimeExports.jsx("p", { className: "leading-[24px] whitespace-pre", dir: "auto", children: count }) }));
|
|
23
|
+
};
|
|
24
|
+
const renderTabContent = (item, isActive, isMobile) => {
|
|
25
|
+
const hasCount = item.count !== undefined;
|
|
26
|
+
return (jsxRuntimeExports.jsxs("div", { className: cn('flex flex-row items-center justify-start transition-colors duration-200', isMobile ? 'gap-1.5' : 'gap-1.5'), children: [hasCount && renderBadge(item.count, isActive, item.disabled, isMobile), jsxRuntimeExports.jsx("div", { className: cn('font-sans text-nowrap text-right transition-colors duration-200', isMobile ? 'text-[14px]' : isActive ? 'text-[16px]' : 'text-[18px]', item.disabled
|
|
27
|
+
? 'font-normal text-midnight'
|
|
28
|
+
: isActive
|
|
29
|
+
? 'font-bold text-primary'
|
|
30
|
+
: 'font-normal text-neutral-main', isMobile
|
|
31
|
+
? 'leading-[24px]'
|
|
32
|
+
: isActive
|
|
33
|
+
? 'leading-normal'
|
|
34
|
+
: 'leading-[1.9]'), children: jsxRuntimeExports.jsx("p", { className: "whitespace-pre", dir: "auto", children: item.label }) })] }));
|
|
35
|
+
};
|
|
36
|
+
const renderTab = (item, activeTab, isMobile, onTabChange) => {
|
|
37
|
+
const isActive = item.id === activeTab;
|
|
38
|
+
return (jsxRuntimeExports.jsxs("div", { className: cn('box-border flex flex-col items-center justify-between relative shrink-0', 'cursor-pointer transition-all duration-200', isMobile ? 'h-12 px-3' : 'h-14 px-4', isActive
|
|
39
|
+
? isMobile
|
|
40
|
+
? 'pt-[11px] pb-0'
|
|
41
|
+
: 'pt-3.5 pb-0'
|
|
42
|
+
: 'py-0 justify-center', item.disabled && 'cursor-not-allowed opacity-50', !item.disabled && 'hover:opacity-80'), onClick: () => handleTabClick(item.id, item.disabled, onTabChange), onKeyDown: (e) => handleKeyDown(e, item.id, item.disabled, onTabChange), tabIndex: item.disabled ? -1 : 0, role: "tab", "aria-selected": isActive, "aria-disabled": item.disabled, children: [renderTabContent(item, isActive, isMobile), isActive && (jsxRuntimeExports.jsx("div", { className: "bg-primary h-1 rounded-tl-[8px] rounded-tr-[8px] shrink-0 w-full" }))] }, item.id));
|
|
43
|
+
};
|
|
44
|
+
const Tabs = React.forwardRef(({ items, activeTab, onTabChange, className, isMobile, ...props }, ref) => {
|
|
45
|
+
return (jsxRuntimeExports.jsxs("div", { ref: ref, className: cn('relative w-full', className), ...props, children: [jsxRuntimeExports.jsx("div", { className: "box-border flex flex-row items-center justify-end p-0 relative w-full", children: items.map((item) => renderTab(item, activeTab, isMobile, onTabChange)) }), jsxRuntimeExports.jsx("div", { className: "absolute border-midnight-light border-[0px_0px_1px] border-solid bottom-[-0.5px] left-0 right-0 top-0 pointer-events-none" })] }));
|
|
46
|
+
});
|
|
47
|
+
Tabs.displayName = 'Tabs';
|
|
48
|
+
|
|
49
|
+
export { Tabs };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from './utils.js';
|
|
3
|
+
|
|
4
|
+
const variantClasses = {
|
|
5
|
+
// Headings with Fat weight (900)
|
|
6
|
+
h1: 'text-[36px] font-[var(--font-weight-fat)]',
|
|
7
|
+
h2: 'text-[32px] font-[var(--font-weight-fat)]',
|
|
8
|
+
h3: 'text-[28px] font-[var(--font-weight-fat)]',
|
|
9
|
+
h4: 'text-[24px] font-[var(--font-weight-heavy)]',
|
|
10
|
+
h5: 'text-[22px] font-[var(--font-weight-heavy)]',
|
|
11
|
+
h6: 'text-[20px] font-[var(--font-weight-heavy)]',
|
|
12
|
+
// Body Copy with specific weight variants
|
|
13
|
+
'body-xl-heavy': 'text-[20px] font-[var(--font-weight-heavy)]',
|
|
14
|
+
'body-l-heavy': 'text-[18px] font-[var(--font-weight-heavy)]',
|
|
15
|
+
'body-l-bold': 'text-[18px] font-[var(--font-weight-bold)]',
|
|
16
|
+
'body-l-medium': 'text-[18px] font-[var(--font-weight-medium)]',
|
|
17
|
+
'body-m-heavy': 'text-[16px] font-[var(--font-weight-heavy)]',
|
|
18
|
+
'body-m-bold': 'text-[16px] font-[var(--font-weight-bold)]',
|
|
19
|
+
'body-m-medium': 'text-[16px] font-[var(--font-weight-medium)]',
|
|
20
|
+
'body-s-heavy': 'text-[14px] font-[var(--font-weight-heavy)]',
|
|
21
|
+
'body-s-bold': 'text-[14px] font-[var(--font-weight-bold)]',
|
|
22
|
+
'body-s-medium': 'text-[14px] font-[var(--font-weight-medium)]',
|
|
23
|
+
'body-ms-bold': 'text-[13px] font-[var(--font-weight-bold)]',
|
|
24
|
+
'body-ms-medium': 'text-[13px] font-[var(--font-weight-medium)]',
|
|
25
|
+
'body-xs-bold': 'text-[12px] font-[var(--font-weight-bold)]',
|
|
26
|
+
'body-xs-medium': 'text-[12px] font-[var(--font-weight-medium)]',
|
|
27
|
+
'body-t-bold': 'text-[10px] font-[var(--font-weight-bold)]',
|
|
28
|
+
'body-t-medium': 'text-[10px] font-[var(--font-weight-medium)]',
|
|
29
|
+
'body-ss-medium': 'text-[9px] font-[var(--font-weight-medium)]',
|
|
30
|
+
};
|
|
31
|
+
// Export for reuse in other components
|
|
32
|
+
const getTypographyClasses = (variant) => {
|
|
33
|
+
return variantClasses[variant];
|
|
34
|
+
};
|
|
35
|
+
const colorClasses = {
|
|
36
|
+
primary: 'text-[var(--color-primary)]',
|
|
37
|
+
secondary: 'text-[var(--color-secondary)]',
|
|
38
|
+
'neutral-darker': 'text-[var(--color-neutral-darker)]',
|
|
39
|
+
'neutral-dark': 'text-[var(--color-neutral-dark)]',
|
|
40
|
+
'neutral-main': 'text-[var(--color-neutral-main)]',
|
|
41
|
+
white: 'text-[var(--color-white)]',
|
|
42
|
+
inherit: 'text-inherit',
|
|
43
|
+
};
|
|
44
|
+
const getDefaultElement = (variant) => {
|
|
45
|
+
if (variant.startsWith('h'))
|
|
46
|
+
return variant.split('-')[0]; // h1, h2, etc.
|
|
47
|
+
return 'p';
|
|
48
|
+
};
|
|
49
|
+
const Typography = React.forwardRef(({ variant = 'body-m-medium', color = 'inherit', as, className, children, ...props }, ref) => {
|
|
50
|
+
const Element = as || getDefaultElement(variant);
|
|
51
|
+
return React.createElement(Element, {
|
|
52
|
+
ref,
|
|
53
|
+
className: cn(variantClasses[variant], colorClasses[color], 'leading-[var(--leading-default)]', // 180% line height
|
|
54
|
+
className),
|
|
55
|
+
...props,
|
|
56
|
+
}, children);
|
|
57
|
+
});
|
|
58
|
+
Typography.displayName = 'Typography';
|
|
59
|
+
|
|
60
|
+
export { Typography, getTypographyClasses };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { c as createLucideIcon } from './createLucideIcon-D-q73LTT.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license lucide-react v0.522.0 - ISC
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the ISC license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const __iconNode = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
|
|
12
|
+
const ChevronLeft = createLucideIcon("chevron-left", __iconNode);
|
|
13
|
+
|
|
14
|
+
export { ChevronLeft as C };
|
|
@@ -9,5 +9,4 @@ interface MobileProviderProps {
|
|
|
9
9
|
}
|
|
10
10
|
declare const MobileContext: import("react").Context<MobileContextValue | undefined>;
|
|
11
11
|
export declare const MobileProvider: React.FC<MobileProviderProps>;
|
|
12
|
-
export declare const useMobile: (isMobile?: boolean) => MobileContextValue;
|
|
13
12
|
export default MobileContext;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MobileProvider
|
|
1
|
+
export { MobileProvider } from './MobileContext';
|
|
2
2
|
export { default as MobileContext } from './MobileContext';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { forwardRef, createElement } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license lucide-react v0.522.0 - ISC
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the ISC license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
11
|
+
const toCamelCase = (string) => string.replace(
|
|
12
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
13
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
14
|
+
);
|
|
15
|
+
const toPascalCase = (string) => {
|
|
16
|
+
const camelCase = toCamelCase(string);
|
|
17
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
18
|
+
};
|
|
19
|
+
const mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
20
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
21
|
+
}).join(" ").trim();
|
|
22
|
+
const hasA11yProp = (props) => {
|
|
23
|
+
for (const prop in props) {
|
|
24
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @license lucide-react v0.522.0 - ISC
|
|
32
|
+
*
|
|
33
|
+
* This source code is licensed under the ISC license.
|
|
34
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
var defaultAttributes = {
|
|
38
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
+
width: 24,
|
|
40
|
+
height: 24,
|
|
41
|
+
viewBox: "0 0 24 24",
|
|
42
|
+
fill: "none",
|
|
43
|
+
stroke: "currentColor",
|
|
44
|
+
strokeWidth: 2,
|
|
45
|
+
strokeLinecap: "round",
|
|
46
|
+
strokeLinejoin: "round"
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @license lucide-react v0.522.0 - ISC
|
|
51
|
+
*
|
|
52
|
+
* This source code is licensed under the ISC license.
|
|
53
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
const Icon = forwardRef(
|
|
58
|
+
({
|
|
59
|
+
color = "currentColor",
|
|
60
|
+
size = 24,
|
|
61
|
+
strokeWidth = 2,
|
|
62
|
+
absoluteStrokeWidth,
|
|
63
|
+
className = "",
|
|
64
|
+
children,
|
|
65
|
+
iconNode,
|
|
66
|
+
...rest
|
|
67
|
+
}, ref) => createElement(
|
|
68
|
+
"svg",
|
|
69
|
+
{
|
|
70
|
+
ref,
|
|
71
|
+
...defaultAttributes,
|
|
72
|
+
width: size,
|
|
73
|
+
height: size,
|
|
74
|
+
stroke: color,
|
|
75
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
76
|
+
className: mergeClasses("lucide", className),
|
|
77
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
78
|
+
...rest
|
|
79
|
+
},
|
|
80
|
+
[
|
|
81
|
+
...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
|
|
82
|
+
...Array.isArray(children) ? children : [children]
|
|
83
|
+
]
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @license lucide-react v0.522.0 - ISC
|
|
89
|
+
*
|
|
90
|
+
* This source code is licensed under the ISC license.
|
|
91
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
const createLucideIcon = (iconName, iconNode) => {
|
|
96
|
+
const Component = forwardRef(
|
|
97
|
+
({ className, ...props }, ref) => createElement(Icon, {
|
|
98
|
+
ref,
|
|
99
|
+
iconNode,
|
|
100
|
+
className: mergeClasses(
|
|
101
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
102
|
+
`lucide-${iconName}`,
|
|
103
|
+
className
|
|
104
|
+
),
|
|
105
|
+
...props
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
Component.displayName = toPascalCase(iconName);
|
|
109
|
+
return Component;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export { createLucideIcon as c };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare const Accordion: import("react").ForwardRefExoticComponent<Omit<i
|
|
|
19
19
|
export declare const Divider: import("react").ForwardRefExoticComponent<Omit<import("./components/Divider/Divider").DividerProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<unknown>>;
|
|
20
20
|
export declare const RadioGroup: import("react").ForwardRefExoticComponent<Omit<import("./components/RadioGroup/RadioGroup").RadioGroupProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<unknown>>;
|
|
21
21
|
export declare const Chips: import("react").ForwardRefExoticComponent<Omit<import("./components/Chips/Chips").ChipsProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<unknown>>;
|
|
22
|
+
export declare const Menu: import("react").ForwardRefExoticComponent<Omit<import("./components/Menu/Menu").MenuProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<unknown>>;
|
|
22
23
|
export type { TypographyProps, TypographyVariant, } from './components/Typography/Typography';
|
|
23
24
|
export type { ButtonProps, ButtonVariant, ButtonSize, } from './components/Button/Button';
|
|
24
25
|
export type { InputProps } from './components/Input/Input';
|
|
@@ -31,4 +32,5 @@ export type { AccordionProps } from './components/Accordion/Accordion';
|
|
|
31
32
|
export type { DividerProps } from './components/Divider/Divider';
|
|
32
33
|
export type { RadioGroupProps, RadioOption, } from './components/RadioGroup/RadioGroup';
|
|
33
34
|
export type { ChipsProps } from './components/Chips/Chips';
|
|
34
|
-
export {
|
|
35
|
+
export type { MenuProps, MenuItem } from './components/Menu/Menu';
|
|
36
|
+
export { MobileProvider } from './contexts/MobileContext';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { withLicenseProtection } from './ProtectedComponent.js';
|
|
2
|
+
import { Typography as Typography$1 } from './Typography.js';
|
|
3
|
+
import { Button as Button$1 } from './Button.js';
|
|
4
|
+
import { Input as Input$1 } from './Input.js';
|
|
5
|
+
import { Tabs as Tabs$1 } from './Tabs.js';
|
|
6
|
+
import { Drawer as Drawer$1 } from './Drawer.js';
|
|
7
|
+
import { Backdrop as Backdrop$1 } from './Backdrop.js';
|
|
8
|
+
import { Breadcrumb as Breadcrumb$1 } from './Breadcrumb.js';
|
|
9
|
+
import { Pagination as Pagination$1 } from './Pagination.js';
|
|
10
|
+
import { Accordion as Accordion$1 } from './Accordion.js';
|
|
11
|
+
import { Divider as Divider$1 } from './Divider.js';
|
|
12
|
+
import { RadioGroup as RadioGroup$1 } from './RadioGroup.js';
|
|
13
|
+
import { Chips as Chips$1 } from './Chips.js';
|
|
14
|
+
import { Menu as Menu$1 } from './Menu.js';
|
|
15
|
+
export { initializeAutomobiKit } from './licensing.js';
|
|
16
|
+
export { M as MobileProvider } from './MobileContext-BkG7_94E.js';
|
|
17
|
+
import './jsx-runtime-BiC2V0nk.js';
|
|
18
|
+
import 'react';
|
|
19
|
+
import './utils.js';
|
|
20
|
+
import './chevron-left-Ck6O99eF.js';
|
|
21
|
+
import './createLucideIcon-D-q73LTT.js';
|
|
22
|
+
|
|
23
|
+
// Protected Components (license-wrapped)
|
|
24
|
+
const Typography = withLicenseProtection(Typography$1, 'Typography');
|
|
25
|
+
const Button = withLicenseProtection(Button$1, 'Button');
|
|
26
|
+
const Input = withLicenseProtection(Input$1, 'Input');
|
|
27
|
+
const Tabs = withLicenseProtection(Tabs$1, 'Tabs');
|
|
28
|
+
const Drawer = withLicenseProtection(Drawer$1, 'Drawer');
|
|
29
|
+
const Backdrop = withLicenseProtection(Backdrop$1, 'Backdrop');
|
|
30
|
+
const Breadcrumb = withLicenseProtection(Breadcrumb$1, 'Breadcrumb');
|
|
31
|
+
const Pagination = withLicenseProtection(Pagination$1, 'Pagination');
|
|
32
|
+
const Accordion = withLicenseProtection(Accordion$1, 'Accordion');
|
|
33
|
+
const Divider = withLicenseProtection(Divider$1, 'Divider');
|
|
34
|
+
const RadioGroup = withLicenseProtection(RadioGroup$1, 'RadioGroup');
|
|
35
|
+
const Chips = withLicenseProtection(Chips$1, 'Chips');
|
|
36
|
+
const Menu = withLicenseProtection(Menu$1, 'Menu');
|
|
37
|
+
|
|
38
|
+
export { Accordion, Backdrop, Breadcrumb, Button, Chips, Divider, Drawer, Input, Menu, Pagination, RadioGroup, Tabs, Typography };
|