automoby-kit 1.0.2 → 1.0.4
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/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-Cmx8hQxY.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-BtGMRo2b.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/{index.esm.js → types/MobileContext-D-Cbqeno.js} +3 -1519
- 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/components/Accordion/Accordion.d.ts +2 -2
- package/dist/types/components/Accordion/Accordion.stories.d.ts +10 -9
- package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +4 -1
- package/dist/types/components/Breadcrumb/Breadcrumb.stories.d.ts +4 -3
- package/dist/types/components/Chips/Chips.d.ts +2 -2
- package/dist/types/components/Drawer/Drawer.d.ts +4 -0
- package/dist/types/components/Drawer/Drawer.stories.d.ts +21 -8
- package/dist/types/components/Input/Input.d.ts +8 -0
- package/dist/types/components/Input/Input.stories.d.ts +1 -0
- package/dist/types/components/Pagination/Pagination.d.ts +4 -0
- package/dist/types/components/Pagination/Pagination.stories.d.ts +17 -2
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/dist/types/components/Tabs/Tabs.d.ts +2 -2
- package/dist/types/contexts.js +3 -0
- package/dist/types/createLucideIcon-D-q73LTT.js +112 -0
- package/dist/types/index.d.ts +3 -0
- 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 +93 -4
- package/dist/index.cjs.js +0 -3019
|
@@ -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 };
|
|
@@ -18,8 +18,8 @@ export interface AccordionProps {
|
|
|
18
18
|
id?: string;
|
|
19
19
|
/** Whether the accordion is disabled */
|
|
20
20
|
disabled?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/** Whether the component is in mobile mode */
|
|
22
|
+
isMobile: boolean;
|
|
23
23
|
}
|
|
24
24
|
declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
25
|
export { Accordion };
|
|
@@ -44,11 +44,12 @@ declare const _default: {
|
|
|
44
44
|
type: string;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
isMobile: {
|
|
48
48
|
name: string;
|
|
49
49
|
control: {
|
|
50
50
|
type: string;
|
|
51
51
|
};
|
|
52
|
+
description: string;
|
|
52
53
|
};
|
|
53
54
|
startIcon: {
|
|
54
55
|
table: {
|
|
@@ -77,7 +78,7 @@ export declare const Default: {
|
|
|
77
78
|
startIconType: string;
|
|
78
79
|
defaultExpanded: boolean;
|
|
79
80
|
disabled: boolean;
|
|
80
|
-
|
|
81
|
+
isMobile: boolean;
|
|
81
82
|
};
|
|
82
83
|
};
|
|
83
84
|
export declare const Mobile: {
|
|
@@ -89,7 +90,7 @@ export declare const Mobile: {
|
|
|
89
90
|
startIconType: string;
|
|
90
91
|
defaultExpanded: boolean;
|
|
91
92
|
disabled: boolean;
|
|
92
|
-
|
|
93
|
+
isMobile: boolean;
|
|
93
94
|
};
|
|
94
95
|
};
|
|
95
96
|
export declare const Desktop: {
|
|
@@ -101,7 +102,7 @@ export declare const Desktop: {
|
|
|
101
102
|
body: string;
|
|
102
103
|
startIconType: string;
|
|
103
104
|
disabled: boolean;
|
|
104
|
-
|
|
105
|
+
isMobile: boolean;
|
|
105
106
|
};
|
|
106
107
|
};
|
|
107
108
|
export declare const ExpandedByDefault: {
|
|
@@ -113,7 +114,7 @@ export declare const ExpandedByDefault: {
|
|
|
113
114
|
body: string;
|
|
114
115
|
startIconType: string;
|
|
115
116
|
disabled: boolean;
|
|
116
|
-
|
|
117
|
+
isMobile: boolean;
|
|
117
118
|
};
|
|
118
119
|
};
|
|
119
120
|
export declare const Disabled: {
|
|
@@ -125,7 +126,7 @@ export declare const Disabled: {
|
|
|
125
126
|
body: string;
|
|
126
127
|
startIconType: string;
|
|
127
128
|
defaultExpanded: boolean;
|
|
128
|
-
|
|
129
|
+
isMobile: boolean;
|
|
129
130
|
};
|
|
130
131
|
};
|
|
131
132
|
export declare const WithDifferentIcons: {
|
|
@@ -137,7 +138,7 @@ export declare const WithDifferentIcons: {
|
|
|
137
138
|
startIconType: string;
|
|
138
139
|
defaultExpanded: boolean;
|
|
139
140
|
disabled: boolean;
|
|
140
|
-
|
|
141
|
+
isMobile: boolean;
|
|
141
142
|
};
|
|
142
143
|
};
|
|
143
144
|
export declare const MultipleAccordions: {
|
|
@@ -157,7 +158,7 @@ export declare const Controlled: {
|
|
|
157
158
|
startIconType: string;
|
|
158
159
|
defaultExpanded: boolean;
|
|
159
160
|
disabled: boolean;
|
|
160
|
-
|
|
161
|
+
isMobile: boolean;
|
|
161
162
|
};
|
|
162
163
|
};
|
|
163
164
|
export declare const LongContent: {
|
|
@@ -169,6 +170,6 @@ export declare const LongContent: {
|
|
|
169
170
|
startIconType: string;
|
|
170
171
|
defaultExpanded: boolean;
|
|
171
172
|
disabled: boolean;
|
|
172
|
-
|
|
173
|
+
isMobile: boolean;
|
|
173
174
|
};
|
|
174
175
|
};
|
|
@@ -7,7 +7,10 @@ export interface BreadcrumbItem {
|
|
|
7
7
|
export interface BreadcrumbProps {
|
|
8
8
|
items: BreadcrumbItem[];
|
|
9
9
|
className?: string;
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Whether the component is in mobile mode
|
|
12
|
+
*/
|
|
13
|
+
isMobile: boolean;
|
|
11
14
|
}
|
|
12
15
|
declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
|
|
13
16
|
export { Breadcrumb };
|
|
@@ -25,7 +25,7 @@ declare const _default: {
|
|
|
25
25
|
};
|
|
26
26
|
description: string;
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
isMobile: {
|
|
29
29
|
name: string;
|
|
30
30
|
control: {
|
|
31
31
|
type: string;
|
|
@@ -43,6 +43,7 @@ declare const _default: {
|
|
|
43
43
|
href?: undefined;
|
|
44
44
|
onClick?: undefined;
|
|
45
45
|
})[];
|
|
46
|
+
isMobile: boolean;
|
|
46
47
|
};
|
|
47
48
|
};
|
|
48
49
|
export default _default;
|
|
@@ -146,7 +147,7 @@ export declare const DesktopView: {
|
|
|
146
147
|
(args: StoryArgs): import("react/jsx-runtime").JSX.Element;
|
|
147
148
|
storyName: string;
|
|
148
149
|
args: {
|
|
149
|
-
|
|
150
|
+
isMobile: boolean;
|
|
150
151
|
items: ({
|
|
151
152
|
label: string;
|
|
152
153
|
onClick: () => void;
|
|
@@ -160,7 +161,7 @@ export declare const MobileView: {
|
|
|
160
161
|
(args: StoryArgs): import("react/jsx-runtime").JSX.Element;
|
|
161
162
|
storyName: string;
|
|
162
163
|
args: {
|
|
163
|
-
|
|
164
|
+
isMobile: boolean;
|
|
164
165
|
items: ({
|
|
165
166
|
label: string;
|
|
166
167
|
onClick: () => void;
|
|
@@ -29,9 +29,9 @@ export interface ChipsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
29
29
|
*/
|
|
30
30
|
className?: string;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Whether the component is in mobile mode
|
|
33
33
|
*/
|
|
34
|
-
isMobile
|
|
34
|
+
isMobile: boolean;
|
|
35
35
|
}
|
|
36
36
|
export declare const Chips: React.ForwardRefExoticComponent<ChipsProps & React.RefAttributes<HTMLDivElement>>;
|
|
37
37
|
export default Chips;
|
|
@@ -7,6 +7,10 @@ export type DrawerProps = {
|
|
|
7
7
|
isOpen?: boolean;
|
|
8
8
|
onClose?: () => void;
|
|
9
9
|
className?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the component is in mobile mode
|
|
12
|
+
*/
|
|
13
|
+
isMobile: boolean;
|
|
10
14
|
};
|
|
11
15
|
declare const Drawer: React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
16
|
export { Drawer };
|