automoby-kit 1.0.12 → 1.0.13
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 +7 -71
- package/dist/cjs/Accordion.js +59 -1
- package/dist/cjs/Backdrop.js +26 -1
- package/dist/cjs/Breadcrumb.js +61 -1
- package/dist/cjs/Button.js +48 -1
- package/dist/cjs/Chips.js +117 -1
- package/dist/cjs/Divider.js +23 -1
- package/dist/cjs/Drawer.js +112 -1
- package/dist/cjs/Input.js +84 -1
- package/dist/cjs/Menu.js +122 -1
- package/dist/cjs/Pagination.js +188 -1
- package/dist/cjs/RadioGroup.js +73 -1
- package/dist/cjs/Tabs.js +54 -1
- package/dist/cjs/Typography.js +63 -1
- package/dist/cjs/chevron-left-COj1qGVo.js +16 -0
- package/dist/{types → cjs}/components/Accordion/Accordion.d.ts +2 -2
- package/dist/{types → cjs}/components/Breadcrumb/Breadcrumb.d.ts +2 -2
- package/dist/{types → cjs}/components/Chips/Chips.d.ts +5 -5
- package/dist/{types → cjs}/components/Drawer/Drawer.d.ts +2 -2
- package/dist/{types → cjs}/components/Input/Input.d.ts +4 -4
- package/dist/{types → cjs}/components/Input/Input.stories.d.ts +1 -1
- package/dist/{types → cjs}/components/Pagination/Pagination.d.ts +2 -2
- package/dist/{types → cjs}/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/dist/cjs/components/Select/Select.d.ts +17 -0
- package/dist/cjs/components/Select/Select.stories.d.ts +104 -0
- package/dist/{types → cjs}/components/Tabs/Tabs.d.ts +2 -2
- package/dist/{types → cjs}/contexts/MobileContext.d.ts +1 -0
- package/dist/cjs/contexts.js +1491 -1
- package/dist/cjs/createLucideIcon-BTjFFtDc.js +114 -0
- package/dist/cjs/index.d.ts +34 -0
- package/dist/cjs/index.js +52 -1
- package/dist/cjs/utils.js +9 -1
- package/dist/esm/Accordion.js +57 -1
- package/dist/esm/Backdrop.js +24 -1
- package/dist/esm/Breadcrumb.js +59 -1
- package/dist/esm/Button.js +46 -1
- package/dist/esm/Chips.js +112 -1
- package/dist/esm/Divider.js +21 -1
- package/dist/esm/Drawer.js +110 -1
- package/dist/esm/Input.js +82 -1
- package/dist/esm/Menu.js +120 -1
- package/dist/esm/Pagination.js +186 -1
- package/dist/esm/RadioGroup.js +71 -1
- package/dist/esm/Tabs.js +52 -1
- package/dist/esm/Typography.js +60 -1
- package/dist/esm/components/Accordion/Accordion.d.ts +25 -0
- package/dist/esm/components/Accordion/Accordion.stories.d.ts +175 -0
- package/dist/esm/components/Backdrop/Backdrop.d.ts +20 -0
- package/dist/esm/components/Backdrop/Backdrop.stories.d.ts +9 -0
- package/dist/esm/components/Breadcrumb/Breadcrumb.d.ts +16 -0
- package/dist/esm/components/Breadcrumb/Breadcrumb.stories.d.ts +177 -0
- package/dist/esm/components/Button/Button.d.ts +13 -0
- package/dist/esm/components/Button/Button.stories.d.ts +100 -0
- package/dist/esm/components/Chips/Chips.d.ts +37 -0
- package/dist/esm/components/Chips/Chips.stories.d.ts +90 -0
- package/dist/esm/components/Divider/Divider.d.ts +25 -0
- package/dist/esm/components/Divider/Divider.stories.d.ts +88 -0
- package/dist/esm/components/Drawer/Drawer.d.ts +16 -0
- package/dist/esm/components/Drawer/Drawer.stories.d.ts +128 -0
- package/dist/esm/components/Input/Input.d.ts +24 -0
- package/dist/esm/components/Input/Input.stories.d.ts +131 -0
- package/dist/esm/components/Menu/Menu.d.ts +39 -0
- package/dist/esm/components/Menu/Menu.stories.d.ts +89 -0
- package/dist/esm/components/Pagination/Pagination.d.ts +12 -0
- package/dist/esm/components/Pagination/Pagination.stories.d.ts +76 -0
- package/dist/esm/components/RadioGroup/RadioGroup.d.ts +55 -0
- package/dist/esm/components/RadioGroup/RadioGroup.stories.d.ts +86 -0
- package/dist/esm/components/Select/Select.d.ts +17 -0
- package/dist/esm/components/Select/Select.stories.d.ts +104 -0
- package/dist/esm/components/Tabs/Tabs.d.ts +43 -0
- package/dist/esm/components/Tabs/Tabs.stories.d.ts +66 -0
- package/dist/esm/components/Typography/Typography.d.ts +9 -0
- package/dist/esm/components/Typography/Typography.stories.d.ts +57 -0
- package/dist/esm/contexts/MobileContext.d.ts +13 -0
- package/dist/esm/contexts.js +1485 -1
- package/dist/esm/index.d.ts +34 -0
- package/dist/esm/index.js +37 -1
- package/dist/esm/utils/cn.d.ts +2 -0
- package/dist/esm/utils.js +7 -1
- package/package.json +2 -7
- package/dist/cjs/ProtectedComponent.js +0 -1
- package/dist/cjs/licensing.js +0 -1
- package/dist/esm/ProtectedComponent.js +0 -1
- package/dist/esm/licensing.js +0 -1
- package/dist/types/Accordion.js +0 -54
- package/dist/types/Backdrop.js +0 -24
- package/dist/types/Breadcrumb.js +0 -56
- package/dist/types/Button.js +0 -46
- package/dist/types/Chips.js +0 -109
- package/dist/types/Divider.js +0 -21
- package/dist/types/Drawer.js +0 -107
- package/dist/types/Input.js +0 -78
- package/dist/types/Menu.js +0 -120
- package/dist/types/Pagination.js +0 -183
- package/dist/types/ProtectedComponent.js +0 -33
- package/dist/types/RadioGroup.js +0 -68
- package/dist/types/Tabs.js +0 -49
- package/dist/types/Typography.js +0 -60
- package/dist/types/components/ProtectedComponent.d.ts +0 -5
- package/dist/types/contexts.js +0 -1478
- package/dist/types/index.d.ts +0 -36
- package/dist/types/index.js +0 -38
- package/dist/types/licensing/LicenseManager.d.ts +0 -41
- package/dist/types/licensing/index.d.ts +0 -30
- package/dist/types/licensing.js +0 -125
- package/dist/types/utils.js +0 -7
- /package/dist/{types → cjs}/components/Accordion/Accordion.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Backdrop/Backdrop.d.ts +0 -0
- /package/dist/{types → cjs}/components/Backdrop/Backdrop.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Breadcrumb/Breadcrumb.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Button/Button.d.ts +0 -0
- /package/dist/{types → cjs}/components/Button/Button.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Chips/Chips.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Divider/Divider.d.ts +0 -0
- /package/dist/{types → cjs}/components/Divider/Divider.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Drawer/Drawer.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Menu/Menu.d.ts +0 -0
- /package/dist/{types → cjs}/components/Menu/Menu.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Pagination/Pagination.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/RadioGroup/RadioGroup.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Tabs/Tabs.stories.d.ts +0 -0
- /package/dist/{types → cjs}/components/Typography/Typography.d.ts +0 -0
- /package/dist/{types → cjs}/components/Typography/Typography.stories.d.ts +0 -0
- /package/dist/{types → cjs}/utils/cn.d.ts +0 -0
- /package/dist/{types → esm}/chevron-left-Ck6O99eF.js +0 -0
- /package/dist/{types → esm}/createLucideIcon-D-q73LTT.js +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Automoby Kit
|
|
2
2
|
|
|
3
|
-
A comprehensive React UI component library
|
|
3
|
+
A comprehensive React UI component library - created in war 2025.
|
|
4
4
|
|
|
5
5
|
## 🚀 Installation
|
|
6
6
|
|
|
@@ -8,42 +8,16 @@ A comprehensive React UI component library with built-in licensing system.
|
|
|
8
8
|
npm install automoby-kit
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## 🔑 License Initialization (Required)
|
|
12
|
-
|
|
13
|
-
**Important**: You must initialize Automoby Kit with a valid license key before using any components.
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { initializeAutomobiKit } from 'automoby-kit';
|
|
17
|
-
|
|
18
|
-
// Initialize with your license key (call this once at the start of your app)
|
|
19
|
-
const success = initializeAutomobiKit({
|
|
20
|
-
key: 'your-license-key-here'
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
if (success) {
|
|
24
|
-
console.log('✅ Automoby Kit initialized successfully');
|
|
25
|
-
} else {
|
|
26
|
-
console.error('❌ Failed to initialize Automoby Kit');
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
11
|
## 📦 Usage
|
|
30
12
|
|
|
31
|
-
After successful initialization, you can use any component:
|
|
32
|
-
|
|
33
13
|
```typescript
|
|
34
14
|
import {
|
|
35
15
|
Button,
|
|
36
16
|
Typography,
|
|
37
17
|
Input,
|
|
38
|
-
Tabs
|
|
39
|
-
initializeAutomobiKit
|
|
18
|
+
Tabs
|
|
40
19
|
} from 'automoby-kit';
|
|
41
20
|
|
|
42
|
-
// Initialize first
|
|
43
|
-
initializeAutomobiKit({
|
|
44
|
-
key: '-------------------'
|
|
45
|
-
});
|
|
46
|
-
|
|
47
21
|
function App() {
|
|
48
22
|
return (
|
|
49
23
|
<div>
|
|
@@ -71,38 +45,7 @@ function App() {
|
|
|
71
45
|
- **Divider** - Visual separators
|
|
72
46
|
- **RadioGroup** - Radio button groups
|
|
73
47
|
- **Chips** - Tag-like elements
|
|
74
|
-
|
|
75
|
-
## 🔧 License Management Functions
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
import {
|
|
79
|
-
initializeAutomobiKit,
|
|
80
|
-
getLicenseStatus,
|
|
81
|
-
canUseComponents
|
|
82
|
-
} from 'automoby-kit';
|
|
83
|
-
|
|
84
|
-
// Check if components can be used
|
|
85
|
-
const canUse = canUseComponents();
|
|
86
|
-
|
|
87
|
-
// Get detailed license status
|
|
88
|
-
const status = getLicenseStatus();
|
|
89
|
-
console.log(status);
|
|
90
|
-
// {
|
|
91
|
-
// initialized: true,
|
|
92
|
-
// valid: true,
|
|
93
|
-
// key: "automoby-..."
|
|
94
|
-
// }
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## ⚠️ What Happens Without a Valid License?
|
|
98
|
-
|
|
99
|
-
If you try to use components without proper initialization or with an invalid key, you'll see a license error component instead of the actual component:
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
🔒 License Required
|
|
103
|
-
Component "Button" requires a valid license key.
|
|
104
|
-
Please initialize Automoby Kit with your license key before using components.
|
|
105
|
-
```
|
|
48
|
+
- **Menu** - Context menus and dropdowns
|
|
106
49
|
|
|
107
50
|
## 🏗️ TypeScript Support
|
|
108
51
|
|
|
@@ -129,8 +72,6 @@ function App() {
|
|
|
129
72
|
<MyComponent />
|
|
130
73
|
</MobileProvider>
|
|
131
74
|
);
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
75
|
}
|
|
135
76
|
```
|
|
136
77
|
|
|
@@ -147,18 +88,13 @@ This package requires the following peer dependencies:
|
|
|
147
88
|
}
|
|
148
89
|
```
|
|
149
90
|
|
|
150
|
-
## 📄 License
|
|
151
|
-
|
|
152
|
-
This is a commercial package. You need a valid license key to use it in production.
|
|
153
|
-
|
|
154
91
|
## 🆘 Support
|
|
155
92
|
|
|
156
|
-
If you
|
|
93
|
+
If you have issues:
|
|
157
94
|
|
|
158
|
-
1.
|
|
159
|
-
2.
|
|
160
|
-
3. Make sure you're calling `initializeAutomobiKit()` before using any components
|
|
95
|
+
1. Check the [GitHub issues](https://github.com/yourusername/automoby-kit/issues) for known problems
|
|
96
|
+
2. Submit a new issue with detailed information about your problem
|
|
161
97
|
|
|
162
98
|
## 🔄 Version History
|
|
163
99
|
|
|
164
|
-
- **1.0.0** - Initial release
|
|
100
|
+
- **1.0.0** - Initial release
|
package/dist/cjs/Accordion.js
CHANGED
|
@@ -1 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
var contexts = require('./contexts.js');
|
|
7
|
+
var Typography = require('./Typography.js');
|
|
8
|
+
var createLucideIcon = require('./createLucideIcon-BTjFFtDc.js');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @license lucide-react v0.522.0 - ISC
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the ISC license.
|
|
14
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const __iconNode$1 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
19
|
+
const ChevronDown = createLucideIcon.createLucideIcon("chevron-down", __iconNode$1);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @license lucide-react v0.522.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const __iconNode = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
30
|
+
const ChevronUp = createLucideIcon.createLucideIcon("chevron-up", __iconNode);
|
|
31
|
+
|
|
32
|
+
const Accordion = React.forwardRef(({ title, body, startIcon, isExpanded: controlledExpanded, onToggle, defaultExpanded = false, className, id, disabled = false, isMobile, ...props }, ref) => {
|
|
33
|
+
const detectedIsMobile = contexts.useMobile();
|
|
34
|
+
const actualIsMobile = isMobile ?? detectedIsMobile;
|
|
35
|
+
const [internalExpanded, setInternalExpanded] = React.useState(defaultExpanded);
|
|
36
|
+
// Use controlled state if provided, otherwise use internal state
|
|
37
|
+
const isExpanded = controlledExpanded !== undefined ? controlledExpanded : internalExpanded;
|
|
38
|
+
const handleToggle = () => {
|
|
39
|
+
if (disabled)
|
|
40
|
+
return;
|
|
41
|
+
const newExpanded = !isExpanded;
|
|
42
|
+
if (controlledExpanded === undefined) {
|
|
43
|
+
setInternalExpanded(newExpanded);
|
|
44
|
+
}
|
|
45
|
+
onToggle?.(newExpanded);
|
|
46
|
+
};
|
|
47
|
+
const accordionId = id || `accordion-${Math.random().toString(36).substr(2, 9)}`;
|
|
48
|
+
const headerId = `${accordionId}-header`;
|
|
49
|
+
const contentId = `${accordionId}-content`;
|
|
50
|
+
// Icon size based on device
|
|
51
|
+
const iconSize = actualIsMobile ? 20 : 24;
|
|
52
|
+
// Typography variants based on device
|
|
53
|
+
const titleVariant = actualIsMobile ? 'body-s-heavy' : 'body-l-heavy';
|
|
54
|
+
const bodyVariant = actualIsMobile ? 'body-s-medium' : 'body-m-medium';
|
|
55
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: utils('rounded-2xl border-0 overflow-hidden', 'transition-all duration-200 ease-in-out', className), ...props, children: [jsxRuntime.jsxs("button", { id: headerId, type: "button", onClick: handleToggle, disabled: disabled, "aria-expanded": isExpanded, "aria-controls": contentId, className: utils('w-full flex items-center justify-between', actualIsMobile ? 'p-3' : 'p-4', 'focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2', 'disabled:opacity-50 disabled:cursor-not-allowed', 'transition-all duration-200 ease-in-out', !disabled && 'hover:bg-neutral-lighter'), children: [jsxRuntime.jsx("div", { className: "flex-shrink-0 mr-4", children: isExpanded ? (jsxRuntime.jsx(ChevronUp, { size: iconSize, className: "text-neutral-darker transition-transform duration-200", "aria-hidden": "true" })) : (jsxRuntime.jsx(ChevronDown, { size: iconSize, className: "text-neutral-darker transition-transform duration-200", "aria-hidden": "true" })) }), jsxRuntime.jsxs("div", { className: utils('flex items-center flex-1', actualIsMobile ? 'gap-3' : 'gap-4'), children: [jsxRuntime.jsx("div", { className: "flex-1 text-right", children: jsxRuntime.jsx(Typography.Typography, { variant: titleVariant, color: "neutral-darker", children: title }) }), startIcon && (jsxRuntime.jsx("div", { className: utils('flex-shrink-0 flex items-center justify-center', actualIsMobile ? 'w-6 h-6' : 'w-8 h-8'), children: startIcon }))] })] }), jsxRuntime.jsx("div", { id: contentId, role: "region", "aria-labelledby": headerId, className: utils('w-full overflow-hidden transition-all duration-300 ease-in-out', isExpanded ? 'max-h-screen opacity-100' : 'max-h-0 opacity-0'), children: jsxRuntime.jsx("div", { className: utils(actualIsMobile ? 'pb-3 mt-1' : 'pb-4 mt-1.5'), children: jsxRuntime.jsx("div", { className: utils('bg-neutral-lighter rounded-lg', actualIsMobile ? 'p-3' : 'p-4'), children: jsxRuntime.jsx(Typography.Typography, { variant: bodyVariant, color: "neutral-dark", children: body }) }) }) })] }));
|
|
56
|
+
});
|
|
57
|
+
Accordion.displayName = 'Accordion';
|
|
58
|
+
|
|
59
|
+
exports.Accordion = Accordion;
|
package/dist/cjs/Backdrop.js
CHANGED
|
@@ -1 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
|
|
7
|
+
const Backdrop = React.forwardRef(({ isOpen = false, onClick, blur = false, zIndex = 51, className, children, ...props }, ref) => {
|
|
8
|
+
const handleClick = (event) => {
|
|
9
|
+
if (onClick && event.target === event.currentTarget) {
|
|
10
|
+
onClick();
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const backdropClasses = utils('fixed inset-0 transition-all duration-300', {
|
|
14
|
+
'opacity-100 pointer-events-auto': isOpen,
|
|
15
|
+
'opacity-0 pointer-events-none': !isOpen,
|
|
16
|
+
'backdrop-blur-sm': blur,
|
|
17
|
+
}, className);
|
|
18
|
+
const backdropStyle = {
|
|
19
|
+
backgroundColor: 'rgba(0, 0, 0, 0.60)',
|
|
20
|
+
zIndex,
|
|
21
|
+
};
|
|
22
|
+
return (jsxRuntime.jsx("div", { ref: ref, className: backdropClasses, style: backdropStyle, onClick: handleClick, role: "presentation", "aria-hidden": !isOpen, ...props, children: children }));
|
|
23
|
+
});
|
|
24
|
+
Backdrop.displayName = 'Backdrop';
|
|
25
|
+
|
|
26
|
+
exports.Backdrop = Backdrop;
|
package/dist/cjs/Breadcrumb.js
CHANGED
|
@@ -1 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
var contexts = require('./contexts.js');
|
|
7
|
+
var chevronLeft = require('./chevron-left-COj1qGVo.js');
|
|
8
|
+
require('./createLucideIcon-BTjFFtDc.js');
|
|
9
|
+
|
|
10
|
+
const Breadcrumb = React.forwardRef(({ items, className, isMobile }, ref) => {
|
|
11
|
+
const detectedIsMobile = contexts.useMobile();
|
|
12
|
+
const actualIsMobile = isMobile ?? detectedIsMobile;
|
|
13
|
+
const handleItemClick = (item, index, e) => {
|
|
14
|
+
// Don't make the last item (current page) clickable
|
|
15
|
+
if (index === items.length - 1)
|
|
16
|
+
return;
|
|
17
|
+
if (item.onClick) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
item.onClick();
|
|
20
|
+
}
|
|
21
|
+
// If item has href, let the anchor tag handle navigation naturally
|
|
22
|
+
};
|
|
23
|
+
return (jsxRuntime.jsx("nav", { ref: ref, className: utils(
|
|
24
|
+
// Base layout - RTL with flex-row-reverse to show items right to left
|
|
25
|
+
'flex flex-row-reverse items-center',
|
|
26
|
+
// Responsive gap and padding based on mobile state
|
|
27
|
+
actualIsMobile ? 'gap-1 px-4 py-2.5' : 'gap-3 pr-1 pt-3 pb-4 pl-0', className), "aria-label": "Breadcrumb navigation", children: jsxRuntime.jsx("ol", { className: "flex flex-row-reverse items-center gap-inherit", children: items.map((item, index) => {
|
|
28
|
+
const isLast = index === items.length - 1;
|
|
29
|
+
const isClickable = !isLast && (item.href || item.onClick);
|
|
30
|
+
const itemKey = `${item.label}-${index}`;
|
|
31
|
+
return (jsxRuntime.jsxs("li", { className: "flex items-center gap-inherit", children: [isClickable ? (jsxRuntime.jsx("a", { href: item.href || '#', className: utils(
|
|
32
|
+
// Base styles
|
|
33
|
+
'whitespace-nowrap border-0 bg-transparent p-0 no-underline',
|
|
34
|
+
// Responsive font size based on mobile state
|
|
35
|
+
actualIsMobile ? 'text-t' : 'text-s',
|
|
36
|
+
// Color
|
|
37
|
+
'text-neutral-main',
|
|
38
|
+
// Cursor and hover effects for clickable items
|
|
39
|
+
'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) => {
|
|
40
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
if (item.onClick) {
|
|
43
|
+
item.onClick();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, "aria-label": `Go to ${item.label}`, children: item.label })) : (jsxRuntime.jsx("span", { className: utils(
|
|
47
|
+
// Base styles
|
|
48
|
+
'whitespace-nowrap',
|
|
49
|
+
// Responsive font size based on mobile state
|
|
50
|
+
actualIsMobile ? 'text-t' : 'text-s',
|
|
51
|
+
// Color
|
|
52
|
+
'text-neutral-main',
|
|
53
|
+
// Different styles for current page (last item)
|
|
54
|
+
'font-medium'), "aria-current": isLast ? 'page' : undefined, "aria-label": isLast ? `Current page: ${item.label}` : undefined, children: item.label })), !isLast && (jsxRuntime.jsx(chevronLeft.ChevronLeft, { className: utils('text-black flex-shrink-0',
|
|
55
|
+
// Responsive icon size
|
|
56
|
+
actualIsMobile ? 'w-2.5 h-2.5' : 'w-3 h-3'), "aria-hidden": "true" }))] }, itemKey));
|
|
57
|
+
}) }) }));
|
|
58
|
+
});
|
|
59
|
+
Breadcrumb.displayName = 'Breadcrumb';
|
|
60
|
+
|
|
61
|
+
exports.Breadcrumb = Breadcrumb;
|
package/dist/cjs/Button.js
CHANGED
|
@@ -1 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
var Typography = require('./Typography.js');
|
|
7
|
+
|
|
8
|
+
const sizeClasses = {
|
|
9
|
+
sm: 'px-[16px] py-[7px]',
|
|
10
|
+
md: 'px-[16px] py-[9px]',
|
|
11
|
+
lg: 'px-[16px] py-[13px]',
|
|
12
|
+
xl: 'px-[20px] py-[13px]',
|
|
13
|
+
};
|
|
14
|
+
const defaultTextVariants = {
|
|
15
|
+
sm: 'body-s-bold', // 14px / Bold (600)
|
|
16
|
+
md: 'body-m-bold', // 16px / Bold (600)
|
|
17
|
+
lg: 'body-l-bold', // 18px / Bold (600)
|
|
18
|
+
xl: 'body-xl-heavy', // 20px / Heavy (700)
|
|
19
|
+
};
|
|
20
|
+
const variantClasses = {
|
|
21
|
+
primary: `
|
|
22
|
+
bg-[var(--color-primary)] text-white
|
|
23
|
+
hover:bg-[var(--color-primary-dark)]
|
|
24
|
+
disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]
|
|
25
|
+
`,
|
|
26
|
+
secondary: `
|
|
27
|
+
bg-[var(--color-primary-lightest)] text-[var(--color-primary)]
|
|
28
|
+
hover:bg-[var(--color-primary-lighter)]
|
|
29
|
+
disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]
|
|
30
|
+
`,
|
|
31
|
+
tertiary: `
|
|
32
|
+
bg-white border border-[var(--color-primary-light)] text-[var(--color-primary)]
|
|
33
|
+
hover:bg-[var(--color-neutral-lighter)]
|
|
34
|
+
disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]
|
|
35
|
+
`,
|
|
36
|
+
ghost: `
|
|
37
|
+
bg-transparent text-[var(--color-primary)]
|
|
38
|
+
hover:bg-[var(--color-primary-lightest)]
|
|
39
|
+
disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]
|
|
40
|
+
`,
|
|
41
|
+
};
|
|
42
|
+
const Button = React.forwardRef(({ className, variant = 'primary', size = 'md', icon, iconPosition = 'right', children, loading = false, disabled, textVariant, ...props }, ref) => {
|
|
43
|
+
const finalTextVariant = textVariant || defaultTextVariants[size];
|
|
44
|
+
return (jsxRuntime.jsxs("button", { ref: ref, type: "button", className: utils('inline-flex items-center justify-center rounded-[8px] transition-colors duration-200', sizeClasses[size], variantClasses[variant], Typography.getTypographyClasses(finalTextVariant), disabled && 'opacity-50 pointer-events-none', className), disabled: disabled || loading, ...props, children: [icon && iconPosition === 'left' && (jsxRuntime.jsx("span", { className: "mr-2 flex items-center", children: icon })), loading ? '...' : children, icon && iconPosition === 'right' && (jsxRuntime.jsx("span", { className: "ml-2 flex items-center", children: icon }))] }));
|
|
45
|
+
});
|
|
46
|
+
Button.displayName = 'Button';
|
|
47
|
+
|
|
48
|
+
exports.Button = Button;
|
package/dist/cjs/Chips.js
CHANGED
|
@@ -1 +1,117 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var utils = require('./utils.js');
|
|
8
|
+
var contexts = require('./contexts.js');
|
|
9
|
+
var createLucideIcon = require('./createLucideIcon-BTjFFtDc.js');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license lucide-react v0.522.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
const __iconNode = [
|
|
20
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
21
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
22
|
+
];
|
|
23
|
+
const X = createLucideIcon.createLucideIcon("x", __iconNode);
|
|
24
|
+
|
|
25
|
+
const chipVariants = {
|
|
26
|
+
purple: {
|
|
27
|
+
background: 'bg-[var(--color-primary-lightest)]',
|
|
28
|
+
text: 'text-[var(--color-primary-darkest)]',
|
|
29
|
+
border: 'border-[var(--color-primary-light)]',
|
|
30
|
+
},
|
|
31
|
+
red: {
|
|
32
|
+
background: 'bg-[var(--color-error-light)]',
|
|
33
|
+
text: 'text-[var(--color-error)]',
|
|
34
|
+
border: 'border-[#f0d6d6]',
|
|
35
|
+
},
|
|
36
|
+
green: {
|
|
37
|
+
background: 'bg-[var(--color-success-light)]',
|
|
38
|
+
text: 'text-[var(--color-success)]',
|
|
39
|
+
border: 'border-[#d4e8dc]',
|
|
40
|
+
},
|
|
41
|
+
orange: {
|
|
42
|
+
background: 'bg-[var(--color-warning-light)]',
|
|
43
|
+
text: 'text-[var(--color-warning)]',
|
|
44
|
+
border: 'border-[#f5e1d1]',
|
|
45
|
+
},
|
|
46
|
+
blue: {
|
|
47
|
+
background: 'bg-[var(--color-info-light)]',
|
|
48
|
+
text: 'text-[var(--color-info)]',
|
|
49
|
+
border: 'border-[#d3e9f2]',
|
|
50
|
+
},
|
|
51
|
+
white: {
|
|
52
|
+
background: 'bg-[var(--color-white)]',
|
|
53
|
+
text: 'text-[var(--color-neutral-darker)]',
|
|
54
|
+
border: 'border-[var(--color-neutral-light)]',
|
|
55
|
+
},
|
|
56
|
+
disabled: {
|
|
57
|
+
background: 'bg-[var(--color-neutral-lighter)]',
|
|
58
|
+
text: 'text-[var(--color-neutral-main)]',
|
|
59
|
+
border: 'border-[var(--color-neutral-light)]',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const chipSizes = {
|
|
63
|
+
mobile: {
|
|
64
|
+
padding: 'px-2.5 py-1',
|
|
65
|
+
gap: 'gap-1',
|
|
66
|
+
iconSize: 'size-4',
|
|
67
|
+
fontSize: 'text-[12px]',
|
|
68
|
+
lineHeight: 'leading-[1.8]',
|
|
69
|
+
},
|
|
70
|
+
desktop: {
|
|
71
|
+
padding: 'px-3 py-1',
|
|
72
|
+
gap: 'gap-1.5',
|
|
73
|
+
iconSize: 'size-5',
|
|
74
|
+
fontSize: 'text-[14px]',
|
|
75
|
+
lineHeight: 'leading-[24px]',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
const Chips = React.forwardRef(({ variant = 'purple', size, children = 'متن پیشفرض', disabled = false, onClick, onIconClick, className, isMobile, ...props }, ref) => {
|
|
79
|
+
const detectedIsMobile = contexts.useMobile();
|
|
80
|
+
const actualIsMobile = isMobile ?? detectedIsMobile;
|
|
81
|
+
const actualSize = size || (actualIsMobile ? 'mobile' : 'desktop');
|
|
82
|
+
const actualVariant = disabled ? 'disabled' : variant;
|
|
83
|
+
const variantStyles = chipVariants[actualVariant];
|
|
84
|
+
const sizeStyles = chipSizes[actualSize];
|
|
85
|
+
const handleIconClick = (e) => {
|
|
86
|
+
e.stopPropagation();
|
|
87
|
+
if (onIconClick) {
|
|
88
|
+
onIconClick();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const handleKeyDown = (e) => {
|
|
92
|
+
if ((e.key === 'Enter' || e.key === ' ') && onClick && !disabled) {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
onClick();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const renderIcon = () => {
|
|
98
|
+
const iconElement = jsxRuntime.jsx(X, { className: utils(sizeStyles.iconSize) });
|
|
99
|
+
if (onIconClick) {
|
|
100
|
+
return (jsxRuntime.jsx("button", { type: "button", onClick: handleIconClick, disabled: disabled, className: utils('flex items-center justify-center', 'hover:opacity-70 transition-opacity', disabled && 'cursor-not-allowed opacity-50'), "aria-label": "\u062D\u0630\u0641", children: iconElement }));
|
|
101
|
+
}
|
|
102
|
+
return iconElement;
|
|
103
|
+
};
|
|
104
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: utils(
|
|
105
|
+
// Base styles
|
|
106
|
+
'relative rounded-[50px] border border-solid inline-flex', 'flex-row items-center justify-center', 'font-sans font-bold not-italic', 'text-nowrap text-right', 'transition-all duration-200',
|
|
107
|
+
// Variant styles
|
|
108
|
+
variantStyles.background, variantStyles.text, variantStyles.border,
|
|
109
|
+
// Size styles
|
|
110
|
+
sizeStyles.padding, sizeStyles.gap, sizeStyles.fontSize, sizeStyles.lineHeight,
|
|
111
|
+
// Interactive styles
|
|
112
|
+
onClick && !disabled && 'cursor-pointer hover:opacity-80', disabled && 'cursor-not-allowed opacity-60', className), onClick: disabled ? undefined : onClick, onKeyDown: onClick && !disabled ? handleKeyDown : undefined, tabIndex: onClick && !disabled ? 0 : undefined, role: onClick ? 'button' : undefined, ...props, children: [jsxRuntime.jsx("span", { className: "text-center", children: children }), renderIcon()] }));
|
|
113
|
+
});
|
|
114
|
+
Chips.displayName = 'Chips';
|
|
115
|
+
|
|
116
|
+
exports.Chips = Chips;
|
|
117
|
+
exports.default = Chips;
|
package/dist/cjs/Divider.js
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
|
|
7
|
+
const Divider = React.forwardRef(({ width = '100%', height = 1, orientation = 'horizontal', variant = 'neutral-light', className, style, ...props }, ref) => {
|
|
8
|
+
const isHorizontal = orientation === 'horizontal';
|
|
9
|
+
const variantClasses = {
|
|
10
|
+
'neutral-light': 'bg-neutral-light',
|
|
11
|
+
'neutral-main': 'bg-neutral-main',
|
|
12
|
+
primary: 'bg-primary',
|
|
13
|
+
};
|
|
14
|
+
const dividerStyle = {
|
|
15
|
+
width: isHorizontal ? width : height,
|
|
16
|
+
height: isHorizontal ? height : width,
|
|
17
|
+
...style,
|
|
18
|
+
};
|
|
19
|
+
return (jsxRuntime.jsx("div", { ref: ref, className: utils('shrink-0', variantClasses[variant], className), style: dividerStyle, role: "separator", ...props }));
|
|
20
|
+
});
|
|
21
|
+
Divider.displayName = 'Divider';
|
|
22
|
+
|
|
23
|
+
exports.Divider = Divider;
|
package/dist/cjs/Drawer.js
CHANGED
|
@@ -1 +1,112 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('./utils.js');
|
|
6
|
+
var contexts = require('./contexts.js');
|
|
7
|
+
|
|
8
|
+
const Drawer = React.forwardRef(({ children, direction = 'bottom', fullScreen = false, isOpen = false, onClose, className, isMobile, ...props }, ref) => {
|
|
9
|
+
const detectedIsMobile = contexts.useMobile();
|
|
10
|
+
const actualIsMobile = isMobile ?? detectedIsMobile;
|
|
11
|
+
const overlayRef = React.useRef(null);
|
|
12
|
+
const drawerRef = React.useRef(null);
|
|
13
|
+
// Handle escape key
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
const handleEscape = (event) => {
|
|
16
|
+
if (event.key === 'Escape' && isOpen && onClose) {
|
|
17
|
+
onClose();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
if (isOpen) {
|
|
21
|
+
document.addEventListener('keydown', handleEscape);
|
|
22
|
+
// Prevent body scroll when drawer is open
|
|
23
|
+
document.body.style.overflow = 'hidden';
|
|
24
|
+
}
|
|
25
|
+
return () => {
|
|
26
|
+
document.removeEventListener('keydown', handleEscape);
|
|
27
|
+
document.body.style.overflow = 'auto';
|
|
28
|
+
};
|
|
29
|
+
}, [isOpen, onClose]);
|
|
30
|
+
// Handle click outside
|
|
31
|
+
const handleOverlayClick = (event) => {
|
|
32
|
+
if (!fullScreen &&
|
|
33
|
+
onClose &&
|
|
34
|
+
overlayRef.current &&
|
|
35
|
+
event.target === overlayRef.current) {
|
|
36
|
+
onClose();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
// Handle keyboard events on overlay
|
|
40
|
+
const handleOverlayKeyDown = (event) => {
|
|
41
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
42
|
+
if (!fullScreen &&
|
|
43
|
+
onClose &&
|
|
44
|
+
overlayRef.current &&
|
|
45
|
+
event.target === overlayRef.current) {
|
|
46
|
+
onClose();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const getTranslateClasses = () => {
|
|
51
|
+
if (!isOpen) {
|
|
52
|
+
switch (direction) {
|
|
53
|
+
case 'top':
|
|
54
|
+
return '-translate-y-full';
|
|
55
|
+
case 'bottom':
|
|
56
|
+
return 'translate-y-full';
|
|
57
|
+
case 'left':
|
|
58
|
+
return '-translate-x-full';
|
|
59
|
+
case 'right':
|
|
60
|
+
return 'translate-x-full';
|
|
61
|
+
default:
|
|
62
|
+
return 'translate-y-full';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return 'translate-x-0 translate-y-0';
|
|
66
|
+
};
|
|
67
|
+
const getPositionClasses = () => {
|
|
68
|
+
switch (direction) {
|
|
69
|
+
case 'top':
|
|
70
|
+
return 'top-0 left-0 right-0';
|
|
71
|
+
case 'bottom':
|
|
72
|
+
return 'bottom-0 left-0 right-0';
|
|
73
|
+
case 'left':
|
|
74
|
+
return 'top-0 left-0 bottom-0';
|
|
75
|
+
case 'right':
|
|
76
|
+
return 'top-0 right-0 bottom-0';
|
|
77
|
+
default:
|
|
78
|
+
return 'bottom-0 left-0 right-0';
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const getSizeClasses = () => {
|
|
82
|
+
const isVertical = direction === 'top' || direction === 'bottom';
|
|
83
|
+
if (fullScreen) {
|
|
84
|
+
return isVertical ? 'w-full h-full' : 'w-full h-full';
|
|
85
|
+
}
|
|
86
|
+
if (isVertical) {
|
|
87
|
+
return 'w-full max-h-[90vh]';
|
|
88
|
+
}
|
|
89
|
+
return 'h-full max-w-[90vw]';
|
|
90
|
+
};
|
|
91
|
+
const baseOverlayClasses = 'fixed inset-0 z-50 transition-all duration-300';
|
|
92
|
+
const baseDrawerClasses = 'fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto';
|
|
93
|
+
const overlayClasses = utils(baseOverlayClasses, {
|
|
94
|
+
'bg-neutral-darker/50 backdrop-blur-sm': isOpen,
|
|
95
|
+
'bg-transparent pointer-events-none': !isOpen,
|
|
96
|
+
});
|
|
97
|
+
const drawerClasses = utils(baseDrawerClasses, getPositionClasses(), getSizeClasses(), getTranslateClasses(), {
|
|
98
|
+
'rounded-t-2xl': direction === 'bottom' && !fullScreen,
|
|
99
|
+
'rounded-b-2xl': direction === 'top' && !fullScreen,
|
|
100
|
+
'rounded-r-2xl': direction === 'left' && !fullScreen,
|
|
101
|
+
'rounded-l-2xl': direction === 'right' && !fullScreen,
|
|
102
|
+
'p-6': !actualIsMobile,
|
|
103
|
+
'p-4': actualIsMobile,
|
|
104
|
+
}, className);
|
|
105
|
+
if (!isOpen) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
return (jsxRuntime.jsx("div", { ref: overlayRef, className: overlayClasses, onClick: handleOverlayClick, onKeyDown: handleOverlayKeyDown, tabIndex: -1, role: "button", "aria-label": "Close drawer", children: jsxRuntime.jsx("div", { ref: ref || drawerRef, className: drawerClasses, role: "dialog", "aria-modal": "true", "aria-label": "Drawer", ...props, children: children }) }));
|
|
109
|
+
});
|
|
110
|
+
Drawer.displayName = 'Drawer';
|
|
111
|
+
|
|
112
|
+
exports.Drawer = Drawer;
|