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