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.
Files changed (126) hide show
  1. package/README.md +7 -71
  2. package/dist/cjs/Accordion.js +59 -1
  3. package/dist/cjs/Backdrop.js +26 -1
  4. package/dist/cjs/Breadcrumb.js +61 -1
  5. package/dist/cjs/Button.js +48 -1
  6. package/dist/cjs/Chips.js +117 -1
  7. package/dist/cjs/Divider.js +23 -1
  8. package/dist/cjs/Drawer.js +112 -1
  9. package/dist/cjs/Input.js +84 -1
  10. package/dist/cjs/Menu.js +122 -1
  11. package/dist/cjs/Pagination.js +188 -1
  12. package/dist/cjs/RadioGroup.js +73 -1
  13. package/dist/cjs/Tabs.js +54 -1
  14. package/dist/cjs/Typography.js +63 -1
  15. package/dist/cjs/chevron-left-COj1qGVo.js +16 -0
  16. package/dist/{types → cjs}/components/Accordion/Accordion.d.ts +2 -2
  17. package/dist/{types → cjs}/components/Breadcrumb/Breadcrumb.d.ts +2 -2
  18. package/dist/{types → cjs}/components/Chips/Chips.d.ts +5 -5
  19. package/dist/{types → cjs}/components/Drawer/Drawer.d.ts +2 -2
  20. package/dist/{types → cjs}/components/Input/Input.d.ts +4 -4
  21. package/dist/{types → cjs}/components/Input/Input.stories.d.ts +1 -1
  22. package/dist/{types → cjs}/components/Pagination/Pagination.d.ts +2 -2
  23. package/dist/{types → cjs}/components/RadioGroup/RadioGroup.d.ts +2 -2
  24. package/dist/cjs/components/Select/Select.d.ts +17 -0
  25. package/dist/cjs/components/Select/Select.stories.d.ts +104 -0
  26. package/dist/{types → cjs}/components/Tabs/Tabs.d.ts +2 -2
  27. package/dist/{types → cjs}/contexts/MobileContext.d.ts +1 -0
  28. package/dist/cjs/contexts.js +1491 -1
  29. package/dist/cjs/createLucideIcon-BTjFFtDc.js +114 -0
  30. package/dist/cjs/index.d.ts +34 -0
  31. package/dist/cjs/index.js +52 -1
  32. package/dist/cjs/utils.js +9 -1
  33. package/dist/esm/Accordion.js +57 -1
  34. package/dist/esm/Backdrop.js +24 -1
  35. package/dist/esm/Breadcrumb.js +59 -1
  36. package/dist/esm/Button.js +46 -1
  37. package/dist/esm/Chips.js +112 -1
  38. package/dist/esm/Divider.js +21 -1
  39. package/dist/esm/Drawer.js +110 -1
  40. package/dist/esm/Input.js +82 -1
  41. package/dist/esm/Menu.js +120 -1
  42. package/dist/esm/Pagination.js +186 -1
  43. package/dist/esm/RadioGroup.js +71 -1
  44. package/dist/esm/Tabs.js +52 -1
  45. package/dist/esm/Typography.js +60 -1
  46. package/dist/esm/components/Accordion/Accordion.d.ts +25 -0
  47. package/dist/esm/components/Accordion/Accordion.stories.d.ts +175 -0
  48. package/dist/esm/components/Backdrop/Backdrop.d.ts +20 -0
  49. package/dist/esm/components/Backdrop/Backdrop.stories.d.ts +9 -0
  50. package/dist/esm/components/Breadcrumb/Breadcrumb.d.ts +16 -0
  51. package/dist/esm/components/Breadcrumb/Breadcrumb.stories.d.ts +177 -0
  52. package/dist/esm/components/Button/Button.d.ts +13 -0
  53. package/dist/esm/components/Button/Button.stories.d.ts +100 -0
  54. package/dist/esm/components/Chips/Chips.d.ts +37 -0
  55. package/dist/esm/components/Chips/Chips.stories.d.ts +90 -0
  56. package/dist/esm/components/Divider/Divider.d.ts +25 -0
  57. package/dist/esm/components/Divider/Divider.stories.d.ts +88 -0
  58. package/dist/esm/components/Drawer/Drawer.d.ts +16 -0
  59. package/dist/esm/components/Drawer/Drawer.stories.d.ts +128 -0
  60. package/dist/esm/components/Input/Input.d.ts +24 -0
  61. package/dist/esm/components/Input/Input.stories.d.ts +131 -0
  62. package/dist/esm/components/Menu/Menu.d.ts +39 -0
  63. package/dist/esm/components/Menu/Menu.stories.d.ts +89 -0
  64. package/dist/esm/components/Pagination/Pagination.d.ts +12 -0
  65. package/dist/esm/components/Pagination/Pagination.stories.d.ts +76 -0
  66. package/dist/esm/components/RadioGroup/RadioGroup.d.ts +55 -0
  67. package/dist/esm/components/RadioGroup/RadioGroup.stories.d.ts +86 -0
  68. package/dist/esm/components/Select/Select.d.ts +17 -0
  69. package/dist/esm/components/Select/Select.stories.d.ts +104 -0
  70. package/dist/esm/components/Tabs/Tabs.d.ts +43 -0
  71. package/dist/esm/components/Tabs/Tabs.stories.d.ts +66 -0
  72. package/dist/esm/components/Typography/Typography.d.ts +9 -0
  73. package/dist/esm/components/Typography/Typography.stories.d.ts +57 -0
  74. package/dist/esm/contexts/MobileContext.d.ts +13 -0
  75. package/dist/esm/contexts.js +1485 -1
  76. package/dist/esm/index.d.ts +34 -0
  77. package/dist/esm/index.js +37 -1
  78. package/dist/esm/utils/cn.d.ts +2 -0
  79. package/dist/esm/utils.js +7 -1
  80. package/package.json +2 -7
  81. package/dist/cjs/ProtectedComponent.js +0 -1
  82. package/dist/cjs/licensing.js +0 -1
  83. package/dist/esm/ProtectedComponent.js +0 -1
  84. package/dist/esm/licensing.js +0 -1
  85. package/dist/types/Accordion.js +0 -54
  86. package/dist/types/Backdrop.js +0 -24
  87. package/dist/types/Breadcrumb.js +0 -56
  88. package/dist/types/Button.js +0 -46
  89. package/dist/types/Chips.js +0 -109
  90. package/dist/types/Divider.js +0 -21
  91. package/dist/types/Drawer.js +0 -107
  92. package/dist/types/Input.js +0 -78
  93. package/dist/types/Menu.js +0 -120
  94. package/dist/types/Pagination.js +0 -183
  95. package/dist/types/ProtectedComponent.js +0 -33
  96. package/dist/types/RadioGroup.js +0 -68
  97. package/dist/types/Tabs.js +0 -49
  98. package/dist/types/Typography.js +0 -60
  99. package/dist/types/components/ProtectedComponent.d.ts +0 -5
  100. package/dist/types/contexts.js +0 -1478
  101. package/dist/types/index.d.ts +0 -36
  102. package/dist/types/index.js +0 -38
  103. package/dist/types/licensing/LicenseManager.d.ts +0 -41
  104. package/dist/types/licensing/index.d.ts +0 -30
  105. package/dist/types/licensing.js +0 -125
  106. package/dist/types/utils.js +0 -7
  107. /package/dist/{types → cjs}/components/Accordion/Accordion.stories.d.ts +0 -0
  108. /package/dist/{types → cjs}/components/Backdrop/Backdrop.d.ts +0 -0
  109. /package/dist/{types → cjs}/components/Backdrop/Backdrop.stories.d.ts +0 -0
  110. /package/dist/{types → cjs}/components/Breadcrumb/Breadcrumb.stories.d.ts +0 -0
  111. /package/dist/{types → cjs}/components/Button/Button.d.ts +0 -0
  112. /package/dist/{types → cjs}/components/Button/Button.stories.d.ts +0 -0
  113. /package/dist/{types → cjs}/components/Chips/Chips.stories.d.ts +0 -0
  114. /package/dist/{types → cjs}/components/Divider/Divider.d.ts +0 -0
  115. /package/dist/{types → cjs}/components/Divider/Divider.stories.d.ts +0 -0
  116. /package/dist/{types → cjs}/components/Drawer/Drawer.stories.d.ts +0 -0
  117. /package/dist/{types → cjs}/components/Menu/Menu.d.ts +0 -0
  118. /package/dist/{types → cjs}/components/Menu/Menu.stories.d.ts +0 -0
  119. /package/dist/{types → cjs}/components/Pagination/Pagination.stories.d.ts +0 -0
  120. /package/dist/{types → cjs}/components/RadioGroup/RadioGroup.stories.d.ts +0 -0
  121. /package/dist/{types → cjs}/components/Tabs/Tabs.stories.d.ts +0 -0
  122. /package/dist/{types → cjs}/components/Typography/Typography.d.ts +0 -0
  123. /package/dist/{types → cjs}/components/Typography/Typography.stories.d.ts +0 -0
  124. /package/dist/{types → cjs}/utils/cn.d.ts +0 -0
  125. /package/dist/{types → esm}/chevron-left-Ck6O99eF.js +0 -0
  126. /package/dist/{types → esm}/createLucideIcon-D-q73LTT.js +0 -0
