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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const Typography: import("react").ForwardRefExoticComponent<import("./components/Typography/Typography").TypographyProps & import("react").RefAttributes<HTMLElement>>;
|
|
2
|
+
export declare const Button: import("react").ForwardRefExoticComponent<import("./components/Button/Button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
3
|
+
export declare const Input: import("react").ForwardRefExoticComponent<{
|
|
4
|
+
state?: "default" | "disabled" | "error";
|
|
5
|
+
label: string;
|
|
6
|
+
helperText?: string;
|
|
7
|
+
startIcon?: import("react").ReactNode;
|
|
8
|
+
endIcon?: import("react").ReactNode;
|
|
9
|
+
isMobile?: boolean;
|
|
10
|
+
} & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "id"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
11
|
+
export declare const Tabs: import("react").ForwardRefExoticComponent<import("./components/Tabs/Tabs").TabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export declare const Drawer: import("react").ForwardRefExoticComponent<import("./components/Drawer/Drawer").DrawerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const Backdrop: import("react").ForwardRefExoticComponent<import("./components/Backdrop/Backdrop").BackdropProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare const Breadcrumb: import("react").ForwardRefExoticComponent<import("./components/Breadcrumb/Breadcrumb").BreadcrumbProps & import("react").RefAttributes<HTMLElement>>;
|
|
15
|
+
export declare const Pagination: import("react").FC<import("./components/Pagination/Pagination").UnifiedPaginationProps>;
|
|
16
|
+
export declare const Accordion: import("react").ForwardRefExoticComponent<import("./components/Accordion/Accordion").AccordionProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<import("./components/Divider/Divider").DividerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export declare const RadioGroup: import("react").ForwardRefExoticComponent<import("./components/RadioGroup/RadioGroup").RadioGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export declare const Chips: import("react").ForwardRefExoticComponent<import("./components/Chips/Chips").ChipsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export declare const Menu: import("react").ForwardRefExoticComponent<import("./components/Menu/Menu").MenuProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export type { TypographyProps, TypographyVariant, } from './components/Typography/Typography';
|
|
22
|
+
export type { ButtonProps, ButtonVariant, ButtonSize, } from './components/Button/Button';
|
|
23
|
+
export type { InputProps } from './components/Input/Input';
|
|
24
|
+
export type { TabsProps, TabItem } from './components/Tabs/Tabs';
|
|
25
|
+
export type { DrawerProps, DrawerDirection } from './components/Drawer/Drawer';
|
|
26
|
+
export type { BackdropProps } from './components/Backdrop/Backdrop';
|
|
27
|
+
export type { BreadcrumbProps, BreadcrumbItem, } from './components/Breadcrumb/Breadcrumb';
|
|
28
|
+
export type { UnifiedPaginationProps as PaginationProps } from './components/Pagination/Pagination';
|
|
29
|
+
export type { AccordionProps } from './components/Accordion/Accordion';
|
|
30
|
+
export type { DividerProps } from './components/Divider/Divider';
|
|
31
|
+
export type { RadioGroupProps, RadioOption, } from './components/RadioGroup/RadioGroup';
|
|
32
|
+
export type { ChipsProps } from './components/Chips/Chips';
|
|
33
|
+
export type { MenuProps, MenuItem } from './components/Menu/Menu';
|
|
34
|
+
export { MobileProvider } from './contexts/MobileContext';
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1,37 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { Typography as Typography$1 } from './Typography.js';
|
|
2
|
+
import { Button as Button$1 } from './Button.js';
|
|
3
|
+
import { Input as Input$1 } from './Input.js';
|
|
4
|
+
import { Tabs as Tabs$1 } from './Tabs.js';
|
|
5
|
+
import { Drawer as Drawer$1 } from './Drawer.js';
|
|
6
|
+
import { Backdrop as Backdrop$1 } from './Backdrop.js';
|
|
7
|
+
import { Breadcrumb as Breadcrumb$1 } from './Breadcrumb.js';
|
|
8
|
+
import { Pagination as Pagination$1 } from './Pagination.js';
|
|
9
|
+
import { Accordion as Accordion$1 } from './Accordion.js';
|
|
10
|
+
import { Divider as Divider$1 } from './Divider.js';
|
|
11
|
+
import { RadioGroup as RadioGroup$1 } from './RadioGroup.js';
|
|
12
|
+
import { Chips as Chips$1 } from './Chips.js';
|
|
13
|
+
import { Menu as Menu$1 } from './Menu.js';
|
|
14
|
+
export { MobileProvider } from './contexts.js';
|
|
15
|
+
import 'react';
|
|
16
|
+
import './utils.js';
|
|
17
|
+
import 'react/jsx-runtime';
|
|
18
|
+
import './chevron-left-Ck6O99eF.js';
|
|
19
|
+
import './createLucideIcon-D-q73LTT.js';
|
|
20
|
+
|
|
21
|
+
// Original Components (for internal use)
|
|
22
|
+
// Components (direct exports)
|
|
23
|
+
const Typography = Typography$1;
|
|
24
|
+
const Button = Button$1;
|
|
25
|
+
const Input = Input$1;
|
|
26
|
+
const Tabs = Tabs$1;
|
|
27
|
+
const Drawer = Drawer$1;
|
|
28
|
+
const Backdrop = Backdrop$1;
|
|
29
|
+
const Breadcrumb = Breadcrumb$1;
|
|
30
|
+
const Pagination = Pagination$1;
|
|
31
|
+
const Accordion = Accordion$1;
|
|
32
|
+
const Divider = Divider$1;
|
|
33
|
+
const RadioGroup = RadioGroup$1;
|
|
34
|
+
const Chips = Chips$1;
|
|
35
|
+
const Menu = Menu$1;
|
|
36
|
+
|
|
37
|
+
export { Accordion, Backdrop, Breadcrumb, Button, Chips, Divider, Drawer, Input, Menu, Pagination, RadioGroup, Tabs, Typography };
|
package/dist/esm/utils.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
function r(e){var
|
|
1
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
2
|
+
|
|
3
|
+
function cn(...inputs) {
|
|
4
|
+
return clsx(inputs);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export { cn as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "automoby-kit",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A comprehensive React UI component library
|
|
3
|
+
"version": "1.0.13",
|
|
4
|
+
"description": "A comprehensive React UI component library - created in war 2025",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
@@ -79,11 +79,6 @@
|
|
|
79
79
|
"require": "./dist/cjs/Menu.js",
|
|
80
80
|
"types": "./dist/types/components/Menu/Menu.d.ts"
|
|
81
81
|
},
|
|
82
|
-
"./licensing": {
|
|
83
|
-
"import": "./dist/esm/licensing.js",
|
|
84
|
-
"require": "./dist/cjs/licensing.js",
|
|
85
|
-
"types": "./dist/types/licensing/index.d.ts"
|
|
86
|
-
},
|
|
87
82
|
"./contexts": {
|
|
88
83
|
"import": "./dist/esm/contexts.js",
|
|
89
84
|
"require": "./dist/cjs/contexts.js",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),i=require("react"),t=require("./licensing.js");exports.withLicenseProtection=function(r,n){const s=i.forwardRef((i,s)=>t.canUseComponents()?e.jsx(r,{...i,ref:s}):e.jsxs("div",{style:{padding:"16px",border:"2px dashed #ef4444",borderRadius:"8px",backgroundColor:"#fef2f2",color:"#dc2626",textAlign:"center",fontFamily:"system-ui, sans-serif",fontSize:"14px",maxWidth:"400px",margin:"16px auto"},children:[e.jsx("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:"🔒 License Required"}),e.jsxs("div",{style:{marginBottom:"8px"},children:['Component "',n,'" requires a valid license key.']}),e.jsx("div",{style:{fontSize:"12px",opacity:.8},children:"Please initialize Automoby Kit with your license key before using components."})]}));return s.displayName=`Protected(${n})`,s};
|
package/dist/cjs/licensing.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";class i{static instance;isInitialized=!1;isValid=!1;licenseKey=null;validKeys=["automoby-kit-war-key-2025"];constructor(){}static getInstance(){return i.instance||(i.instance=new i),i.instance}initialize(i){try{return this.licenseKey=i.key,this.isValid=this.validateLicense(i.key),this.isInitialized=!0,this.isValid?(console.log("✅ Automoby Kit initialized successfully"),!0):(console.error("❌ Invalid license key provided for Automoby Kit"),!1)}catch(i){return console.error("❌ Failed to initialize Automoby Kit:",i),this.isValid=!1,this.isInitialized=!0,!1}}validateLicense(i){return!(!i||""===i.trim())&&this.validKeys.includes(i)}canUseComponents(){return this.isInitialized?!!this.isValid||(console.error("❌ Invalid license key. Please contact support or provide a valid license key."),!1):(console.error("❌ Automoby Kit not initialized. Please call initializeAutomobiKit() with your license key."),!1)}getLicenseStatus(){return{initialized:this.isInitialized,valid:this.isValid,key:this.licenseKey?`${this.licenseKey.substring(0,8)}...`:null}}reset(){this.isInitialized=!1,this.isValid=!1,this.licenseKey=null}}exports.canUseComponents=function(){return i.getInstance().canUseComponents()},exports.initializeAutomobiKit=function(e){return i.getInstance().initialize(e)};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i}from"react/jsx-runtime";import t from"react";import{canUseComponents as o}from"./licensing.js";function withLicenseProtection(r,n){const s=t.forwardRef((t,s)=>o()?i(r,{...t,ref:s}):e("div",{style:{padding:"16px",border:"2px dashed #ef4444",borderRadius:"8px",backgroundColor:"#fef2f2",color:"#dc2626",textAlign:"center",fontFamily:"system-ui, sans-serif",fontSize:"14px",maxWidth:"400px",margin:"16px auto"},children:[i("div",{style:{fontWeight:"bold",marginBottom:"8px"},children:"🔒 License Required"}),e("div",{style:{marginBottom:"8px"},children:['Component "',n,'" requires a valid license key.']}),i("div",{style:{fontSize:"12px",opacity:.8},children:"Please initialize Automoby Kit with your license key before using components."})]}));return s.displayName=`Protected(${n})`,s}export{withLicenseProtection};
|
package/dist/esm/licensing.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class i{static instance;isInitialized=!1;isValid=!1;licenseKey=null;validKeys=["automoby-kit-war-key-2025"];constructor(){}static getInstance(){return i.instance||(i.instance=new i),i.instance}initialize(i){try{return this.licenseKey=i.key,this.isValid=this.validateLicense(i.key),this.isInitialized=!0,this.isValid?(console.log("✅ Automoby Kit initialized successfully"),!0):(console.error("❌ Invalid license key provided for Automoby Kit"),!1)}catch(i){return console.error("❌ Failed to initialize Automoby Kit:",i),this.isValid=!1,this.isInitialized=!0,!1}}validateLicense(i){return!(!i||""===i.trim())&&this.validKeys.includes(i)}canUseComponents(){return this.isInitialized?!!this.isValid||(console.error("❌ Invalid license key. Please contact support or provide a valid license key."),!1):(console.error("❌ Automoby Kit not initialized. Please call initializeAutomobiKit() with your license key."),!1)}getLicenseStatus(){return{initialized:this.isInitialized,valid:this.isValid,key:this.licenseKey?`${this.licenseKey.substring(0,8)}...`:null}}reset(){this.isInitialized=!1,this.isValid=!1,this.licenseKey=null}}function initializeAutomobiKit(e){return i.getInstance().initialize(e)}function canUseComponents(){return i.getInstance().canUseComponents()}export{canUseComponents,initializeAutomobiKit};
|
package/dist/types/Accordion.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import cn from './utils.js';
|
|
4
|
-
import { Typography } from './Typography.js';
|
|
5
|
-
import { c as createLucideIcon } from './createLucideIcon-D-q73LTT.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$1 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
16
|
-
const ChevronDown = createLucideIcon("chevron-down", __iconNode$1);
|
|
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 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
27
|
-
const ChevronUp = createLucideIcon("chevron-up", __iconNode);
|
|
28
|
-
|
|
29
|
-
const Accordion = React.forwardRef(({ title, body, startIcon, isExpanded: controlledExpanded, onToggle, defaultExpanded = false, className, id, disabled = false, isMobile, ...props }, ref) => {
|
|
30
|
-
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
31
|
-
// Use controlled state if provided, otherwise use internal state
|
|
32
|
-
const isExpanded = controlledExpanded !== undefined ? controlledExpanded : internalExpanded;
|
|
33
|
-
const handleToggle = () => {
|
|
34
|
-
if (disabled)
|
|
35
|
-
return;
|
|
36
|
-
const newExpanded = !isExpanded;
|
|
37
|
-
if (controlledExpanded === undefined) {
|
|
38
|
-
setInternalExpanded(newExpanded);
|
|
39
|
-
}
|
|
40
|
-
onToggle?.(newExpanded);
|
|
41
|
-
};
|
|
42
|
-
const accordionId = id || `accordion-${Math.random().toString(36).substr(2, 9)}`;
|
|
43
|
-
const headerId = `${accordionId}-header`;
|
|
44
|
-
const contentId = `${accordionId}-content`;
|
|
45
|
-
// Icon size based on device
|
|
46
|
-
const iconSize = isMobile ? 20 : 24;
|
|
47
|
-
// Typography variants based on device
|
|
48
|
-
const titleVariant = isMobile ? 'body-s-heavy' : 'body-l-heavy';
|
|
49
|
-
const bodyVariant = isMobile ? 'body-s-medium' : 'body-m-medium';
|
|
50
|
-
return (jsxs("div", { ref: ref, className: cn('rounded-2xl border-0 overflow-hidden', 'transition-all duration-200 ease-in-out', className), ...props, children: [jsxs("button", { id: headerId, type: "button", onClick: handleToggle, disabled: disabled, "aria-expanded": isExpanded, "aria-controls": contentId, className: cn('w-full flex items-center justify-between', isMobile ? '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: [jsx("div", { className: "flex-shrink-0 mr-4", children: isExpanded ? (jsx(ChevronUp, { size: iconSize, className: "text-neutral-darker transition-transform duration-200", "aria-hidden": "true" })) : (jsx(ChevronDown, { size: iconSize, className: "text-neutral-darker transition-transform duration-200", "aria-hidden": "true" })) }), jsxs("div", { className: cn('flex items-center flex-1', isMobile ? 'gap-3' : 'gap-4'), children: [jsx("div", { className: "flex-1 text-right", children: jsx(Typography, { variant: titleVariant, color: "neutral-darker", children: title }) }), startIcon && (jsx("div", { className: cn('flex-shrink-0 flex items-center justify-center', isMobile ? 'w-6 h-6' : 'w-8 h-8'), children: startIcon }))] })] }), jsx("div", { id: contentId, role: "region", "aria-labelledby": headerId, className: cn('w-full overflow-hidden transition-all duration-300 ease-in-out', isExpanded ? 'max-h-screen opacity-100' : 'max-h-0 opacity-0'), children: jsx("div", { className: cn(isMobile ? 'pb-3 mt-1' : 'pb-4 mt-1.5'), children: jsx("div", { className: cn('bg-neutral-lighter rounded-lg', isMobile ? 'p-3' : 'p-4'), children: jsx(Typography, { variant: bodyVariant, color: "neutral-dark", children: body }) }) }) })] }));
|
|
51
|
-
});
|
|
52
|
-
Accordion.displayName = 'Accordion';
|
|
53
|
-
|
|
54
|
-
export { Accordion };
|
package/dist/types/Backdrop.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import cn from './utils.js';
|
|
4
|
-
|
|
5
|
-
const Backdrop = React.forwardRef(({ isOpen = false, onClick, blur = false, zIndex = 51, className, children, ...props }, ref) => {
|
|
6
|
-
const handleClick = (event) => {
|
|
7
|
-
if (onClick && event.target === event.currentTarget) {
|
|
8
|
-
onClick();
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
const backdropClasses = cn('fixed inset-0 transition-all duration-300', {
|
|
12
|
-
'opacity-100 pointer-events-auto': isOpen,
|
|
13
|
-
'opacity-0 pointer-events-none': !isOpen,
|
|
14
|
-
'backdrop-blur-sm': blur,
|
|
15
|
-
}, className);
|
|
16
|
-
const backdropStyle = {
|
|
17
|
-
backgroundColor: 'rgba(0, 0, 0, 0.60)',
|
|
18
|
-
zIndex,
|
|
19
|
-
};
|
|
20
|
-
return (jsx("div", { ref: ref, className: backdropClasses, style: backdropStyle, onClick: handleClick, role: "presentation", "aria-hidden": !isOpen, ...props, children: children }));
|
|
21
|
-
});
|
|
22
|
-
Backdrop.displayName = 'Backdrop';
|
|
23
|
-
|
|
24
|
-
export { Backdrop };
|
package/dist/types/Breadcrumb.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import cn from './utils.js';
|
|
4
|
-
import { C as ChevronLeft } from './chevron-left-Ck6O99eF.js';
|
|
5
|
-
import './createLucideIcon-D-q73LTT.js';
|
|
6
|
-
|
|
7
|
-
const Breadcrumb = React.forwardRef(({ items, className, isMobile }, ref) => {
|
|
8
|
-
const handleItemClick = (item, index, e) => {
|
|
9
|
-
// Don't make the last item (current page) clickable
|
|
10
|
-
if (index === items.length - 1)
|
|
11
|
-
return;
|
|
12
|
-
if (item.onClick) {
|
|
13
|
-
e.preventDefault();
|
|
14
|
-
item.onClick();
|
|
15
|
-
}
|
|
16
|
-
// If item has href, let the anchor tag handle navigation naturally
|
|
17
|
-
};
|
|
18
|
-
return (jsx("nav", { ref: ref, className: cn(
|
|
19
|
-
// Base layout - RTL with flex-row-reverse to show items right to left
|
|
20
|
-
'flex flex-row-reverse items-center',
|
|
21
|
-
// Responsive gap and padding based on mobile state
|
|
22
|
-
isMobile ? 'gap-1 px-4 py-2.5' : 'gap-3 pr-1 pt-3 pb-4 pl-0', className), "aria-label": "Breadcrumb navigation", children: jsx("ol", { className: "flex flex-row-reverse items-center gap-inherit", children: items.map((item, index) => {
|
|
23
|
-
const isLast = index === items.length - 1;
|
|
24
|
-
const isClickable = !isLast && (item.href || item.onClick);
|
|
25
|
-
const itemKey = `${item.label}-${index}`;
|
|
26
|
-
return (jsxs("li", { className: "flex items-center gap-inherit", children: [isClickable ? (jsx("a", { href: item.href || '#', className: cn(
|
|
27
|
-
// Base styles
|
|
28
|
-
'whitespace-nowrap border-0 bg-transparent p-0 no-underline',
|
|
29
|
-
// Responsive font size based on mobile state
|
|
30
|
-
isMobile ? 'text-t' : 'text-s',
|
|
31
|
-
// Color
|
|
32
|
-
'text-neutral-main',
|
|
33
|
-
// Cursor and hover effects for clickable items
|
|
34
|
-
'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) => {
|
|
35
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
36
|
-
e.preventDefault();
|
|
37
|
-
if (item.onClick) {
|
|
38
|
-
item.onClick();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}, "aria-label": `Go to ${item.label}`, children: item.label })) : (jsx("span", { className: cn(
|
|
42
|
-
// Base styles
|
|
43
|
-
'whitespace-nowrap',
|
|
44
|
-
// Responsive font size based on mobile state
|
|
45
|
-
isMobile ? 'text-t' : 'text-s',
|
|
46
|
-
// Color
|
|
47
|
-
'text-neutral-main',
|
|
48
|
-
// Different styles for current page (last item)
|
|
49
|
-
'font-medium'), "aria-current": isLast ? 'page' : undefined, "aria-label": isLast ? `Current page: ${item.label}` : undefined, children: item.label })), !isLast && (jsx(ChevronLeft, { className: cn('text-black flex-shrink-0',
|
|
50
|
-
// Responsive icon size
|
|
51
|
-
isMobile ? 'w-2.5 h-2.5' : 'w-3 h-3'), "aria-hidden": "true" }))] }, itemKey));
|
|
52
|
-
}) }) }));
|
|
53
|
-
});
|
|
54
|
-
Breadcrumb.displayName = 'Breadcrumb';
|
|
55
|
-
|
|
56
|
-
export { Breadcrumb };
|
package/dist/types/Button.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import cn from './utils.js';
|
|
4
|
-
import { getTypographyClasses } from './Typography.js';
|
|
5
|
-
|
|
6
|
-
const sizeClasses = {
|
|
7
|
-
sm: 'px-[16px] py-[7px]',
|
|
8
|
-
md: 'px-[16px] py-[9px]',
|
|
9
|
-
lg: 'px-[16px] py-[13px]',
|
|
10
|
-
xl: 'px-[20px] py-[13px]',
|
|
11
|
-
};
|
|
12
|
-
const defaultTextVariants = {
|
|
13
|
-
sm: 'body-s-bold', // 14px / Bold (600)
|
|
14
|
-
md: 'body-m-bold', // 16px / Bold (600)
|
|
15
|
-
lg: 'body-l-bold', // 18px / Bold (600)
|
|
16
|
-
xl: 'body-xl-heavy', // 20px / Heavy (700)
|
|
17
|
-
};
|
|
18
|
-
const variantClasses = {
|
|
19
|
-
primary: `
|
|
20
|
-
bg-[var(--color-primary)] text-white
|
|
21
|
-
hover:bg-[var(--color-primary-dark)]
|
|
22
|
-
disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]
|
|
23
|
-
`,
|
|
24
|
-
secondary: `
|
|
25
|
-
bg-[var(--color-primary-lightest)] text-[var(--color-primary)]
|
|
26
|
-
hover:bg-[var(--color-primary-lighter)]
|
|
27
|
-
disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]
|
|
28
|
-
`,
|
|
29
|
-
tertiary: `
|
|
30
|
-
bg-white border border-[var(--color-primary-light)] text-[var(--color-primary)]
|
|
31
|
-
hover:bg-[var(--color-neutral-lighter)]
|
|
32
|
-
disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]
|
|
33
|
-
`,
|
|
34
|
-
ghost: `
|
|
35
|
-
bg-transparent text-[var(--color-primary)]
|
|
36
|
-
hover:bg-[var(--color-primary-lightest)]
|
|
37
|
-
disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]
|
|
38
|
-
`,
|
|
39
|
-
};
|
|
40
|
-
const Button = React.forwardRef(({ className, variant = 'primary', size = 'md', icon, iconPosition = 'right', children, loading = false, disabled, textVariant, ...props }, ref) => {
|
|
41
|
-
const finalTextVariant = textVariant || defaultTextVariants[size];
|
|
42
|
-
return (jsxs("button", { ref: ref, type: "button", className: cn('inline-flex items-center justify-center rounded-[8px] transition-colors duration-200', sizeClasses[size], variantClasses[variant], getTypographyClasses(finalTextVariant), disabled && 'opacity-50 pointer-events-none', className), disabled: disabled || loading, ...props, children: [icon && iconPosition === 'left' && (jsx("span", { className: "mr-2 flex items-center", children: icon })), loading ? '...' : children, icon && iconPosition === 'right' && (jsx("span", { className: "ml-2 flex items-center", children: icon }))] }));
|
|
43
|
-
});
|
|
44
|
-
Button.displayName = 'Button';
|
|
45
|
-
|
|
46
|
-
export { Button };
|
package/dist/types/Chips.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import cn from './utils.js';
|
|
4
|
-
import { c as createLucideIcon } from './createLucideIcon-D-q73LTT.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @license lucide-react v0.522.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const __iconNode = [
|
|
15
|
-
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
16
|
-
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
17
|
-
];
|
|
18
|
-
const X = createLucideIcon("x", __iconNode);
|
|
19
|
-
|
|
20
|
-
const chipVariants = {
|
|
21
|
-
purple: {
|
|
22
|
-
background: 'bg-[var(--color-primary-lightest)]',
|
|
23
|
-
text: 'text-[var(--color-primary-darkest)]',
|
|
24
|
-
border: 'border-[var(--color-primary-light)]',
|
|
25
|
-
},
|
|
26
|
-
red: {
|
|
27
|
-
background: 'bg-[var(--color-error-light)]',
|
|
28
|
-
text: 'text-[var(--color-error)]',
|
|
29
|
-
border: 'border-[#f0d6d6]',
|
|
30
|
-
},
|
|
31
|
-
green: {
|
|
32
|
-
background: 'bg-[var(--color-success-light)]',
|
|
33
|
-
text: 'text-[var(--color-success)]',
|
|
34
|
-
border: 'border-[#d4e8dc]',
|
|
35
|
-
},
|
|
36
|
-
orange: {
|
|
37
|
-
background: 'bg-[var(--color-warning-light)]',
|
|
38
|
-
text: 'text-[var(--color-warning)]',
|
|
39
|
-
border: 'border-[#f5e1d1]',
|
|
40
|
-
},
|
|
41
|
-
blue: {
|
|
42
|
-
background: 'bg-[var(--color-info-light)]',
|
|
43
|
-
text: 'text-[var(--color-info)]',
|
|
44
|
-
border: 'border-[#d3e9f2]',
|
|
45
|
-
},
|
|
46
|
-
white: {
|
|
47
|
-
background: 'bg-[var(--color-white)]',
|
|
48
|
-
text: 'text-[var(--color-neutral-darker)]',
|
|
49
|
-
border: 'border-[var(--color-neutral-light)]',
|
|
50
|
-
},
|
|
51
|
-
disabled: {
|
|
52
|
-
background: 'bg-[var(--color-neutral-lighter)]',
|
|
53
|
-
text: 'text-[var(--color-neutral-main)]',
|
|
54
|
-
border: 'border-[var(--color-neutral-light)]',
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
const chipSizes = {
|
|
58
|
-
mobile: {
|
|
59
|
-
padding: 'px-2.5 py-1',
|
|
60
|
-
gap: 'gap-1',
|
|
61
|
-
iconSize: 'size-4',
|
|
62
|
-
fontSize: 'text-[12px]',
|
|
63
|
-
lineHeight: 'leading-[1.8]',
|
|
64
|
-
},
|
|
65
|
-
desktop: {
|
|
66
|
-
padding: 'px-3 py-1',
|
|
67
|
-
gap: 'gap-1.5',
|
|
68
|
-
iconSize: 'size-5',
|
|
69
|
-
fontSize: 'text-[14px]',
|
|
70
|
-
lineHeight: 'leading-[24px]',
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
const Chips = React.forwardRef(({ variant = 'purple', size, children = 'متن پیشفرض', disabled = false, onClick, onIconClick, className, isMobile, ...props }, ref) => {
|
|
74
|
-
const actualSize = size || (isMobile ? 'mobile' : 'desktop');
|
|
75
|
-
const actualVariant = disabled ? 'disabled' : variant;
|
|
76
|
-
const variantStyles = chipVariants[actualVariant];
|
|
77
|
-
const sizeStyles = chipSizes[actualSize];
|
|
78
|
-
const handleIconClick = (e) => {
|
|
79
|
-
e.stopPropagation();
|
|
80
|
-
if (onIconClick) {
|
|
81
|
-
onIconClick();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
const handleKeyDown = (e) => {
|
|
85
|
-
if ((e.key === 'Enter' || e.key === ' ') && onClick && !disabled) {
|
|
86
|
-
e.preventDefault();
|
|
87
|
-
onClick();
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const renderIcon = () => {
|
|
91
|
-
const iconElement = jsx(X, { className: cn(sizeStyles.iconSize) });
|
|
92
|
-
if (onIconClick) {
|
|
93
|
-
return (jsx("button", { type: "button", onClick: handleIconClick, disabled: disabled, className: cn('flex items-center justify-center', 'hover:opacity-70 transition-opacity', disabled && 'cursor-not-allowed opacity-50'), "aria-label": "\u062D\u0630\u0641", children: iconElement }));
|
|
94
|
-
}
|
|
95
|
-
return iconElement;
|
|
96
|
-
};
|
|
97
|
-
return (jsxs("div", { ref: ref, className: cn(
|
|
98
|
-
// Base styles
|
|
99
|
-
'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',
|
|
100
|
-
// Variant styles
|
|
101
|
-
variantStyles.background, variantStyles.text, variantStyles.border,
|
|
102
|
-
// Size styles
|
|
103
|
-
sizeStyles.padding, sizeStyles.gap, sizeStyles.fontSize, sizeStyles.lineHeight,
|
|
104
|
-
// Interactive styles
|
|
105
|
-
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: [jsx("span", { className: "text-center", children: children }), renderIcon()] }));
|
|
106
|
-
});
|
|
107
|
-
Chips.displayName = 'Chips';
|
|
108
|
-
|
|
109
|
-
export { Chips, Chips as default };
|
package/dist/types/Divider.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import cn from './utils.js';
|
|
4
|
-
|
|
5
|
-
const Divider = React.forwardRef(({ width = '100%', height = 1, orientation = 'horizontal', variant = 'neutral-light', className, style, ...props }, ref) => {
|
|
6
|
-
const isHorizontal = orientation === 'horizontal';
|
|
7
|
-
const variantClasses = {
|
|
8
|
-
'neutral-light': 'bg-neutral-light',
|
|
9
|
-
'neutral-main': 'bg-neutral-main',
|
|
10
|
-
primary: 'bg-primary',
|
|
11
|
-
};
|
|
12
|
-
const dividerStyle = {
|
|
13
|
-
width: isHorizontal ? width : height,
|
|
14
|
-
height: isHorizontal ? height : width,
|
|
15
|
-
...style,
|
|
16
|
-
};
|
|
17
|
-
return (jsx("div", { ref: ref, className: cn('shrink-0', variantClasses[variant], className), style: dividerStyle, role: "separator", ...props }));
|
|
18
|
-
});
|
|
19
|
-
Divider.displayName = 'Divider';
|
|
20
|
-
|
|
21
|
-
export { Divider };
|
package/dist/types/Drawer.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useRef, useEffect } from 'react';
|
|
3
|
-
import cn from './utils.js';
|
|
4
|
-
|
|
5
|
-
const Drawer = React.forwardRef(({ children, direction = 'bottom', fullScreen = false, isOpen = false, onClose, className, isMobile, ...props }, ref) => {
|
|
6
|
-
const overlayRef = useRef(null);
|
|
7
|
-
const drawerRef = useRef(null);
|
|
8
|
-
// Handle escape key
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const handleEscape = (event) => {
|
|
11
|
-
if (event.key === 'Escape' && isOpen && onClose) {
|
|
12
|
-
onClose();
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
if (isOpen) {
|
|
16
|
-
document.addEventListener('keydown', handleEscape);
|
|
17
|
-
// Prevent body scroll when drawer is open
|
|
18
|
-
document.body.style.overflow = 'hidden';
|
|
19
|
-
}
|
|
20
|
-
return () => {
|
|
21
|
-
document.removeEventListener('keydown', handleEscape);
|
|
22
|
-
document.body.style.overflow = 'auto';
|
|
23
|
-
};
|
|
24
|
-
}, [isOpen, onClose]);
|
|
25
|
-
// Handle click outside
|
|
26
|
-
const handleOverlayClick = (event) => {
|
|
27
|
-
if (!fullScreen &&
|
|
28
|
-
onClose &&
|
|
29
|
-
overlayRef.current &&
|
|
30
|
-
event.target === overlayRef.current) {
|
|
31
|
-
onClose();
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
// Handle keyboard events on overlay
|
|
35
|
-
const handleOverlayKeyDown = (event) => {
|
|
36
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
37
|
-
if (!fullScreen &&
|
|
38
|
-
onClose &&
|
|
39
|
-
overlayRef.current &&
|
|
40
|
-
event.target === overlayRef.current) {
|
|
41
|
-
onClose();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const getTranslateClasses = () => {
|
|
46
|
-
if (!isOpen) {
|
|
47
|
-
switch (direction) {
|
|
48
|
-
case 'top':
|
|
49
|
-
return '-translate-y-full';
|
|
50
|
-
case 'bottom':
|
|
51
|
-
return 'translate-y-full';
|
|
52
|
-
case 'left':
|
|
53
|
-
return '-translate-x-full';
|
|
54
|
-
case 'right':
|
|
55
|
-
return 'translate-x-full';
|
|
56
|
-
default:
|
|
57
|
-
return 'translate-y-full';
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return 'translate-x-0 translate-y-0';
|
|
61
|
-
};
|
|
62
|
-
const getPositionClasses = () => {
|
|
63
|
-
switch (direction) {
|
|
64
|
-
case 'top':
|
|
65
|
-
return 'top-0 left-0 right-0';
|
|
66
|
-
case 'bottom':
|
|
67
|
-
return 'bottom-0 left-0 right-0';
|
|
68
|
-
case 'left':
|
|
69
|
-
return 'top-0 left-0 bottom-0';
|
|
70
|
-
case 'right':
|
|
71
|
-
return 'top-0 right-0 bottom-0';
|
|
72
|
-
default:
|
|
73
|
-
return 'bottom-0 left-0 right-0';
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const getSizeClasses = () => {
|
|
77
|
-
const isVertical = direction === 'top' || direction === 'bottom';
|
|
78
|
-
if (fullScreen) {
|
|
79
|
-
return isVertical ? 'w-full h-full' : 'w-full h-full';
|
|
80
|
-
}
|
|
81
|
-
if (isVertical) {
|
|
82
|
-
return 'w-full max-h-[90vh]';
|
|
83
|
-
}
|
|
84
|
-
return 'h-full max-w-[90vw]';
|
|
85
|
-
};
|
|
86
|
-
const baseOverlayClasses = 'fixed inset-0 z-50 transition-all duration-300';
|
|
87
|
-
const baseDrawerClasses = 'fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto';
|
|
88
|
-
const overlayClasses = cn(baseOverlayClasses, {
|
|
89
|
-
'bg-neutral-darker/50 backdrop-blur-sm': isOpen,
|
|
90
|
-
'bg-transparent pointer-events-none': !isOpen,
|
|
91
|
-
});
|
|
92
|
-
const drawerClasses = cn(baseDrawerClasses, getPositionClasses(), getSizeClasses(), getTranslateClasses(), {
|
|
93
|
-
'rounded-t-2xl': direction === 'bottom' && !fullScreen,
|
|
94
|
-
'rounded-b-2xl': direction === 'top' && !fullScreen,
|
|
95
|
-
'rounded-r-2xl': direction === 'left' && !fullScreen,
|
|
96
|
-
'rounded-l-2xl': direction === 'right' && !fullScreen,
|
|
97
|
-
'p-6': !isMobile,
|
|
98
|
-
'p-4': isMobile,
|
|
99
|
-
}, className);
|
|
100
|
-
if (!isOpen) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
return (jsx("div", { ref: overlayRef, className: overlayClasses, onClick: handleOverlayClick, onKeyDown: handleOverlayKeyDown, tabIndex: -1, role: "button", "aria-label": "Close drawer", children: jsx("div", { ref: ref || drawerRef, className: drawerClasses, role: "dialog", "aria-modal": "true", "aria-label": "Drawer", ...props, children: children }) }));
|
|
104
|
-
});
|
|
105
|
-
Drawer.displayName = 'Drawer';
|
|
106
|
-
|
|
107
|
-
export { Drawer };
|
package/dist/types/Input.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useState, useId } from 'react';
|
|
3
|
-
import cn from './utils.js';
|
|
4
|
-
|
|
5
|
-
const Input = React.forwardRef(({ state = 'default', label, value, onChange, helperText, startIcon, endIcon, type = 'text', isMobile, ...props }, ref) => {
|
|
6
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
7
|
-
const id = useId();
|
|
8
|
-
const hasContent = value !== '' && value !== null && value !== undefined;
|
|
9
|
-
const isLabelFloated = isFocused || hasContent;
|
|
10
|
-
const isDisabled = state === 'disabled';
|
|
11
|
-
const handleFocus = (e) => {
|
|
12
|
-
if (!isDisabled) {
|
|
13
|
-
setIsFocused(true);
|
|
14
|
-
props.onFocus?.(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const handleBlur = (e) => {
|
|
18
|
-
if (!isDisabled) {
|
|
19
|
-
setIsFocused(false);
|
|
20
|
-
props.onBlur?.(e);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const baseContainerClasses = 'relative flex items-center border rounded-lg transition-all duration-300 w-[360px]';
|
|
24
|
-
const baseLabelClasses = 'absolute pointer-events-none transition-all duration-300';
|
|
25
|
-
const baseInputClasses = 'peer w-full h-full bg-transparent outline-none text-m font-medium disabled:text-neutral-light';
|
|
26
|
-
const baseIconClasses = 'absolute h-5 w-5 transition-colors duration-300';
|
|
27
|
-
const containerClasses = cn(baseContainerClasses, {
|
|
28
|
-
'h-[54px]': !isMobile,
|
|
29
|
-
'h-12': isMobile,
|
|
30
|
-
'border-neutral-light': state === 'default' && !isFocused,
|
|
31
|
-
'border-primary': state === 'default' && isFocused,
|
|
32
|
-
'border-error': state === 'error',
|
|
33
|
-
'bg-white border-neutral-light cursor-not-allowed': isDisabled,
|
|
34
|
-
});
|
|
35
|
-
const labelClasses = cn(baseLabelClasses, {
|
|
36
|
-
'top-[-10px] bg-white px-1 mx-3 font-medium': isLabelFloated,
|
|
37
|
-
'text-s': (!isMobile && isLabelFloated) || (isMobile && !isLabelFloated),
|
|
38
|
-
'text-xs': isMobile && isLabelFloated,
|
|
39
|
-
'text-m': !isMobile && !isLabelFloated,
|
|
40
|
-
'right-1': startIcon,
|
|
41
|
-
'right-3': !startIcon,
|
|
42
|
-
'top-1/2 -translate-y-1/2 text-m font-medium': !isLabelFloated,
|
|
43
|
-
'right-11': !isLabelFloated && startIcon,
|
|
44
|
-
'right-4': !isLabelFloated && !startIcon,
|
|
45
|
-
'text-neutral-main': !isFocused && state === 'default',
|
|
46
|
-
'text-neutral-light': isDisabled,
|
|
47
|
-
'text-primary': isFocused && state === 'default',
|
|
48
|
-
'text-error': isLabelFloated && state === 'error',
|
|
49
|
-
});
|
|
50
|
-
const inputClasses = cn(baseInputClasses, {
|
|
51
|
-
'pr-12': startIcon,
|
|
52
|
-
'pl-12': endIcon,
|
|
53
|
-
'px-4': !startIcon && !endIcon,
|
|
54
|
-
'pr-4 pl-12': !startIcon && endIcon,
|
|
55
|
-
'pl-4 pr-12': startIcon && !endIcon,
|
|
56
|
-
'cursor-not-allowed text-red-500': isDisabled,
|
|
57
|
-
'text-neutral-dark': !isFocused,
|
|
58
|
-
'text-neutral-darker': isFocused,
|
|
59
|
-
});
|
|
60
|
-
const iconClasses = cn(baseIconClasses, {
|
|
61
|
-
'text-neutral-main': state !== 'error' && !isFocused,
|
|
62
|
-
'text-primary': state === 'default' && isFocused,
|
|
63
|
-
'text-error': state === 'error',
|
|
64
|
-
'text-neutral-light': isDisabled,
|
|
65
|
-
});
|
|
66
|
-
const helperTextClasses = cn('font-light mt-1 px-2 h-4', {
|
|
67
|
-
'text-s': !isMobile,
|
|
68
|
-
'text-xs': isMobile,
|
|
69
|
-
'text-neutral-main': state === 'default',
|
|
70
|
-
'text-primary': state === 'default' && isFocused,
|
|
71
|
-
'text-error': state === 'error',
|
|
72
|
-
'text-neutral-light': isDisabled,
|
|
73
|
-
});
|
|
74
|
-
return (jsxs("div", { children: [jsxs("div", { className: containerClasses, children: [endIcon && (jsx("span", { className: cn(iconClasses, 'left-4'), children: endIcon })), jsx("label", { htmlFor: id, className: labelClasses, children: label }), jsx("input", { ref: ref, id: id, type: type, value: value, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur, disabled: isDisabled, className: inputClasses, ...props }), startIcon && (jsx("span", { className: cn(iconClasses, 'right-4'), children: startIcon }))] }), helperText && jsx("p", { className: helperTextClasses, children: helperText })] }));
|
|
75
|
-
});
|
|
76
|
-
Input.displayName = 'Input';
|
|
77
|
-
|
|
78
|
-
export { Input };
|