automoby-kit 1.0.13 → 1.0.15

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.
Files changed (115) hide show
  1. package/dist/cjs/Accordion.js +1 -59
  2. package/dist/cjs/Backdrop.js +1 -26
  3. package/dist/cjs/Breadcrumb.js +1 -61
  4. package/dist/cjs/Button.js +1 -48
  5. package/dist/cjs/Chips.js +1 -117
  6. package/dist/cjs/Divider.js +1 -23
  7. package/dist/cjs/Drawer.js +1 -112
  8. package/dist/cjs/Input.js +1 -84
  9. package/dist/cjs/Menu.js +1 -122
  10. package/dist/cjs/Pagination.js +1 -188
  11. package/dist/cjs/RadioGroup.js +1 -73
  12. package/dist/cjs/Tabs.js +1 -54
  13. package/dist/cjs/Typography.js +1 -63
  14. package/dist/cjs/contexts.js +1 -1491
  15. package/dist/cjs/index.js +1 -52
  16. package/dist/cjs/utils.js +1 -9
  17. package/dist/esm/Accordion.js +1 -57
  18. package/dist/esm/Backdrop.js +1 -24
  19. package/dist/esm/Breadcrumb.js +1 -59
  20. package/dist/esm/Button.js +1 -46
  21. package/dist/esm/Chips.js +1 -112
  22. package/dist/esm/Divider.js +1 -21
  23. package/dist/esm/Drawer.js +1 -110
  24. package/dist/esm/Input.js +1 -82
  25. package/dist/esm/Menu.js +1 -120
  26. package/dist/esm/Pagination.js +1 -186
  27. package/dist/esm/RadioGroup.js +1 -71
  28. package/dist/esm/Tabs.js +1 -52
  29. package/dist/esm/Typography.js +1 -60
  30. package/dist/esm/contexts.js +1 -1485
  31. package/dist/esm/index.js +1 -37
  32. package/dist/esm/utils.js +1 -7
  33. package/dist/types/Accordion.js +57 -0
  34. package/dist/types/Backdrop.js +24 -0
  35. package/dist/types/Breadcrumb.js +59 -0
  36. package/dist/types/Button.js +46 -0
  37. package/dist/types/Chips.js +112 -0
  38. package/dist/types/Divider.js +21 -0
  39. package/dist/types/Drawer.js +110 -0
  40. package/dist/types/Input.js +82 -0
  41. package/dist/types/Menu.js +120 -0
  42. package/dist/types/Pagination.js +186 -0
  43. package/dist/types/RadioGroup.js +71 -0
  44. package/dist/types/Tabs.js +52 -0
  45. package/dist/types/Typography.js +60 -0
  46. package/dist/types/contexts.js +1485 -0
  47. package/dist/{cjs → types}/index.d.ts +1 -0
  48. package/dist/types/index.js +37 -0
  49. package/dist/types/utils.js +7 -0
  50. package/package.json +1 -1
  51. package/dist/cjs/chevron-left-COj1qGVo.js +0 -16
  52. package/dist/cjs/createLucideIcon-BTjFFtDc.js +0 -114
  53. package/dist/esm/components/Accordion/Accordion.d.ts +0 -25
  54. package/dist/esm/components/Accordion/Accordion.stories.d.ts +0 -175
  55. package/dist/esm/components/Backdrop/Backdrop.d.ts +0 -20
  56. package/dist/esm/components/Backdrop/Backdrop.stories.d.ts +0 -9
  57. package/dist/esm/components/Breadcrumb/Breadcrumb.d.ts +0 -16
  58. package/dist/esm/components/Breadcrumb/Breadcrumb.stories.d.ts +0 -177
  59. package/dist/esm/components/Button/Button.d.ts +0 -13
  60. package/dist/esm/components/Button/Button.stories.d.ts +0 -100
  61. package/dist/esm/components/Chips/Chips.d.ts +0 -37
  62. package/dist/esm/components/Chips/Chips.stories.d.ts +0 -90
  63. package/dist/esm/components/Divider/Divider.d.ts +0 -25
  64. package/dist/esm/components/Divider/Divider.stories.d.ts +0 -88
  65. package/dist/esm/components/Drawer/Drawer.d.ts +0 -16
  66. package/dist/esm/components/Drawer/Drawer.stories.d.ts +0 -128
  67. package/dist/esm/components/Input/Input.d.ts +0 -24
  68. package/dist/esm/components/Input/Input.stories.d.ts +0 -131
  69. package/dist/esm/components/Menu/Menu.d.ts +0 -39
  70. package/dist/esm/components/Menu/Menu.stories.d.ts +0 -89
  71. package/dist/esm/components/Pagination/Pagination.d.ts +0 -12
  72. package/dist/esm/components/Pagination/Pagination.stories.d.ts +0 -76
  73. package/dist/esm/components/RadioGroup/RadioGroup.d.ts +0 -55
  74. package/dist/esm/components/RadioGroup/RadioGroup.stories.d.ts +0 -86
  75. package/dist/esm/components/Select/Select.d.ts +0 -17
  76. package/dist/esm/components/Select/Select.stories.d.ts +0 -104
  77. package/dist/esm/components/Tabs/Tabs.d.ts +0 -43
  78. package/dist/esm/components/Tabs/Tabs.stories.d.ts +0 -66
  79. package/dist/esm/components/Typography/Typography.d.ts +0 -9
  80. package/dist/esm/components/Typography/Typography.stories.d.ts +0 -57
  81. package/dist/esm/contexts/MobileContext.d.ts +0 -13
  82. package/dist/esm/index.d.ts +0 -34
  83. package/dist/esm/utils/cn.d.ts +0 -2
  84. /package/dist/{esm → types}/chevron-left-Ck6O99eF.js +0 -0
  85. /package/dist/{cjs → types}/components/Accordion/Accordion.d.ts +0 -0
  86. /package/dist/{cjs → types}/components/Accordion/Accordion.stories.d.ts +0 -0
  87. /package/dist/{cjs → types}/components/Backdrop/Backdrop.d.ts +0 -0
  88. /package/dist/{cjs → types}/components/Backdrop/Backdrop.stories.d.ts +0 -0
  89. /package/dist/{cjs → types}/components/Breadcrumb/Breadcrumb.d.ts +0 -0
  90. /package/dist/{cjs → types}/components/Breadcrumb/Breadcrumb.stories.d.ts +0 -0
  91. /package/dist/{cjs → types}/components/Button/Button.d.ts +0 -0
  92. /package/dist/{cjs → types}/components/Button/Button.stories.d.ts +0 -0
  93. /package/dist/{cjs → types}/components/Chips/Chips.d.ts +0 -0
  94. /package/dist/{cjs → types}/components/Chips/Chips.stories.d.ts +0 -0
  95. /package/dist/{cjs → types}/components/Divider/Divider.d.ts +0 -0
  96. /package/dist/{cjs → types}/components/Divider/Divider.stories.d.ts +0 -0
  97. /package/dist/{cjs → types}/components/Drawer/Drawer.d.ts +0 -0
  98. /package/dist/{cjs → types}/components/Drawer/Drawer.stories.d.ts +0 -0
  99. /package/dist/{cjs → types}/components/Input/Input.d.ts +0 -0
  100. /package/dist/{cjs → types}/components/Input/Input.stories.d.ts +0 -0
  101. /package/dist/{cjs → types}/components/Menu/Menu.d.ts +0 -0
  102. /package/dist/{cjs → types}/components/Menu/Menu.stories.d.ts +0 -0
  103. /package/dist/{cjs → types}/components/Pagination/Pagination.d.ts +0 -0
  104. /package/dist/{cjs → types}/components/Pagination/Pagination.stories.d.ts +0 -0
  105. /package/dist/{cjs → types}/components/RadioGroup/RadioGroup.d.ts +0 -0
  106. /package/dist/{cjs → types}/components/RadioGroup/RadioGroup.stories.d.ts +0 -0
  107. /package/dist/{cjs → types}/components/Select/Select.d.ts +0 -0
  108. /package/dist/{cjs → types}/components/Select/Select.stories.d.ts +0 -0
  109. /package/dist/{cjs → types}/components/Tabs/Tabs.d.ts +0 -0
  110. /package/dist/{cjs → types}/components/Tabs/Tabs.stories.d.ts +0 -0
  111. /package/dist/{cjs → types}/components/Typography/Typography.d.ts +0 -0
  112. /package/dist/{cjs → types}/components/Typography/Typography.stories.d.ts +0 -0
  113. /package/dist/{cjs → types}/contexts/MobileContext.d.ts +0 -0
  114. /package/dist/{esm → types}/createLucideIcon-D-q73LTT.js +0 -0
  115. /package/dist/{cjs → types}/utils/cn.d.ts +0 -0