package/dist/cjs/Input.js CHANGED
@@ -1 +1,84 @@
1
- "use client";"use strict";var t=require("react/jsx-runtime"),e=require("react"),r=require("./utils.js");const l=e.forwardRef(({state:l="default",label:a,value:n,onChange:i,helperText:s,startIcon:o,endIcon:u,type:d="text",isMobile:x,...p},h)=>{const[m,c]=e.useState(!1),f=e.useId(),g=m||""!==n&&null!=n,b="disabled"===l,j=r("relative flex items-center border rounded-lg transition-all duration-300 w-[360px]",{"h-[54px]":!x,"h-12":x,"border-neutral-light":"default"===l&&!m,"border-primary":"default"===l&&m,"border-error":"error"===l,"bg-white border-neutral-light cursor-not-allowed":b}),w=r("absolute pointer-events-none transition-all duration-300",{"top-[-10px] bg-white px-1 mx-3 font-medium":g,"text-s":!x&&g||x&&!g,"text-xs":x&&g,"text-m":!x&&!g,"right-1":o,"right-3":!o,"top-1/2 -translate-y-1/2 text-m font-medium":!g,"right-11":!g&&o,"right-4":!g&&!o,"text-neutral-main":!m&&"default"===l,"text-neutral-light":b,"text-primary":m&&"default"===l,"text-error":g&&"error"===l}),y=r("peer w-full h-full bg-transparent outline-none text-m font-medium disabled:text-neutral-light",{"pr-12":o,"pl-12":u,"px-4":!o&&!u,"pr-4 pl-12":!o&&u,"pl-4 pr-12":o&&!u,"cursor-not-allowed text-red-500":b,"text-neutral-dark":!m,"text-neutral-darker":m}),v=r("absolute h-5 w-5 transition-colors duration-300",{"text-neutral-main":"error"!==l&&!m,"text-primary":"default"===l&&m,"text-error":"error"===l,"text-neutral-light":b}),N=r("font-light mt-1 px-2 h-4",{"text-s":!x,"text-xs":x,"text-neutral-main":"default"===l,"text-primary":"default"===l&&m,"text-error":"error"===l,"text-neutral-light":b});return t.jsxs("div",{children:[t.jsxs("div",{className:j,children:[u&&t.jsx("span",{className:r(v,"left-4"),children:u}),t.jsx("label",{htmlFor:f,className:w,children:a}),t.jsx("input",{ref:h,id:f,type:d,value:n,onChange:i,onFocus:t=>{b||(c(!0),p.onFocus?.(t))},onBlur:t=>{b||(c(!1),p.onBlur?.(t))},disabled:b,className:y,...p}),o&&t.jsx("span",{className:r(v,"right-4"),children:o})]}),s&&t.jsx("p",{className:N,children:s})]})});l.displayName="Input",exports.Input=l;
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;
package/dist/cjs/Menu.js CHANGED
@@ -1 +1,122 @@
1
- "use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("./utils.js"),a=require("./Typography.js");const o=r.forwardRef(({buttonText:o,items:n,disabled:i=!1,className:l,onOpenChange:s,isOpen:c,"aria-label":d,...u},p)=>{const[b,x]=r.useState(!1),f=r.useRef(null),h=r.useRef(null),v=void 0!==c?c:b,handleToggle=()=>{if(i)return;const e=!v;void 0===c&&x(e),s?.(e)};r.useEffect(()=>{const handleClickOutside=e=>{f.current&&!f.current.contains(e.target)&&(void 0===c&&x(!1),s?.(!1))};if(v)return document.addEventListener("mousedown",handleClickOutside),()=>{document.removeEventListener("mousedown",handleClickOutside)}},[v,c,s]);const m=t("inline-flex items-center justify-center","bg-white border border-[var(--color-neutral-light)]","rounded-[6px] px-[16px] py-[13px]","transition-colors duration-200","hover:bg-[var(--color-neutral-lighter)]","focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:ring-offset-2",{"opacity-50 cursor-not-allowed":i,"cursor-pointer":!i}),y=t("absolute top-full left-0 right-0 z-10 mt-[4px]","bg-white border border-[var(--color-neutral-light)]","rounded-[6px] py-[13px] px-[16px]","shadow-lg","transition-all duration-200",{"opacity-100 translate-y-0 pointer-events-auto":v,"opacity-0 -translate-y-2 pointer-events-none":!v}),g=t("block w-full text-right","transition-colors duration-200","hover:bg-[var(--color-neutral-lighter)] rounded-[4px] px-[8px] py-[4px] -mx-[8px]","focus:outline-none focus:bg-[var(--color-neutral-lighter)]");return e.jsx("div",{ref:p,className:t("relative inline-block",l),...u,children:e.jsxs("div",{ref:f,children:[e.jsx("button",{ref:h,type:"button",className:m,onClick:handleToggle,onKeyDown:e=>{if(!i)switch(e.key){case"Escape":v&&(e.preventDefault(),void 0===c&&x(!1),s?.(!1),h.current?.focus());break;case"ArrowDown":v||(e.preventDefault(),handleToggle());break;case"Enter":case" ":e.preventDefault(),handleToggle()}},disabled:i,"aria-expanded":v,"aria-haspopup":"true","aria-label":d||`منوی ${o}`,children:e.jsx(a.Typography,{variant:"body-s-heavy",color:"neutral-darker",className:"text-right",children:o})}),e.jsx("div",{className:y,children:e.jsx("div",{className:"flex flex-col gap-[16px]",children:n.map(r=>{const o=e.jsx(a.Typography,{variant:"body-s-heavy",color:r.disabled?"neutral-main":"neutral-darker",className:"text-right",children:r.label}),n={className:t(g,{"opacity-50 cursor-not-allowed":r.disabled,"cursor-pointer":!r.disabled}),onClick:r.disabled?void 0:()=>(e=>{e.disabled||(void 0===c&&x(!1),s?.(!1),e.onClick?.())})(r),"aria-label":`منوی ${r.label}`};return r.href&&!r.disabled?e.jsx("a",{...n,href:r.href,role:"menuitem",tabIndex:v?0:-1,children:o},r.id):e.jsx("button",{...n,type:"button",role:"menuitem",tabIndex:v?0:-1,disabled:r.disabled,children:o},r.id)})})})]})})});o.displayName="Menu",exports.Menu=o;
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 Menu = React.forwardRef(({ buttonText, items, disabled = false, className, onOpenChange, isOpen: controlledIsOpen, 'aria-label': ariaLabel, ...props }, ref) => {
9
+ const [internalIsOpen, setInternalIsOpen] = React.useState(false);
10
+ const menuRef = React.useRef(null);
11
+ const buttonRef = React.useRef(null);
12
+ // Use controlled or uncontrolled state
13
+ const isOpen = controlledIsOpen !== undefined ? controlledIsOpen : internalIsOpen;
14
+ const handleToggle = () => {
15
+ if (disabled)
16
+ return;
17
+ const newIsOpen = !isOpen;
18
+ if (controlledIsOpen === undefined) {
19
+ setInternalIsOpen(newIsOpen);
20
+ }
21
+ onOpenChange?.(newIsOpen);
22
+ };
23
+ const handleItemClick = (item) => {
24
+ if (item.disabled)
25
+ return;
26
+ // Close menu after item click
27
+ if (controlledIsOpen === undefined) {
28
+ setInternalIsOpen(false);
29
+ }
30
+ onOpenChange?.(false);
31
+ // Execute item's onClick if provided
32
+ item.onClick?.();
33
+ };
34
+ // Close menu when clicking outside
35
+ React.useEffect(() => {
36
+ const handleClickOutside = (event) => {
37
+ if (menuRef.current &&
38
+ !menuRef.current.contains(event.target)) {
39
+ if (controlledIsOpen === undefined) {
40
+ setInternalIsOpen(false);
41
+ }
42
+ onOpenChange?.(false);
43
+ }
44
+ };
45
+ if (isOpen) {
46
+ document.addEventListener('mousedown', handleClickOutside);
47
+ return () => {
48
+ document.removeEventListener('mousedown', handleClickOutside);
49
+ };
50
+ }
51
+ return undefined;
52
+ }, [isOpen, controlledIsOpen, onOpenChange]);
53
+ // Handle keyboard navigation
54
+ const handleKeyDown = (event) => {
55
+ if (disabled)
56
+ return;
57
+ switch (event.key) {
58
+ case 'Escape':
59
+ if (isOpen) {
60
+ event.preventDefault();
61
+ if (controlledIsOpen === undefined) {
62
+ setInternalIsOpen(false);
63
+ }
64
+ onOpenChange?.(false);
65
+ buttonRef.current?.focus();
66
+ }
67
+ break;
68
+ case 'ArrowDown':
69
+ if (!isOpen) {
70
+ event.preventDefault();
71
+ handleToggle();
72
+ }
73
+ break;
74
+ case 'Enter':
75
+ case ' ':
76
+ event.preventDefault();
77
+ handleToggle();
78
+ break;
79
+ }
80
+ };
81
+ const buttonClasses = utils(
82
+ // Base button styles matching Figma design
83
+ 'inline-flex items-center justify-center', 'bg-white border border-[var(--color-neutral-light)]', 'rounded-[6px] px-[16px] py-[13px]', 'transition-colors duration-200',
84
+ // Interactive states
85
+ 'hover:bg-[var(--color-neutral-lighter)]', 'focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] focus:ring-offset-2',
86
+ // Disabled state
87
+ {
88
+ 'opacity-50 cursor-not-allowed': disabled,
89
+ 'cursor-pointer': !disabled,
90
+ });
91
+ const dropdownClasses = utils(
92
+ // Base dropdown styles
93
+ 'absolute top-full left-0 right-0 z-10 mt-[4px]', 'bg-white border border-[var(--color-neutral-light)]', 'rounded-[6px] py-[13px] px-[16px]', 'shadow-lg',
94
+ // Animation
95
+ 'transition-all duration-200', {
96
+ 'opacity-100 translate-y-0 pointer-events-auto': isOpen,
97
+ 'opacity-0 -translate-y-2 pointer-events-none': !isOpen,
98
+ });
99
+ const itemClasses = utils('block w-full text-right', 'transition-colors duration-200', 'hover:bg-[var(--color-neutral-lighter)] rounded-[4px] px-[8px] py-[4px] -mx-[8px]', 'focus:outline-none focus:bg-[var(--color-neutral-lighter)]');
100
+ return (jsxRuntime.jsx("div", { ref: ref, className: utils('relative inline-block', className), ...props, children: jsxRuntime.jsxs("div", { ref: menuRef, children: [jsxRuntime.jsx("button", { ref: buttonRef, type: "button", className: buttonClasses, onClick: handleToggle, onKeyDown: handleKeyDown, disabled: disabled, "aria-expanded": isOpen, "aria-haspopup": "true", "aria-label": ariaLabel || `منوی ${buttonText}`, children: jsxRuntime.jsx(Typography.Typography, { variant: "body-s-heavy", color: "neutral-darker", className: "text-right", children: buttonText }) }), jsxRuntime.jsx("div", { className: dropdownClasses, children: jsxRuntime.jsx("div", { className: "flex flex-col gap-[16px]", children: items.map((item) => {
101
+ const content = (jsxRuntime.jsx(Typography.Typography, { variant: "body-s-heavy", color: item.disabled ? 'neutral-main' : 'neutral-darker', className: "text-right", children: item.label }));
102
+ const commonProps = {
103
+ className: utils(itemClasses, {
104
+ 'opacity-50 cursor-not-allowed': item.disabled,
105
+ 'cursor-pointer': !item.disabled,
106
+ }),
107
+ onClick: item.disabled
108
+ ? undefined
109
+ : () => handleItemClick(item),
110
+ 'aria-label': `منوی ${item.label}`,
111
+ };
112
+ // Render as link if href is provided
113
+ if (item.href && !item.disabled) {
114
+ return (jsxRuntime.jsx("a", { ...commonProps, href: item.href, role: "menuitem", tabIndex: isOpen ? 0 : -1, children: content }, item.id));
115
+ }
116
+ // Render as button
117
+ return (jsxRuntime.jsx("button", { ...commonProps, type: "button", role: "menuitem", tabIndex: isOpen ? 0 : -1, disabled: item.disabled, children: content }, item.id));
118
+ }) }) })] }) }));
119
+ });
120
+ Menu.displayName = 'Menu';
121
+
122
+ exports.Menu = Menu;
@@ -1 +1,188 @@
1
- "use client";"use strict";var e=require("react/jsx-runtime"),i=require("react"),a=require("./utils.js"),n=require("./chunks/createLucideIcon-BqJVOzoK.js"),t=require("./chunks/chevron-left-Do__K6cA.js");const r=n.createLucideIcon("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),s=n.createLucideIcon("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]),c=n.createLucideIcon("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]),l=n.createLucideIcon("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);function PaginationRoot({className:i,...n}){return e.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:a("mx-auto flex w-full justify-center",i),...n})}function PaginationContent({className:i,device:n,...t}){return e.jsx("ul",{"data-slot":"pagination-content",className:a("flex flex-row items-center","mobile"===n?"gap-[6px]":"gap-2",i),...t})}function PaginationItem({...i}){return e.jsx("li",{"data-slot":"pagination-item",...i})}function PaginationLink({className:i,device:n,variant:t,isActive:r,...s}){return e.jsx("a",{"aria-current":r?"page":void 0,"data-slot":"pagination-link","data-active":r,className:a(buttonVariants({variant:"nextPrev"===t?t:r?"active":"outline",device:n}),i),tabIndex:s["aria-disabled"]?-1:0,...s})}function PaginationPrevious({className:i,device:a,variant:n,...t}){const s="mobile"===a,l={mobile:e.jsx(r,{size:18}),desktop:e.jsxs(e.Fragment,{children:[e.jsx(c,{size:20})," ",e.jsx("span",{children:"قبلی"})]})};return e.jsx(PaginationLink,{"aria-label":"Go to previous page",className:s?"ml-2.5":"flex justify-center items-center gap-2 w-[89px] h-[48px] ml-4",device:a,variant:"nextPrev",...t,children:"mobile"===a?l.mobile:l.desktop})}function PaginationNext({className:i,device:a,variant:n,...r}){const c="mobile"===a,l={mobile:e.jsx(t.ChevronLeft,{size:18}),desktop:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"بعدی"}),e.jsx(s,{size:20})]})};return e.jsx(PaginationLink,{"aria-label":"Go to next page",className:c?"mr-2.5":"flex justify-center items-center gap-2 w-[89px] h-[48px] mr-4",device:a,variant:"nextPrev",...r,children:"mobile"===a?l.mobile:l.desktop})}function PaginationEllipsis({className:i,...n}){return e.jsx("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:a("flex size-9 items-center justify-center",i),...n,children:e.jsx(l,{className:"size-4"})})}function buttonVariants({variant:e,device:i}){const n="mobile"===i;return[a({"flex items-center justify-center rounded-[6px]":!0,"w-[40px] h-[40px] text-s font-heavy":n,"w-[48px] h-[48px] text-l font-heavy":!n}),{outline:"border border-neutral-light bg-white text-neutral-darker",active:"bg-primary text-white",nextPrev:"border border-neutral-light bg-white text-neutral-darker"}[e]].join(" ")}exports.Pagination=({pageCount:a,page:n,defaultPage:t=1,onPageChange:r,className:s,isMobile:c,...l})=>{const o=void 0!==n,[d,x]=i.useState(t),u=o?n:d,h=c?"mobile":"desktop";i.useEffect(()=>{o||x(t)},[t,o]);const changePage=e=>{o||x(e),r?.(e)};return e.jsx(PaginationRoot,{className:s,...l,children:e.jsxs(PaginationContent,{device:"mobile",children:[e.jsx(PaginationItem,{children:e.jsx(PaginationPrevious,{href:"#",onClick:e=>{e.preventDefault(),u>1&&changePage(u-1)},variant:"nextPrev",device:h,"aria-disabled":1===u,tabIndex:1===u?-1:0})}),function(){const i=[];if(a<=5)for(let n=1;n<=a;n++)i.push(e.jsx(PaginationItem,{children:e.jsx(PaginationLink,{href:"#",isActive:u===n,variant:"main",device:h,onClick:e=>{e.preventDefault(),u!==n&&changePage(n)},"aria-disabled":u===n,tabIndex:u===n?-1:0,children:n})},n));else{i.push(e.jsx(PaginationItem,{children:e.jsx(PaginationLink,{href:"#",isActive:1===u,device:h,variant:"main",onClick:e=>{e.preventDefault(),1!==u&&changePage(1)},"aria-disabled":1===u,tabIndex:1===u?-1:0,children:"1"})},1)),u>3&&i.push(e.jsx(PaginationItem,{children:e.jsx(PaginationEllipsis,{})},"start-ellipsis"));const n=Math.max(2,u-1),t=Math.min(a-1,u+1);for(let a=n;a<=t;a++)i.push(e.jsx(PaginationItem,{children:e.jsx(PaginationLink,{href:"#",isActive:u===a,device:h,variant:"main",onClick:e=>{e.preventDefault(),u!==a&&changePage(a)},"aria-disabled":u===a,tabIndex:u===a?-1:0,children:a})},a));u<a-2&&i.push(e.jsx(PaginationItem,{children:e.jsx(PaginationEllipsis,{})},"end-ellipsis")),i.push(e.jsx(PaginationItem,{children:e.jsx(PaginationLink,{href:"#",isActive:u===a,device:h,variant:"main",onClick:e=>{e.preventDefault(),u!==a&&changePage(a)},"aria-disabled":u===a,tabIndex:u===a?-1:0,children:a})},a))}return i}(),e.jsx(PaginationItem,{children:e.jsx(PaginationNext,{href:"#",onClick:e=>{e.preventDefault(),u<a&&changePage(u+1)},variant:"nextPrev",device:h,"aria-disabled":u===a,tabIndex:u===a?-1:0})})]})})};
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 createLucideIcon = require('./createLucideIcon-BTjFFtDc.js');
8
+ var chevronLeft = require('./chevron-left-COj1qGVo.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$3 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
19
+ const ChevronRight = createLucideIcon.createLucideIcon("chevron-right", __iconNode$3);
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$2 = [
30
+ ["path", { d: "m11 17-5-5 5-5", key: "13zhaf" }],
31
+ ["path", { d: "m18 17-5-5 5-5", key: "h8a8et" }]
32
+ ];
33
+ const ChevronsLeft = createLucideIcon.createLucideIcon("chevrons-left", __iconNode$2);
34
+
35
+ /**
36
+ * @license lucide-react v0.522.0 - ISC
37
+ *
38
+ * This source code is licensed under the ISC license.
39
+ * See the LICENSE file in the root directory of this source tree.
40
+ */
41
+
42
+
43
+ const __iconNode$1 = [
44
+ ["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
45
+ ["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }]
46
+ ];
47
+ const ChevronsRight = createLucideIcon.createLucideIcon("chevrons-right", __iconNode$1);
48
+
49
+ /**
50
+ * @license lucide-react v0.522.0 - ISC
51
+ *
52
+ * This source code is licensed under the ISC license.
53
+ * See the LICENSE file in the root directory of this source tree.
54
+ */
55
+
56
+
57
+ const __iconNode = [
58
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
59
+ ["circle", { cx: "19", cy: "12", r: "1", key: "1wjl8i" }],
60
+ ["circle", { cx: "5", cy: "12", r: "1", key: "1pcz8c" }]
61
+ ];
62
+ const Ellipsis = createLucideIcon.createLucideIcon("ellipsis", __iconNode);
63
+
64
+ function PaginationRoot({ className, ...props }) {
65
+ return (jsxRuntime.jsx("nav", { role: "navigation", "aria-label": "pagination", "data-slot": "pagination", className: utils('mx-auto flex w-full justify-center', className), ...props }));
66
+ }
67
+ function PaginationContent({ className, device, ...props }) {
68
+ return (jsxRuntime.jsx("ul", { "data-slot": "pagination-content", className: utils('flex flex-row items-center', device === 'mobile' ? 'gap-[6px]' : 'gap-2', className), ...props }));
69
+ }
70
+ function PaginationItem({ ...props }) {
71
+ return jsxRuntime.jsx("li", { "data-slot": "pagination-item", ...props });
72
+ }
73
+ function PaginationLink({ className, device, variant, isActive, ...props }) {
74
+ return (jsxRuntime.jsx("a", { "aria-current": isActive ? 'page' : undefined, "data-slot": "pagination-link", "data-active": isActive, className: utils(buttonVariants({
75
+ variant: variant === 'nextPrev' ? variant : isActive ? 'active' : 'outline',
76
+ device,
77
+ }), className), tabIndex: props['aria-disabled'] ? -1 : 0, ...props }));
78
+ }
79
+ function PaginationPrevious({ className, device, variant, ...props }) {
80
+ const isMobile = device === 'mobile';
81
+ const content = {
82
+ mobile: jsxRuntime.jsx(ChevronRight, { size: 18 }),
83
+ desktop: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ChevronsRight, { size: 20 }), " ", jsxRuntime.jsx("span", { children: "\u0642\u0628\u0644\u06CC" })] })),
84
+ };
85
+ return (jsxRuntime.jsx(PaginationLink, { "aria-label": "Go to previous page", className: !isMobile
86
+ ? 'flex justify-center items-center gap-2 w-[89px] h-[48px] ml-4'
87
+ : 'ml-2.5', device: device, variant: "nextPrev", ...props, children: device === 'mobile' ? content.mobile : content.desktop }));
88
+ }
89
+ function PaginationNext({ className, device, variant, ...props }) {
90
+ const isMobile = device === 'mobile';
91
+ const content = {
92
+ mobile: jsxRuntime.jsx(chevronLeft.ChevronLeft, { size: 18 }),
93
+ desktop: (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { children: "\u0628\u0639\u062F\u06CC" }), jsxRuntime.jsx(ChevronsLeft, { size: 20 })] })),
94
+ };
95
+ return (jsxRuntime.jsx(PaginationLink, { "aria-label": "Go to next page", className: !isMobile
96
+ ? 'flex justify-center items-center gap-2 w-[89px] h-[48px] mr-4'
97
+ : 'mr-2.5', device: device, variant: "nextPrev", ...props, children: device === 'mobile' ? content.mobile : content.desktop }));
98
+ }
99
+ function PaginationEllipsis({ className, ...props }) {
100
+ return (jsxRuntime.jsx("span", { "aria-hidden": true, "data-slot": "pagination-ellipsis", className: utils('flex size-9 items-center justify-center', className), ...props, children: jsxRuntime.jsx(Ellipsis, { className: "size-4" }) }));
101
+ }
102
+ function buttonVariants({ variant, device, }) {
103
+ const isMobile = device === 'mobile';
104
+ const base = utils({
105
+ 'flex items-center justify-center rounded-[6px]': true,
106
+ 'w-[40px] h-[40px] text-s font-heavy': isMobile,
107
+ 'w-[48px] h-[48px] text-l font-heavy': !isMobile,
108
+ });
109
+ const variants = {
110
+ outline: 'border border-neutral-light bg-white text-neutral-darker',
111
+ active: 'bg-primary text-white',
112
+ nextPrev: 'border border-neutral-light bg-white text-neutral-darker',
113
+ };
114
+ return [base, variants[variant]].join(' ');
115
+ }
116
+ const Pagination = ({ pageCount, page: controlledPage, defaultPage = 1, onPageChange, className, isMobile, ...navProps }) => {
117
+ const detectedIsMobile = contexts.useMobile();
118
+ const actualIsMobile = isMobile ?? detectedIsMobile;
119
+ const isControlled = controlledPage !== undefined;
120
+ const [internalPage, setInternalPage] = React.useState(defaultPage);
121
+ const page = isControlled ? controlledPage : internalPage;
122
+ const device = actualIsMobile ? 'mobile' : 'desktop';
123
+ React.useEffect(() => {
124
+ if (!isControlled)
125
+ setInternalPage(defaultPage);
126
+ }, [defaultPage, isControlled]);
127
+ const changePage = (newPage) => {
128
+ if (!isControlled)
129
+ setInternalPage(newPage);
130
+ onPageChange?.(newPage);
131
+ };
132
+ function renderPages() {
133
+ const items = [];
134
+ if (pageCount <= 5) {
135
+ for (let i = 1; i <= pageCount; i++) {
136
+ items.push(jsxRuntime.jsx(PaginationItem, { children: jsxRuntime.jsx(PaginationLink, { href: "#", isActive: page === i, variant: "main", device: device, onClick: (e) => {
137
+ e.preventDefault();
138
+ if (page !== i)
139
+ changePage(i);
140
+ }, "aria-disabled": page === i, tabIndex: page === i ? -1 : 0, children: i }) }, i));
141
+ }
142
+ }
143
+ else {
144
+ // First page
145
+ items.push(jsxRuntime.jsx(PaginationItem, { children: jsxRuntime.jsx(PaginationLink, { href: "#", isActive: page === 1, device: device, variant: "main", onClick: (e) => {
146
+ e.preventDefault();
147
+ if (page !== 1)
148
+ changePage(1);
149
+ }, "aria-disabled": page === 1, tabIndex: page === 1 ? -1 : 0, children: "1" }) }, 1));
150
+ // Ellipsis start
151
+ if (page > 3) {
152
+ items.push(jsxRuntime.jsx(PaginationItem, { children: jsxRuntime.jsx(PaginationEllipsis, {}) }, "start-ellipsis"));
153
+ }
154
+ // Middle pages
155
+ const start = Math.max(2, page - 1);
156
+ const end = Math.min(pageCount - 1, page + 1);
157
+ for (let i = start; i <= end; i++) {
158
+ items.push(jsxRuntime.jsx(PaginationItem, { children: jsxRuntime.jsx(PaginationLink, { href: "#", isActive: page === i, device: device, variant: "main", onClick: (e) => {
159
+ e.preventDefault();
160
+ if (page !== i)
161
+ changePage(i);
162
+ }, "aria-disabled": page === i, tabIndex: page === i ? -1 : 0, children: i }) }, i));
163
+ }
164
+ // Ellipsis end
165
+ if (page < pageCount - 2) {
166
+ items.push(jsxRuntime.jsx(PaginationItem, { children: jsxRuntime.jsx(PaginationEllipsis, {}) }, "end-ellipsis"));
167
+ }
168
+ // Last page
169
+ items.push(jsxRuntime.jsx(PaginationItem, { children: jsxRuntime.jsx(PaginationLink, { href: "#", isActive: page === pageCount, device: device, variant: "main", onClick: (e) => {
170
+ e.preventDefault();
171
+ if (page !== pageCount)
172
+ changePage(pageCount);
173
+ }, "aria-disabled": page === pageCount, tabIndex: page === pageCount ? -1 : 0, children: pageCount }) }, pageCount));
174
+ }
175
+ return items;
176
+ }
177
+ return (jsxRuntime.jsx(PaginationRoot, { className: className, ...navProps, children: jsxRuntime.jsxs(PaginationContent, { device: "mobile", children: [jsxRuntime.jsx(PaginationItem, { children: jsxRuntime.jsx(PaginationPrevious, { href: "#", onClick: (e) => {
178
+ e.preventDefault();
179
+ if (page > 1)
180
+ changePage(page - 1);
181
+ }, variant: "nextPrev", device: device, "aria-disabled": page === 1, tabIndex: page === 1 ? -1 : 0 }) }), renderPages(), jsxRuntime.jsx(PaginationItem, { children: jsxRuntime.jsx(PaginationNext, { href: "#", onClick: (e) => {
182
+ e.preventDefault();
183
+ if (page < pageCount)
184
+ changePage(page + 1);
185
+ }, variant: "nextPrev", device: device, "aria-disabled": page === pageCount, tabIndex: page === pageCount ? -1 : 0 }) })] }) }));
186
+ };
187
+
188
+ exports.Pagination = Pagination;
@@ -1 +1,73 @@
1
- "use client";"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("./utils.js");const RadioButton=({selected:r,disabled:s,isMobile:a})=>{const l=a?"size-5":"size-6";return r?e.jsxs("div",{className:i("relative flex items-center justify-center",l),children:[e.jsx("div",{className:i("absolute inset-0 rounded-full border-2",s?"bg-neutral-light border-neutral-light":"bg-primary border-primary")}),e.jsx("div",{className:i("absolute rounded-full bg-white",a?"inset-[5px]":"inset-1.5")})]}):e.jsx("div",{className:i("relative flex items-center justify-center",l),children:e.jsx("div",{className:i("absolute inset-0 rounded-full border",a?"border":"border-[1.5px]",s?"border-neutral-light":"border-midnight")})})},RadioOptionComponent=({option:s,selected:a,disabled:l,onClick:t,name:n,isMobile:d})=>{const[o,c]=r.useState(!1),getTextColor=()=>l?"text-midnight":a?"text-primary":"text-neutral-dark";return e.jsx("div",{className:i("relative rounded-lg border-[1.5px] cursor-pointer transition-all duration-200",l?"bg-neutral-lighter":a?"bg-primary-lightest":o?"bg-primary-lightest/20":"bg-white",a?"border-primary":"border-transparent",l?"":"shadow-[0px_2px_4px_0px_rgba(0,0,0,0.08)]",l&&"cursor-not-allowed"),onClick:l?void 0:t,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||l||(e.preventDefault(),t())},tabIndex:l?-1:0,role:"radio","aria-checked":a,"aria-disabled":l,children:e.jsx("div",{className:"flex flex-row items-center justify-end relative w-full",children:e.jsx("div",{className:i("box-border flex flex-row items-center justify-end relative w-full",d?"gap-2 px-4 py-3":"gap-4 px-6 py-4"),children:e.jsxs("div",{className:i("flex flex-row items-center justify-end p-0 relative shrink-0",d?"gap-2":"gap-3"),children:[e.jsx("input",{type:"radio",name:n,value:s.id,checked:a,disabled:l,onChange:t,className:"sr-only","aria-label":s.label}),e.jsx("div",{className:"flex flex-col gap-0.5 items-end justify-start p-0 relative shrink-0",children:e.jsx("div",{className:i("font-sans font-bold text-nowrap text-right transition-colors duration-200",d?"text-[14px] leading-[24px]":"text-[16px] leading-normal",getTextColor()),children:e.jsx("p",{className:"whitespace-pre",dir:"auto",children:s.label})})}),s.icon&&e.jsx("div",{className:i("flex items-center justify-center shrink-0 transition-colors duration-200",d?"size-6":"size-7",getTextColor()),children:s.icon}),e.jsx("div",{className:"flex flex-col items-start justify-start p-0 relative shrink-0",children:e.jsx(RadioButton,{selected:a,disabled:l,isMobile:d})})]})})})})},s=r.forwardRef(({options:r,value:s,onChange:a,name:l,disabled:t=!1,className:n,isMobile:d,direction:o="vertical",...c},x)=>e.jsx("div",{ref:x,className:"horizontal"===o?i("flex flex-row gap-2",d?"flex-wrap":"flex-nowrap",n):i("flex flex-col gap-2",n),role:"radiogroup",...c,children:r.map(r=>e.jsx(RadioOptionComponent,{option:r,selected:s===r.id,disabled:t||r.disabled,onClick:()=>{return e=r.id,void(!t&&a&&a(e));var e},name:l,isMobile:d},r.id))}));s.displayName="RadioGroup",exports.RadioGroup=s;
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 RadioButton = ({ selected, disabled, isMobile, }) => {
9
+ const size = isMobile ? 'size-5' : 'size-6';
10
+ if (selected) {
11
+ return (jsxRuntime.jsxs("div", { className: utils('relative flex items-center justify-center', size), children: [jsxRuntime.jsx("div", { className: utils('absolute inset-0 rounded-full border-2', disabled
12
+ ? 'bg-neutral-light border-neutral-light'
13
+ : 'bg-primary border-primary') }), jsxRuntime.jsx("div", { className: utils('absolute rounded-full bg-white', isMobile ? 'inset-[5px]' : 'inset-1.5') })] }));
14
+ }
15
+ return (jsxRuntime.jsx("div", { className: utils('relative flex items-center justify-center', size), children: jsxRuntime.jsx("div", { className: utils('absolute inset-0 rounded-full border', isMobile ? 'border' : 'border-[1.5px]', disabled ? 'border-neutral-light' : 'border-midnight') }) }));
16
+ };
17
+ const RadioOptionComponent = ({ option, selected, disabled, onClick, name, isMobile = false, }) => {
18
+ const [isHovered, setIsHovered] = React.useState(false);
19
+ const handleKeyDown = (e) => {
20
+ if ((e.key === 'Enter' || e.key === ' ') && !disabled) {
21
+ e.preventDefault();
22
+ onClick();
23
+ }
24
+ };
25
+ const getBackgroundColor = () => {
26
+ if (disabled)
27
+ return 'bg-neutral-lighter';
28
+ if (selected)
29
+ return 'bg-primary-lightest';
30
+ if (isHovered)
31
+ return 'bg-primary-lightest/20';
32
+ return 'bg-white';
33
+ };
34
+ const getBorderColor = () => {
35
+ if (selected)
36
+ return 'border-primary';
37
+ return 'border-transparent';
38
+ };
39
+ const getTextColor = () => {
40
+ if (disabled)
41
+ return 'text-midnight';
42
+ if (selected)
43
+ return 'text-primary';
44
+ return 'text-neutral-dark';
45
+ };
46
+ const getShadow = () => {
47
+ if (disabled)
48
+ return '';
49
+ return 'shadow-[0px_2px_4px_0px_rgba(0,0,0,0.08)]';
50
+ };
51
+ return (jsxRuntime.jsx("div", { className: utils('relative rounded-lg border-[1.5px] cursor-pointer transition-all duration-200', getBackgroundColor(), getBorderColor(), getShadow(), disabled && 'cursor-not-allowed'), onClick: disabled ? undefined : onClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onKeyDown: handleKeyDown, tabIndex: disabled ? -1 : 0, role: "radio", "aria-checked": selected, "aria-disabled": disabled, children: jsxRuntime.jsx("div", { className: "flex flex-row items-center justify-end relative w-full", children: jsxRuntime.jsx("div", { className: utils('box-border flex flex-row items-center justify-end relative w-full', isMobile ? 'gap-2 px-4 py-3' : 'gap-4 px-6 py-4'), children: jsxRuntime.jsxs("div", { className: utils('flex flex-row items-center justify-end p-0 relative shrink-0', isMobile ? 'gap-2' : 'gap-3'), children: [jsxRuntime.jsx("input", { type: "radio", name: name, value: option.id, checked: selected, disabled: disabled, onChange: onClick, className: "sr-only", "aria-label": option.label }), jsxRuntime.jsx("div", { className: "flex flex-col gap-0.5 items-end justify-start p-0 relative shrink-0", children: jsxRuntime.jsx("div", { className: utils('font-sans font-bold text-nowrap text-right transition-colors duration-200', isMobile
52
+ ? 'text-[14px] leading-[24px]'
53
+ : 'text-[16px] leading-normal', getTextColor()), children: jsxRuntime.jsx("p", { className: "whitespace-pre", dir: "auto", children: option.label }) }) }), option.icon && (jsxRuntime.jsx("div", { className: utils('flex items-center justify-center shrink-0 transition-colors duration-200', isMobile ? 'size-6' : 'size-7', getTextColor()), children: option.icon })), jsxRuntime.jsx("div", { className: "flex flex-col items-start justify-start p-0 relative shrink-0", children: jsxRuntime.jsx(RadioButton, { selected: selected, disabled: disabled, isMobile: isMobile }) })] }) }) }) }));
54
+ };
55
+ const RadioGroup = React.forwardRef(({ options, value, onChange, name, disabled = false, className, isMobile, direction = 'vertical', ...props }, ref) => {
56
+ const detectedIsMobile = contexts.useMobile();
57
+ const actualIsMobile = isMobile ?? detectedIsMobile;
58
+ const handleOptionClick = (optionId) => {
59
+ if (!disabled && onChange) {
60
+ onChange(optionId);
61
+ }
62
+ };
63
+ const getContainerClasses = () => {
64
+ if (direction === 'horizontal') {
65
+ return utils('flex flex-row gap-2', actualIsMobile ? 'flex-wrap' : 'flex-nowrap', className);
66
+ }
67
+ return utils('flex flex-col gap-2', className);
68
+ };
69
+ return (jsxRuntime.jsx("div", { ref: ref, className: getContainerClasses(), role: "radiogroup", ...props, children: options.map((option) => (jsxRuntime.jsx(RadioOptionComponent, { option: option, selected: value === option.id, disabled: disabled || option.disabled, onClick: () => handleOptionClick(option.id), name: name, isMobile: actualIsMobile }, option.id))) }));
70
+ });
71
+ RadioGroup.displayName = 'RadioGroup';
72
+
73
+ exports.RadioGroup = RadioGroup;
package/dist/cjs/Tabs.js CHANGED
@@ -1 +1,54 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),i=require("./utils.js");const renderBadge=(t,r,a,s)=>void 0===t?null:e.jsx("div",{className:i("flex items-center justify-center rounded-[5px] font-sans font-bold text-white","transition-colors duration-200",s?"size-6 text-[14px] pt-0.5":"size-[25px] text-[14px] pt-[3px]",a?"bg-midnight":r?"bg-primary":"bg-neutral-main"),children:e.jsx("p",{className:"leading-[24px] whitespace-pre",dir:"auto",children:t})}),renderTabContent=(t,r,a)=>{const s=void 0!==t.count;return e.jsxs("div",{className:i("flex flex-row items-center justify-start transition-colors duration-200","gap-1.5"),children:[s&&renderBadge(t.count,r,t.disabled,a),e.jsx("div",{className:i("font-sans text-nowrap text-right transition-colors duration-200",a?"text-[14px]":r?"text-[16px]":"text-[18px]",t.disabled?"font-normal text-midnight":r?"font-bold text-primary":"font-normal text-neutral-main",a?"leading-[24px]":r?"leading-normal":"leading-[1.9]"),children:e.jsx("p",{className:"whitespace-pre",dir:"auto",children:t.label})})]})},r=t.forwardRef(({items:t,activeTab:r,onTabChange:a,className:s,isMobile:l,...n},d)=>e.jsxs("div",{ref:d,className:i("relative w-full",s),...n,children:[e.jsx("div",{className:"box-border flex flex-row items-center justify-end p-0 relative w-full",children:t.map(t=>((t,r,a,s)=>{const l=t.id===r;return e.jsxs("div",{className:i("box-border flex flex-col items-center justify-between relative shrink-0","cursor-pointer transition-all duration-200",a?"h-12 px-3":"h-14 px-4",l?a?"pt-[11px] pb-0":"pt-3.5 pb-0":"py-0 justify-center",t.disabled&&"cursor-not-allowed opacity-50",!t.disabled&&"hover:opacity-80"),onClick:()=>((e,t,i)=>{t||i(e)})(t.id,t.disabled,s),onKeyDown:e=>((e,t,i,r)=>{"Enter"!==e.key&&" "!==e.key||i||(e.preventDefault(),r(t))})(e,t.id,t.disabled,s),tabIndex:t.disabled?-1:0,role:"tab","aria-selected":l,"aria-disabled":t.disabled,children:[renderTabContent(t,l,a),l&&e.jsx("div",{className:"bg-primary h-1 rounded-tl-[8px] rounded-tr-[8px] shrink-0 w-full"})]},t.id)})(t,r,l,a))}),e.jsx("div",{className:"absolute border-midnight-light border-[0px_0px_1px] border-solid bottom-[-0.5px] left-0 right-0 top-0 pointer-events-none"})]}));r.displayName="Tabs",exports.Tabs=r;
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
+ // Helper functions moved outside component
9
+ const handleTabClick = (tabId, disabled, onTabChange) => {
10
+ if (!disabled) {
11
+ onTabChange(tabId);
12
+ }
13
+ };
14
+ const handleKeyDown = (e, tabId, disabled, onTabChange) => {
15
+ if ((e.key === 'Enter' || e.key === ' ') && !disabled) {
16
+ e.preventDefault();
17
+ onTabChange(tabId);
18
+ }
19
+ };
20
+ const renderBadge = (count, isActive, disabled, isMobile) => {
21
+ if (count === undefined)
22
+ return null;
23
+ return (jsxRuntime.jsx("div", { className: utils('flex items-center justify-center rounded-[5px] font-sans font-bold text-white', 'transition-colors duration-200', isMobile
24
+ ? 'size-6 text-[14px] pt-0.5'
25
+ : 'size-[25px] text-[14px] pt-[3px]', disabled ? 'bg-midnight' : isActive ? 'bg-primary' : 'bg-neutral-main'), children: jsxRuntime.jsx("p", { className: "leading-[24px] whitespace-pre", dir: "auto", children: count }) }));
26
+ };
27
+ const renderTabContent = (item, isActive, isMobile) => {
28
+ const hasCount = item.count !== undefined;
29
+ return (jsxRuntime.jsxs("div", { className: utils('flex flex-row items-center justify-start transition-colors duration-200', isMobile ? 'gap-1.5' : 'gap-1.5'), children: [hasCount && renderBadge(item.count, isActive, item.disabled, isMobile), jsxRuntime.jsx("div", { className: utils('font-sans text-nowrap text-right transition-colors duration-200', isMobile ? 'text-[14px]' : isActive ? 'text-[16px]' : 'text-[18px]', item.disabled
30
+ ? 'font-normal text-midnight'
31
+ : isActive
32
+ ? 'font-bold text-primary'
33
+ : 'font-normal text-neutral-main', isMobile
34
+ ? 'leading-[24px]'
35
+ : isActive
36
+ ? 'leading-normal'
37
+ : 'leading-[1.9]'), children: jsxRuntime.jsx("p", { className: "whitespace-pre", dir: "auto", children: item.label }) })] }));
38
+ };
39
+ const renderTab = (item, activeTab, isMobile, onTabChange) => {
40
+ const isActive = item.id === activeTab;
41
+ return (jsxRuntime.jsxs("div", { className: utils('box-border flex flex-col items-center justify-between relative shrink-0', 'cursor-pointer transition-all duration-200', isMobile ? 'h-12 px-3' : 'h-14 px-4', isActive
42
+ ? isMobile
43
+ ? 'pt-[11px] pb-0'
44
+ : 'pt-3.5 pb-0'
45
+ : 'py-0 justify-center', item.disabled && 'cursor-not-allowed opacity-50', !item.disabled && 'hover:opacity-80'), onClick: () => handleTabClick(item.id, item.disabled, onTabChange), onKeyDown: (e) => handleKeyDown(e, item.id, item.disabled, onTabChange), tabIndex: item.disabled ? -1 : 0, role: "tab", "aria-selected": isActive, "aria-disabled": item.disabled, children: [renderTabContent(item, isActive, isMobile), isActive && (jsxRuntime.jsx("div", { className: "bg-primary h-1 rounded-tl-[8px] rounded-tr-[8px] shrink-0 w-full" }))] }, item.id));
46
+ };
47
+ const Tabs = React.forwardRef(({ items, activeTab, onTabChange, className, isMobile, ...props }, ref) => {
48
+ const detectedIsMobile = contexts.useMobile();
49
+ const actualIsMobile = isMobile ?? detectedIsMobile;
50
+ return (jsxRuntime.jsxs("div", { ref: ref, className: utils('relative w-full', className), ...props, children: [jsxRuntime.jsx("div", { className: "box-border flex flex-row items-center justify-end p-0 relative w-full", children: items.map((item) => renderTab(item, activeTab, actualIsMobile, onTabChange)) }), jsxRuntime.jsx("div", { className: "absolute border-midnight-light border-[0px_0px_1px] border-solid bottom-[-0.5px] left-0 right-0 top-0 pointer-events-none" })] }));
51
+ });
52
+ Tabs.displayName = 'Tabs';
53
+
54
+ exports.Tabs = Tabs;
@@ -1 +1,63 @@
1
- "use strict";var t=require("react"),e=require("./utils.js");const o={h1:"text-[36px] font-[var(--font-weight-fat)]",h2:"text-[32px] font-[var(--font-weight-fat)]",h3:"text-[28px] font-[var(--font-weight-fat)]",h4:"text-[24px] font-[var(--font-weight-heavy)]",h5:"text-[22px] font-[var(--font-weight-heavy)]",h6:"text-[20px] font-[var(--font-weight-heavy)]","body-xl-heavy":"text-[20px] font-[var(--font-weight-heavy)]","body-l-heavy":"text-[18px] font-[var(--font-weight-heavy)]","body-l-bold":"text-[18px] font-[var(--font-weight-bold)]","body-l-medium":"text-[18px] font-[var(--font-weight-medium)]","body-m-heavy":"text-[16px] font-[var(--font-weight-heavy)]","body-m-bold":"text-[16px] font-[var(--font-weight-bold)]","body-m-medium":"text-[16px] font-[var(--font-weight-medium)]","body-s-heavy":"text-[14px] font-[var(--font-weight-heavy)]","body-s-bold":"text-[14px] font-[var(--font-weight-bold)]","body-s-medium":"text-[14px] font-[var(--font-weight-medium)]","body-ms-bold":"text-[13px] font-[var(--font-weight-bold)]","body-ms-medium":"text-[13px] font-[var(--font-weight-medium)]","body-xs-bold":"text-[12px] font-[var(--font-weight-bold)]","body-xs-medium":"text-[12px] font-[var(--font-weight-medium)]","body-t-bold":"text-[10px] font-[var(--font-weight-bold)]","body-t-medium":"text-[10px] font-[var(--font-weight-medium)]","body-ss-medium":"text-[9px] font-[var(--font-weight-medium)]"},a={primary:"text-[var(--color-primary)]",secondary:"text-[var(--color-secondary)]","neutral-darker":"text-[var(--color-neutral-darker)]","neutral-dark":"text-[var(--color-neutral-dark)]","neutral-main":"text-[var(--color-neutral-main)]",white:"text-[var(--color-white)]",inherit:"text-inherit"},r=t.forwardRef(({variant:r="body-m-medium",color:n="inherit",as:i,className:x,children:d,...f},h)=>{const m=i||(t=>t.startsWith("h")?t.split("-")[0]:"p")(r);return t.createElement(m,{ref:h,className:e(o[r],a[n],"leading-[var(--leading-default)]",x),...f},d)});r.displayName="Typography",exports.Typography=r,exports.getTypographyClasses=t=>o[t];
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var utils = require('./utils.js');
5
+
6
+ const variantClasses = {
7
+ // Headings with Fat weight (900)
8
+ h1: 'text-[36px] font-[var(--font-weight-fat)]',
9
+ h2: 'text-[32px] font-[var(--font-weight-fat)]',
10
+ h3: 'text-[28px] font-[var(--font-weight-fat)]',
11
+ h4: 'text-[24px] font-[var(--font-weight-heavy)]',
12
+ h5: 'text-[22px] font-[var(--font-weight-heavy)]',
13
+ h6: 'text-[20px] font-[var(--font-weight-heavy)]',
14
+ // Body Copy with specific weight variants
15
+ 'body-xl-heavy': 'text-[20px] font-[var(--font-weight-heavy)]',
16
+ 'body-l-heavy': 'text-[18px] font-[var(--font-weight-heavy)]',
17
+ 'body-l-bold': 'text-[18px] font-[var(--font-weight-bold)]',
18
+ 'body-l-medium': 'text-[18px] font-[var(--font-weight-medium)]',
19
+ 'body-m-heavy': 'text-[16px] font-[var(--font-weight-heavy)]',
20
+ 'body-m-bold': 'text-[16px] font-[var(--font-weight-bold)]',
21
+ 'body-m-medium': 'text-[16px] font-[var(--font-weight-medium)]',
22
+ 'body-s-heavy': 'text-[14px] font-[var(--font-weight-heavy)]',
23
+ 'body-s-bold': 'text-[14px] font-[var(--font-weight-bold)]',
24
+ 'body-s-medium': 'text-[14px] font-[var(--font-weight-medium)]',
25
+ 'body-ms-bold': 'text-[13px] font-[var(--font-weight-bold)]',
26
+ 'body-ms-medium': 'text-[13px] font-[var(--font-weight-medium)]',
27
+ 'body-xs-bold': 'text-[12px] font-[var(--font-weight-bold)]',
28
+ 'body-xs-medium': 'text-[12px] font-[var(--font-weight-medium)]',
29
+ 'body-t-bold': 'text-[10px] font-[var(--font-weight-bold)]',
30
+ 'body-t-medium': 'text-[10px] font-[var(--font-weight-medium)]',
31
+ 'body-ss-medium': 'text-[9px] font-[var(--font-weight-medium)]',
32
+ };
33
+ // Export for reuse in other components
34
+ const getTypographyClasses = (variant) => {
35
+ return variantClasses[variant];
36
+ };
37
+ const colorClasses = {
38
+ primary: 'text-[var(--color-primary)]',
39
+ secondary: 'text-[var(--color-secondary)]',
40
+ 'neutral-darker': 'text-[var(--color-neutral-darker)]',
41
+ 'neutral-dark': 'text-[var(--color-neutral-dark)]',
42
+ 'neutral-main': 'text-[var(--color-neutral-main)]',
43
+ white: 'text-[var(--color-white)]',
44
+ inherit: 'text-inherit',
45
+ };
46
+ const getDefaultElement = (variant) => {
47
+ if (variant.startsWith('h'))
48
+ return variant.split('-')[0]; // h1, h2, etc.
49
+ return 'p';
50
+ };
51
+ const Typography = React.forwardRef(({ variant = 'body-m-medium', color = 'inherit', as, className, children, ...props }, ref) => {
52
+ const Element = as || getDefaultElement(variant);
53
+ return React.createElement(Element, {
54
+ ref,
55
+ className: utils(variantClasses[variant], colorClasses[color], 'leading-[var(--leading-default)]', // 180% line height
56
+ className),
57
+ ...props,
58
+ }, children);
59
+ });
60
+ Typography.displayName = 'Typography';
61
+
62
+ exports.Typography = Typography;
63
+ exports.getTypographyClasses = getTypographyClasses;