@@ -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;
1
+ "use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),a=require("./utils.js"),i=require("./contexts.js"),s=require("./Typography.js"),t=require("./chunks/createLucideIcon-BqJVOzoK.js");const n=t.createLucideIcon("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),d=t.createLucideIcon("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),o=r.forwardRef(({title:t,body:o,startIcon:l,isExpanded:c,onToggle:u,defaultExpanded:h=!1,className:m,id:x,disabled:p=!1,isMobile:f,...y},b)=>{const j=i.useMobile(),v=f??j,[g,N]=r.useState(h),k=void 0!==c?c:g,w=x||`accordion-${Math.random().toString(36).substr(2,9)}`,q=`${w}-header`,I=`${w}-content`,T=v?20:24,z=v?"body-s-heavy":"body-l-heavy",L=v?"body-s-medium":"body-m-medium";return e.jsxs("div",{ref:b,className:a("rounded-2xl border-0 overflow-hidden","transition-all duration-200 ease-in-out",m),...y,children:[e.jsxs("button",{id:q,type:"button",onClick:()=>{if(p)return;const e=!k;void 0===c&&N(e),u?.(e)},disabled:p,"aria-expanded":k,"aria-controls":I,className:a("w-full flex items-center justify-between",v?"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",!p&&"hover:bg-neutral-lighter"),children:[e.jsx("div",{className:"flex-shrink-0 mr-4",children:k?e.jsx(d,{size:T,className:"text-neutral-darker transition-transform duration-200","aria-hidden":"true"}):e.jsx(n,{size:T,className:"text-neutral-darker transition-transform duration-200","aria-hidden":"true"})}),e.jsxs("div",{className:a("flex items-center flex-1",v?"gap-3":"gap-4"),children:[e.jsx("div",{className:"flex-1 text-right",children:e.jsx(s.Typography,{variant:z,color:"neutral-darker",children:t})}),l&&e.jsx("div",{className:a("flex-shrink-0 flex items-center justify-center",v?"w-6 h-6":"w-8 h-8"),children:l})]})]}),e.jsx("div",{id:I,role:"region","aria-labelledby":q,className:a("w-full overflow-hidden transition-all duration-300 ease-in-out",k?"max-h-screen opacity-100":"max-h-0 opacity-0"),children:e.jsx("div",{className:a(v?"pb-3 mt-1":"pb-4 mt-1.5"),children:e.jsx("div",{className:a("bg-neutral-lighter rounded-lg",v?"p-3":"p-4"),children:e.jsx(s.Typography,{variant:L,color:"neutral-dark",children:o})})})})]})});o.displayName="Accordion",exports.Accordion=o;
@@ -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;
1
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("./utils.js");const a=r.forwardRef(({isOpen:r=!1,onClick:a,blur:n=!1,zIndex:i=51,className:o,children:s,...c},d)=>{const l=t("fixed inset-0 transition-all duration-300",{"opacity-100 pointer-events-auto":r,"opacity-0 pointer-events-none":!r,"backdrop-blur-sm":n},o),u={backgroundColor:"rgba(0, 0, 0, 0.60)",zIndex:i};return e.jsx("div",{ref:d,className:l,style:u,onClick:e=>{a&&e.target===e.currentTarget&&a()},role:"presentation","aria-hidden":!r,...c,children:s})});a.displayName="Backdrop",exports.Backdrop=a;
@@ -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;
1
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),a=require("./utils.js"),t=require("./contexts.js"),n=require("./chunks/chevron-left-Do__K6cA.js");require("./chunks/createLucideIcon-BqJVOzoK.js");const s=r.forwardRef(({items:r,className:s,isMobile:l},i)=>{const c=t.useMobile(),o=l??c;return e.jsx("nav",{ref:i,className:a("flex flex-row-reverse items-center",o?"gap-1 px-4 py-2.5":"gap-3 pr-1 pt-3 pb-4 pl-0",s),"aria-label":"Breadcrumb navigation",children:e.jsx("ol",{className:"flex flex-row-reverse items-center gap-inherit",children:r.map((t,s)=>{const l=s===r.length-1,i=!l&&(t.href||t.onClick),c=`${t.label}-${s}`;return e.jsxs("li",{className:"flex items-center gap-inherit",children:[i?e.jsx("a",{href:t.href||"#",className:a("whitespace-nowrap border-0 bg-transparent p-0 no-underline",o?"text-t":"text-s","text-neutral-main","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=>((e,a,t)=>{a!==r.length-1&&e.onClick&&(t.preventDefault(),e.onClick())})(t,s,e),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.onClick&&t.onClick())},"aria-label":`Go to ${t.label}`,children:t.label}):e.jsx("span",{className:a("whitespace-nowrap",o?"text-t":"text-s","text-neutral-main","font-medium"),"aria-current":l?"page":void 0,"aria-label":l?`Current page: ${t.label}`:void 0,children:t.label}),!l&&e.jsx(n.ChevronLeft,{className:a("text-black flex-shrink-0",o?"w-2.5 h-2.5":"w-3 h-3"),"aria-hidden":"true"})]},c)})})})});s.displayName="Breadcrumb",exports.Breadcrumb=s;
@@ -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;
1
+ "use strict";var r=require("react/jsx-runtime"),e=require("react"),a=require("./utils.js"),t=require("./Typography.js");const l={sm:"px-[16px] py-[7px]",md:"px-[16px] py-[9px]",lg:"px-[16px] py-[13px]",xl:"px-[20px] py-[13px]"},o={sm:"body-s-bold",md:"body-m-bold",lg:"body-l-bold",xl:"body-xl-heavy"},i={primary:"\n bg-[var(--color-primary)] text-white\n hover:bg-[var(--color-primary-dark)]\n disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]\n ",secondary:"\n bg-[var(--color-primary-lightest)] text-[var(--color-primary)]\n hover:bg-[var(--color-primary-lighter)]\n disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]\n ",tertiary:"\n bg-white border border-[var(--color-primary-light)] text-[var(--color-primary)]\n hover:bg-[var(--color-neutral-lighter)]\n disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]\n ",ghost:"\n bg-transparent text-[var(--color-primary)]\n hover:bg-[var(--color-primary-lightest)]\n disabled:bg-[var(--color-neutral-light)] disabled:text-[var(--color-neutral-darker)]\n "},n=e.forwardRef(({className:e,variant:n="primary",size:s="md",icon:d,iconPosition:c="right",children:p,loading:b=!1,disabled:x,textVariant:g,...y},m)=>{const v=g||o[s];return r.jsxs("button",{ref:m,type:"button",className:a("inline-flex items-center justify-center rounded-[8px] transition-colors duration-200",l[s],i[n],t.getTypographyClasses(v),x&&"opacity-50 pointer-events-none",e),disabled:x||b,...y,children:[d&&"left"===c&&r.jsx("span",{className:"mr-2 flex items-center",children:d}),b?"...":p,d&&"right"===c&&r.jsx("span",{className:"ml-2 flex items-center",children:d})]})});n.displayName="Button",exports.Button=n;
package/dist/cjs/Chips.js CHANGED
@@ -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;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("./utils.js"),t=require("./contexts.js");const i=require("./chunks/createLucideIcon-BqJVOzoK.js").createLucideIcon("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),a={purple:{background:"bg-[var(--color-primary-lightest)]",text:"text-[var(--color-primary-darkest)]",border:"border-[var(--color-primary-light)]"},red:{background:"bg-[var(--color-error-light)]",text:"text-[var(--color-error)]",border:"border-[#f0d6d6]"},green:{background:"bg-[var(--color-success-light)]",text:"text-[var(--color-success)]",border:"border-[#d4e8dc]"},orange:{background:"bg-[var(--color-warning-light)]",text:"text-[var(--color-warning)]",border:"border-[#f5e1d1]"},blue:{background:"bg-[var(--color-info-light)]",text:"text-[var(--color-info)]",border:"border-[#d3e9f2]"},white:{background:"bg-[var(--color-white)]",text:"text-[var(--color-neutral-darker)]",border:"border-[var(--color-neutral-light)]"},disabled:{background:"bg-[var(--color-neutral-lighter)]",text:"text-[var(--color-neutral-main)]",border:"border-[var(--color-neutral-light)]"}},n={mobile:{padding:"px-2.5 py-1",gap:"gap-1",iconSize:"size-4",fontSize:"text-[12px]",lineHeight:"leading-[1.8]"},desktop:{padding:"px-3 py-1",gap:"gap-1.5",iconSize:"size-5",fontSize:"text-[14px]",lineHeight:"leading-[24px]"}},l=r.forwardRef(({variant:r="purple",size:l,children:d="متن پیشفرض",disabled:c=!1,onClick:s,onIconClick:b,className:p,isMobile:u,...g},x)=>{const v=t.useMobile(),h=a[c?"disabled":r],f=n[l||(u??v?"mobile":"desktop")],handleIconClick=e=>{e.stopPropagation(),b&&b()};return e.jsxs("div",{ref:x,className:o("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",h.background,h.text,h.border,f.padding,f.gap,f.fontSize,f.lineHeight,s&&!c&&"cursor-pointer hover:opacity-80",c&&"cursor-not-allowed opacity-60",p),onClick:c?void 0:s,onKeyDown:s&&!c?e=>{"Enter"!==e.key&&" "!==e.key||!s||c||(e.preventDefault(),s())}:void 0,tabIndex:s&&!c?0:void 0,role:s?"button":void 0,...g,children:[e.jsx("span",{className:"text-center",children:d}),(()=>{const r=e.jsx(i,{className:o(f.iconSize)});return b?e.jsx("button",{type:"button",onClick:handleIconClick,disabled:c,className:o("flex items-center justify-center","hover:opacity-70 transition-opacity",c&&"cursor-not-allowed opacity-50"),"aria-label":"حذف",children:r}):r})()]})});l.displayName="Chips",exports.Chips=l,exports.default=l;
@@ -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;
1
+ "use strict";var r=require("react/jsx-runtime"),e=require("react"),t=require("./utils.js");const i=e.forwardRef(({width:e="100%",height:i=1,orientation:a="horizontal",variant:s="neutral-light",className:l,style:n,...h},o)=>{const u="horizontal"===a,g={width:u?e:i,height:u?i:e,...n};return r.jsx("div",{ref:o,className:t("shrink-0",{"neutral-light":"bg-neutral-light","neutral-main":"bg-neutral-main",primary:"bg-primary"}[s],l),style:g,role:"separator",...h})});i.displayName="Divider",exports.Divider=i;
@@ -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;
1
+ "use client";"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("./utils.js"),l=require("./contexts.js");const n=t.forwardRef(({children:n,direction:o="bottom",fullScreen:a=!1,isOpen:s=!1,onClose:u,className:i,isMobile:d,...c},f)=>{const b=l.useMobile(),m=d??b,w=t.useRef(null),h=t.useRef(null);t.useEffect(()=>{const handleEscape=e=>{"Escape"===e.key&&s&&u&&u()};return s&&(document.addEventListener("keydown",handleEscape),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",handleEscape),document.body.style.overflow="auto"}},[s,u]);const x=r("fixed inset-0 z-50 transition-all duration-300",{"bg-neutral-darker/50 backdrop-blur-sm":s,"bg-transparent pointer-events-none":!s}),p=r("fixed bg-white shadow-2xl transition-all duration-300 ease-out overflow-auto",(()=>{switch(o){case"top":return"top-0 left-0 right-0";case"bottom":default:return"bottom-0 left-0 right-0";case"left":return"top-0 left-0 bottom-0";case"right":return"top-0 right-0 bottom-0"}})(),(()=>{const e="top"===o||"bottom"===o;return a?"w-full h-full":e?"w-full max-h-[90vh]":"h-full max-w-[90vw]"})(),(()=>{if(!s)switch(o){case"top":return"-translate-y-full";case"bottom":default:return"translate-y-full";case"left":return"-translate-x-full";case"right":return"translate-x-full"}return"translate-x-0 translate-y-0"})(),{"rounded-t-2xl":"bottom"===o&&!a,"rounded-b-2xl":"top"===o&&!a,"rounded-r-2xl":"left"===o&&!a,"rounded-l-2xl":"right"===o&&!a,"p-6":!m,"p-4":m},i);return s?e.jsx("div",{ref:w,className:x,onClick:e=>{!a&&u&&w.current&&e.target===w.current&&u()},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||!a&&u&&w.current&&e.target===w.current&&u()},tabIndex:-1,role:"button","aria-label":"Close drawer",children:e.jsx("div",{ref:f||h,className:p,role:"dialog","aria-modal":"true","aria-label":"Drawer",...c,children:n})}):null});n.displayName="Drawer",exports.Drawer=n;
package/dist/cjs/Input.js CHANGED
@@ -1,84 +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 Input = React.forwardRef(({ state = 'default', label, value, onChange, helperText, startIcon, endIcon, type = 'text', isMobile, ...props }, ref) => {
9
- const [isFocused, setIsFocused] = React.useState(false);
10
- const id = React.useId();
11
- const detectedIsMobile = contexts.useMobile();
12
- const actualIsMobile = isMobile ?? detectedIsMobile;
13
- const hasContent = value !== '' && value !== null && value !== undefined;
14
- const isLabelFloated = isFocused || hasContent;
15
- const isDisabled = state === 'disabled';
16
- const handleFocus = (e) => {
17
- if (!isDisabled) {
18
- setIsFocused(true);
19
- props.onFocus?.(e);
20
- }
21
- };
22
- const handleBlur = (e) => {
23
- if (!isDisabled) {
24
- setIsFocused(false);
25
- props.onBlur?.(e);
26
- }
27
- };
28
- const baseContainerClasses = 'relative flex items-center border rounded-lg transition-all duration-300 w-[360px]';
29
- const baseLabelClasses = 'absolute pointer-events-none transition-all duration-300';
30
- const baseInputClasses = 'peer w-full h-full bg-transparent outline-none text-m font-medium disabled:text-neutral-light';
31
- const baseIconClasses = 'absolute h-5 w-5 transition-colors duration-300';
32
- const containerClasses = utils(baseContainerClasses, {
33
- 'h-[54px]': !actualIsMobile,
34
- 'h-12': actualIsMobile,
35
- 'border-neutral-light': state === 'default' && !isFocused,
36
- 'border-primary': state === 'default' && isFocused,
37
- 'border-error': state === 'error',
38
- 'bg-white border-neutral-light cursor-not-allowed': isDisabled,
39
- });
40
- const labelClasses = utils(baseLabelClasses, {
41
- 'top-[-10px] bg-white px-1 mx-3 font-medium': isLabelFloated,
42
- 'text-s': (!actualIsMobile && isLabelFloated) ||
43
- (actualIsMobile && !isLabelFloated),
44
- 'text-xs': actualIsMobile && isLabelFloated,
45
- 'text-m': !actualIsMobile && !isLabelFloated,
46
- 'right-1': startIcon,
47
- 'right-3': !startIcon,
48
- 'top-1/2 -translate-y-1/2 text-m font-medium': !isLabelFloated,
49
- 'right-11': !isLabelFloated && startIcon,
50
- 'right-4': !isLabelFloated && !startIcon,
51
- 'text-neutral-main': !isFocused && state === 'default',
52
- 'text-neutral-light': isDisabled,
53
- 'text-primary': isFocused && state === 'default',
54
- 'text-error': isLabelFloated && state === 'error',
55
- });
56
- const inputClasses = utils(baseInputClasses, {
57
- 'pr-12': startIcon,
58
- 'pl-12': endIcon,
59
- 'px-4': !startIcon && !endIcon,
60
- 'pr-4 pl-12': !startIcon && endIcon,
61
- 'pl-4 pr-12': startIcon && !endIcon,
62
- 'cursor-not-allowed text-red-500': isDisabled,
63
- 'text-neutral-dark': !isFocused,
64
- 'text-neutral-darker': isFocused,
65
- });
66
- const iconClasses = utils(baseIconClasses, {
67
- 'text-neutral-main': state !== 'error' && !isFocused,
68
- 'text-primary': state === 'default' && isFocused,
69
- 'text-error': state === 'error',
70
- 'text-neutral-light': isDisabled,
71
- });
72
- const helperTextClasses = utils('font-light mt-1 px-2 h-4', {
73
- 'text-s': !actualIsMobile,
74
- 'text-xs': actualIsMobile,
75
- 'text-neutral-main': state === 'default',
76
- 'text-primary': state === 'default' && isFocused,
77
- 'text-error': state === 'error',
78
- 'text-neutral-light': isDisabled,
79
- });
80
- return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsxs("div", { className: containerClasses, children: [endIcon && (jsxRuntime.jsx("span", { className: utils(iconClasses, 'left-4'), children: endIcon })), jsxRuntime.jsx("label", { htmlFor: id, className: labelClasses, children: label }), jsxRuntime.jsx("input", { ref: ref, id: id, type: type, value: value, onChange: onChange, onFocus: handleFocus, onBlur: handleBlur, disabled: isDisabled, className: inputClasses, ...props }), startIcon && (jsxRuntime.jsx("span", { className: utils(iconClasses, 'right-4'), children: startIcon }))] }), helperText && jsxRuntime.jsx("p", { className: helperTextClasses, children: helperText })] }));
81
- });
82
- Input.displayName = 'Input';
83
-
84
- exports.Input = Input;
1
+ "use client";"use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("./utils.js"),l=require("./contexts.js");const a=t.forwardRef(({state:a="default",label:n,value:i,onChange:s,helperText:o,startIcon:u,endIcon:d,type:x="text",isMobile:p,...h},m)=>{const[c,f]=t.useState(!1),g=t.useId(),b=l.useMobile(),j=p??b,w=c||""!==i&&null!=i,y="disabled"===a,v=r("relative flex items-center border rounded-lg transition-all duration-300 w-[360px]",{"h-[54px]":!j,"h-12":j,"border-neutral-light":"default"===a&&!c,"border-primary":"default"===a&&c,"border-error":"error"===a,"bg-white border-neutral-light cursor-not-allowed":y}),N=r("absolute pointer-events-none transition-all duration-300",{"top-[-10px] bg-white px-1 mx-3 font-medium":w,"text-s":!j&&w||j&&!w,"text-xs":j&&w,"text-m":!j&&!w,"right-1":u,"right-3":!u,"top-1/2 -translate-y-1/2 text-m font-medium":!w,"right-11":!w&&u,"right-4":!w&&!u,"text-neutral-main":!c&&"default"===a,"text-neutral-light":y,"text-primary":c&&"default"===a,"text-error":w&&"error"===a}),I=r("peer w-full h-full bg-transparent outline-none text-m font-medium disabled:text-neutral-light",{"pr-12":u,"pl-12":d,"px-4":!u&&!d,"pr-4 pl-12":!u&&d,"pl-4 pr-12":u&&!d,"cursor-not-allowed text-red-500":y,"text-neutral-dark":!c,"text-neutral-darker":c}),q=r("absolute h-5 w-5 transition-colors duration-300",{"text-neutral-main":"error"!==a&&!c,"text-primary":"default"===a&&c,"text-error":"error"===a,"text-neutral-light":y}),F=r("font-light mt-1 px-2 h-4",{"text-s":!j,"text-xs":j,"text-neutral-main":"default"===a,"text-primary":"default"===a&&c,"text-error":"error"===a,"text-neutral-light":y});return e.jsxs("div",{children:[e.jsxs("div",{className:v,children:[d&&e.jsx("span",{className:r(q,"left-4"),children:d}),e.jsx("label",{htmlFor:g,className:N,children:n}),e.jsx("input",{ref:m,id:g,type:x,value:i,onChange:s,onFocus:e=>{y||(f(!0),h.onFocus?.(e))},onBlur:e=>{y||(f(!1),h.onBlur?.(e))},disabled:y,className:I,...h}),u&&e.jsx("span",{className:r(q,"right-4"),children:u})]}),o&&e.jsx("p",{className:F,children:o})]})});a.displayName="Input",exports.Input=a;