@grupor5/raya 0.2.1 → 0.2.3

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 (180) hide show
  1. package/README.md +68 -4
  2. package/dist/atoms/avatar/index.d.mts +12 -0
  3. package/dist/atoms/avatar/index.d.ts +12 -0
  4. package/dist/atoms/avatar/index.js +99 -0
  5. package/dist/atoms/avatar/index.mjs +76 -0
  6. package/dist/atoms/badge/index.d.mts +16 -0
  7. package/dist/atoms/badge/index.d.ts +16 -0
  8. package/dist/atoms/badge/index.js +149 -0
  9. package/dist/atoms/badge/index.mjs +146 -0
  10. package/dist/atoms/button/index.d.mts +11 -0
  11. package/dist/atoms/button/index.d.ts +11 -0
  12. package/dist/atoms/button/index.js +307 -0
  13. package/dist/atoms/button/index.mjs +301 -0
  14. package/dist/atoms/checkbox/index.d.mts +6 -0
  15. package/dist/atoms/checkbox/index.d.ts +6 -0
  16. package/dist/atoms/checkbox/index.js +98 -0
  17. package/dist/atoms/checkbox/index.mjs +75 -0
  18. package/dist/atoms/input/index.d.mts +12 -0
  19. package/dist/atoms/input/index.d.ts +12 -0
  20. package/dist/atoms/input/index.js +104 -0
  21. package/dist/atoms/input/index.mjs +82 -0
  22. package/dist/atoms/label/index.d.mts +8 -0
  23. package/dist/atoms/label/index.d.ts +8 -0
  24. package/dist/atoms/label/index.js +77 -0
  25. package/dist/atoms/label/index.mjs +54 -0
  26. package/dist/atoms/radio/index.d.mts +7 -0
  27. package/dist/atoms/radio/index.d.ts +7 -0
  28. package/dist/atoms/radio/index.js +97 -0
  29. package/dist/atoms/radio/index.mjs +73 -0
  30. package/dist/atoms/switch/index.d.mts +6 -0
  31. package/dist/atoms/switch/index.d.ts +6 -0
  32. package/dist/atoms/switch/index.js +97 -0
  33. package/dist/atoms/switch/index.mjs +74 -0
  34. package/dist/atoms/tag/index.d.mts +14 -0
  35. package/dist/atoms/tag/index.d.ts +14 -0
  36. package/dist/atoms/tag/index.js +128 -0
  37. package/dist/atoms/tag/index.mjs +122 -0
  38. package/dist/atoms/textarea/index.d.mts +11 -0
  39. package/dist/atoms/textarea/index.d.ts +11 -0
  40. package/dist/atoms/textarea/index.js +125 -0
  41. package/dist/atoms/textarea/index.mjs +103 -0
  42. package/dist/atoms/typography/index.d.mts +20 -0
  43. package/dist/atoms/typography/index.d.ts +20 -0
  44. package/dist/atoms/typography/index.js +140 -0
  45. package/dist/atoms/typography/index.mjs +115 -0
  46. package/dist/hooks/index.d.mts +1 -0
  47. package/dist/hooks/index.d.ts +1 -0
  48. package/dist/hooks/index.js +17 -0
  49. package/dist/hooks/index.mjs +15 -0
  50. package/dist/hooks/use-pagination.d.mts +10 -0
  51. package/dist/hooks/use-pagination.d.ts +10 -0
  52. package/dist/hooks/use-pagination.js +54 -0
  53. package/dist/hooks/use-pagination.mjs +51 -0
  54. package/dist/hooks/use-toast.d.mts +2 -0
  55. package/dist/hooks/use-toast.d.ts +2 -0
  56. package/dist/hooks/use-toast.js +2 -0
  57. package/dist/hooks/use-toast.mjs +1 -0
  58. package/dist/hooks/useModal.d.mts +7 -0
  59. package/dist/hooks/useModal.d.ts +7 -0
  60. package/dist/hooks/useModal.js +17 -0
  61. package/dist/hooks/useModal.mjs +15 -0
  62. package/dist/index.d.mts +50 -1298
  63. package/dist/index.d.ts +50 -1298
  64. package/dist/molecules/accordion/index.d.mts +17 -0
  65. package/dist/molecules/accordion/index.d.ts +17 -0
  66. package/dist/molecules/accordion/index.js +154 -0
  67. package/dist/molecules/accordion/index.mjs +128 -0
  68. package/dist/molecules/alert/index.d.mts +14 -0
  69. package/dist/molecules/alert/index.d.ts +14 -0
  70. package/dist/molecules/alert/index.js +425 -0
  71. package/dist/molecules/alert/index.mjs +402 -0
  72. package/dist/molecules/card/index.d.mts +10 -0
  73. package/dist/molecules/card/index.d.ts +10 -0
  74. package/dist/molecules/card/index.js +128 -0
  75. package/dist/molecules/card/index.mjs +101 -0
  76. package/dist/molecules/chart/index.d.mts +80 -0
  77. package/dist/molecules/chart/index.d.ts +80 -0
  78. package/dist/molecules/chart/index.js +300 -0
  79. package/dist/molecules/chart/index.mjs +272 -0
  80. package/dist/molecules/data-table/index.d.mts +57 -0
  81. package/dist/molecules/data-table/index.d.ts +57 -0
  82. package/dist/molecules/data-table/index.js +1456 -0
  83. package/dist/molecules/data-table/index.mjs +1430 -0
  84. package/dist/molecules/date-picker/index.d.mts +12 -0
  85. package/dist/molecules/date-picker/index.d.ts +12 -0
  86. package/dist/molecules/date-picker/index.js +756 -0
  87. package/dist/molecules/date-picker/index.mjs +734 -0
  88. package/dist/molecules/dropdown/index.d.mts +21 -0
  89. package/dist/molecules/dropdown/index.d.ts +21 -0
  90. package/dist/molecules/dropdown/index.js +221 -0
  91. package/dist/molecules/dropdown/index.mjs +198 -0
  92. package/dist/molecules/form/index.d.mts +19 -0
  93. package/dist/molecules/form/index.d.ts +19 -0
  94. package/dist/molecules/form/index.js +139 -0
  95. package/dist/molecules/form/index.mjs +114 -0
  96. package/dist/molecules/pagination/index.d.mts +15 -0
  97. package/dist/molecules/pagination/index.d.ts +15 -0
  98. package/dist/molecules/pagination/index.js +605 -0
  99. package/dist/molecules/pagination/index.mjs +583 -0
  100. package/dist/molecules/progress-bar/index.d.mts +15 -0
  101. package/dist/molecules/progress-bar/index.d.ts +15 -0
  102. package/dist/molecules/progress-bar/index.js +166 -0
  103. package/dist/molecules/progress-bar/index.mjs +144 -0
  104. package/dist/molecules/select/index.d.mts +15 -0
  105. package/dist/molecules/select/index.d.ts +15 -0
  106. package/dist/molecules/select/index.js +201 -0
  107. package/dist/molecules/select/index.mjs +169 -0
  108. package/dist/molecules/stepper/index.d.mts +67 -0
  109. package/dist/molecules/stepper/index.d.ts +67 -0
  110. package/dist/molecules/stepper/index.js +287 -0
  111. package/dist/molecules/stepper/index.mjs +260 -0
  112. package/dist/molecules/tabs/index.d.mts +9 -0
  113. package/dist/molecules/tabs/index.d.ts +9 -0
  114. package/dist/molecules/tabs/index.js +112 -0
  115. package/dist/molecules/tabs/index.mjs +86 -0
  116. package/dist/tokens/badge.d.mts +39 -0
  117. package/dist/tokens/badge.d.ts +39 -0
  118. package/dist/tokens/badge.js +61 -0
  119. package/dist/tokens/badge.mjs +59 -0
  120. package/dist/tokens/buttons.d.mts +277 -0
  121. package/dist/tokens/buttons.d.ts +277 -0
  122. package/dist/tokens/buttons.js +191 -0
  123. package/dist/tokens/buttons.mjs +173 -0
  124. package/dist/tokens/colors.d.mts +65 -0
  125. package/dist/tokens/colors.d.ts +65 -0
  126. package/dist/tokens/colors.js +68 -0
  127. package/dist/tokens/colors.mjs +66 -0
  128. package/dist/tokens/effects.d.mts +124 -0
  129. package/dist/tokens/effects.d.ts +124 -0
  130. package/dist/tokens/effects.js +130 -0
  131. package/dist/tokens/effects.mjs +115 -0
  132. package/dist/tokens/grids.d.mts +331 -0
  133. package/dist/tokens/grids.d.ts +331 -0
  134. package/dist/tokens/grids.js +305 -0
  135. package/dist/tokens/grids.mjs +292 -0
  136. package/dist/tokens/icons.d.mts +134 -0
  137. package/dist/tokens/icons.d.ts +134 -0
  138. package/dist/tokens/icons.js +108 -0
  139. package/dist/tokens/icons.mjs +97 -0
  140. package/dist/tokens/index.d.mts +6 -0
  141. package/dist/tokens/index.d.ts +6 -0
  142. package/dist/tokens/index.js +775 -0
  143. package/dist/tokens/index.mjs +743 -0
  144. package/dist/tokens/progress-bar.d.mts +31 -0
  145. package/dist/tokens/progress-bar.d.ts +31 -0
  146. package/dist/tokens/progress-bar.js +70 -0
  147. package/dist/tokens/progress-bar.mjs +68 -0
  148. package/dist/tokens/spacing.d.mts +90 -0
  149. package/dist/tokens/spacing.d.ts +90 -0
  150. package/dist/tokens/spacing.js +120 -0
  151. package/dist/tokens/spacing.mjs +109 -0
  152. package/dist/tokens/stroke.d.mts +292 -0
  153. package/dist/tokens/stroke.d.ts +292 -0
  154. package/dist/tokens/stroke.js +202 -0
  155. package/dist/tokens/stroke.mjs +186 -0
  156. package/dist/tokens/tab.d.mts +31 -0
  157. package/dist/tokens/tab.d.ts +31 -0
  158. package/dist/tokens/tab.js +48 -0
  159. package/dist/tokens/tab.mjs +46 -0
  160. package/dist/tokens/tag.d.mts +53 -0
  161. package/dist/tokens/tag.d.ts +53 -0
  162. package/dist/tokens/tag.js +80 -0
  163. package/dist/tokens/tag.mjs +78 -0
  164. package/dist/tokens/typography.d.mts +394 -0
  165. package/dist/tokens/typography.d.ts +394 -0
  166. package/dist/tokens/typography.js +302 -0
  167. package/dist/tokens/typography.mjs +292 -0
  168. package/dist/utils/classNames.d.mts +3 -0
  169. package/dist/utils/classNames.d.ts +3 -0
  170. package/dist/utils/classNames.js +8 -0
  171. package/dist/utils/classNames.mjs +6 -0
  172. package/dist/utils/cn.d.mts +5 -0
  173. package/dist/utils/cn.d.ts +5 -0
  174. package/dist/utils/cn.js +11 -0
  175. package/dist/utils/cn.mjs +9 -0
  176. package/dist/utils/index.d.mts +3 -0
  177. package/dist/utils/index.d.ts +3 -0
  178. package/dist/utils/index.js +15 -0
  179. package/dist/utils/index.mjs +12 -0
  180. package/package.json +34 -1
@@ -0,0 +1,307 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var reactSlot = require('@radix-ui/react-slot');
5
+ var clsx = require('clsx');
6
+ var tailwindMerge = require('tailwind-merge');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefault(React);
12
+
13
+ var __defProp = Object.defineProperty;
14
+ var __defProps = Object.defineProperties;
15
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
16
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
17
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
18
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
19
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20
+ var __spreadValues = (a, b) => {
21
+ for (var prop in b || (b = {}))
22
+ if (__hasOwnProp.call(b, prop))
23
+ __defNormalProp(a, prop, b[prop]);
24
+ if (__getOwnPropSymbols)
25
+ for (var prop of __getOwnPropSymbols(b)) {
26
+ if (__propIsEnum.call(b, prop))
27
+ __defNormalProp(a, prop, b[prop]);
28
+ }
29
+ return a;
30
+ };
31
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
32
+ var __objRest = (source, exclude) => {
33
+ var target = {};
34
+ for (var prop in source)
35
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
36
+ target[prop] = source[prop];
37
+ if (source != null && __getOwnPropSymbols)
38
+ for (var prop of __getOwnPropSymbols(source)) {
39
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
40
+ target[prop] = source[prop];
41
+ }
42
+ return target;
43
+ };
44
+ function cn(...inputs) {
45
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
46
+ }
47
+
48
+ // src/tokens/buttons.ts
49
+ var buttonSizeClasses = {
50
+ sm: {
51
+ base: "h-8 px-2 py-1 text-sm rounded-[10px]",
52
+ icon: "h-8 w-8 rounded-[10px]",
53
+ iconSize: "w-4 h-4"
54
+ },
55
+ md: {
56
+ base: "h-10 px-4 py-2 text-base rounded-xl",
57
+ icon: "h-10 w-10 rounded-xl",
58
+ iconSize: "w-5 h-5"
59
+ },
60
+ lg: {
61
+ base: "h-12 px-6 py-3 text-lg rounded-2xl",
62
+ icon: "h-12 w-12 rounded-2xl",
63
+ iconSize: "w-[22px] h-[22px]"
64
+ }
65
+ };
66
+ var buttonVariantClasses = {
67
+ // Primary variants
68
+ primary: {
69
+ primary: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 active:bg-[hsl(var(--primary-pressed))] disabled:bg-neutral-300 disabled:text-neutral-500",
70
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/90 active:bg-secondary/80 disabled:bg-neutral-300 disabled:text-neutral-500",
71
+ success: "bg-emerald-600 text-white shadow-sm hover:bg-emerald-700 active:bg-emerald-800 disabled:bg-neutral-300 disabled:text-neutral-500",
72
+ warning: "bg-amber-600 text-white shadow-sm hover:bg-amber-700 active:bg-amber-800 disabled:bg-neutral-300 disabled:text-neutral-500",
73
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80 disabled:bg-neutral-300 disabled:text-neutral-500",
74
+ neutral: "bg-neutral-700 text-white shadow-sm hover:bg-neutral-800 active:bg-neutral-900 disabled:bg-neutral-300 disabled:text-neutral-500"
75
+ },
76
+ // Secondary variants (outlined)
77
+ secondary: {
78
+ primary: "border border-primary text-primary bg-transparent hover:bg-primary/10 active:bg-primary/20 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
79
+ secondary: "border border-secondary text-secondary bg-transparent hover:bg-secondary/10 active:bg-secondary/20 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
80
+ success: "border border-emerald-600 text-emerald-600 bg-transparent hover:bg-emerald-50 active:bg-emerald-100 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
81
+ warning: "border border-amber-600 text-amber-600 bg-transparent hover:bg-amber-50 active:bg-amber-100 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
82
+ destructive: "border border-destructive text-destructive bg-transparent hover:bg-destructive/10 active:bg-destructive/20 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
83
+ neutral: "border border-neutral-700 text-neutral-700 bg-transparent hover:bg-neutral-50 active:bg-neutral-100 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent"
84
+ },
85
+ // Ghost variants (text only)
86
+ ghost: {
87
+ primary: "text-primary bg-transparent hover:bg-primary/10 active:bg-primary/20 disabled:text-neutral-500 disabled:bg-transparent",
88
+ secondary: "text-secondary bg-transparent hover:bg-secondary/10 active:bg-secondary/20 disabled:text-neutral-500 disabled:bg-transparent",
89
+ success: "text-emerald-600 bg-transparent hover:bg-emerald-50 active:bg-emerald-100 disabled:text-neutral-500 disabled:bg-transparent",
90
+ warning: "text-amber-600 bg-transparent hover:bg-amber-50 active:bg-amber-100 disabled:text-neutral-500 disabled:bg-transparent",
91
+ destructive: "text-destructive bg-transparent hover:bg-destructive/10 active:bg-destructive/20 disabled:text-neutral-500 disabled:bg-transparent",
92
+ neutral: "text-neutral-700 bg-transparent hover:bg-neutral-100 active:bg-neutral-200 disabled:text-neutral-500 disabled:bg-transparent"
93
+ }
94
+ };
95
+ var buttonBaseClasses = "inline-flex items-center justify-center gap-2 whitespace-nowrap font-regular transition-all duration-200 focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed focus-visible:border-2 focus-visible:border-[--stroke-color-focus-border]";
96
+ var buttonLoadingClasses = {
97
+ spinner: "animate-spin",
98
+ container: "flex items-center justify-center gap-2",
99
+ text: "opacity-70"
100
+ };
101
+ var getButtonSizeClasses = (size, isIcon) => {
102
+ return isIcon ? buttonSizeClasses[size].icon : buttonSizeClasses[size].base;
103
+ };
104
+ var getButtonVariantClasses = (variant, color) => {
105
+ var _a;
106
+ if (variant === "icon") {
107
+ return buttonVariantClasses.ghost[color];
108
+ }
109
+ return ((_a = buttonVariantClasses[variant]) == null ? void 0 : _a[color]) || "";
110
+ };
111
+ var getButtonIconSize = (size) => {
112
+ return buttonSizeClasses[size].iconSize;
113
+ };
114
+ var defaultButtonConfig = {
115
+ variant: "primary",
116
+ size: "md",
117
+ color: "primary",
118
+ type: "button"
119
+ };
120
+ var LoadingSpinner = ({
121
+ size,
122
+ className
123
+ }) => {
124
+ const sizeClasses = {
125
+ sm: "w-4 h-4",
126
+ md: "w-5 h-5",
127
+ lg: "w-6 h-6"
128
+ };
129
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(buttonLoadingClasses.spinner, sizeClasses[size], className), children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { fill: "none", viewBox: "0 0 24 24", className: "w-full h-full", children: [
130
+ /* @__PURE__ */ jsxRuntime.jsx(
131
+ "circle",
132
+ {
133
+ className: "opacity-25",
134
+ cx: "12",
135
+ cy: "12",
136
+ r: "10",
137
+ stroke: "currentColor"
138
+ }
139
+ ),
140
+ /* @__PURE__ */ jsxRuntime.jsx(
141
+ "path",
142
+ {
143
+ className: "opacity-75",
144
+ fill: "currentColor",
145
+ d: "m4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
146
+ }
147
+ )
148
+ ] }) });
149
+ };
150
+ var Button = React.forwardRef((_a, ref) => {
151
+ var _b = _a, {
152
+ variant = defaultButtonConfig.variant,
153
+ size = defaultButtonConfig.size,
154
+ color = defaultButtonConfig.color,
155
+ disabled = false,
156
+ loading = false,
157
+ loadingText,
158
+ icon,
159
+ iconLeft,
160
+ iconRight,
161
+ className,
162
+ children,
163
+ type = defaultButtonConfig.type,
164
+ "aria-label": ariaLabel,
165
+ "aria-describedby": ariaDescribedBy,
166
+ asChild = false,
167
+ onClick
168
+ } = _b, props = __objRest(_b, [
169
+ "variant",
170
+ "size",
171
+ "color",
172
+ "disabled",
173
+ "loading",
174
+ "loadingText",
175
+ "icon",
176
+ "iconLeft",
177
+ "iconRight",
178
+ "className",
179
+ "children",
180
+ "type",
181
+ "aria-label",
182
+ "aria-describedby",
183
+ "asChild",
184
+ "onClick"
185
+ ]);
186
+ const isIconOnly = variant === "icon" || !!(!children && (icon || iconLeft || iconRight));
187
+ const buttonClasses = React.useMemo(() => {
188
+ const sizeClasses = getButtonSizeClasses(size, isIconOnly);
189
+ const variantClasses = getButtonVariantClasses(variant, color);
190
+ return cn(
191
+ buttonBaseClasses,
192
+ sizeClasses,
193
+ variantClasses,
194
+ className
195
+ );
196
+ }, [variant, size, color, isIconOnly, className]);
197
+ const buttonContent = React.useMemo(() => {
198
+ if (loading) {
199
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: buttonLoadingClasses.container, children: [
200
+ /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, { size }),
201
+ loadingText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: buttonLoadingClasses.text, children: loadingText })
202
+ ] });
203
+ }
204
+ const iconSizeClass = getButtonIconSize(size);
205
+ const renderIcon = (iconNode) => {
206
+ if (React__default.default.isValidElement(iconNode)) {
207
+ return React__default.default.cloneElement(iconNode, {
208
+ className: cn(iconSizeClass, iconNode.props.className),
209
+ "aria-hidden": true
210
+ });
211
+ }
212
+ return iconNode;
213
+ };
214
+ if (isIconOnly) {
215
+ return renderIcon(icon || iconLeft || iconRight);
216
+ }
217
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center justify-center gap-2", children: [
218
+ iconLeft && renderIcon(iconLeft),
219
+ children && /* @__PURE__ */ jsxRuntime.jsx("span", { children }),
220
+ iconRight && renderIcon(iconRight)
221
+ ] });
222
+ }, [loading, loadingText, isIconOnly, icon, iconLeft, iconRight, children, size]);
223
+ const accessibilityProps = React.useMemo(() => {
224
+ const props2 = {};
225
+ if (isIconOnly && !ariaLabel) {
226
+ console.warn("Icon-only buttons should have an aria-label for accessibility");
227
+ }
228
+ if (ariaLabel) {
229
+ props2["aria-label"] = ariaLabel;
230
+ }
231
+ if (ariaDescribedBy) {
232
+ props2["aria-describedby"] = ariaDescribedBy;
233
+ }
234
+ if (loading) {
235
+ props2["aria-busy"] = true;
236
+ props2["aria-disabled"] = true;
237
+ }
238
+ if (disabled || loading) {
239
+ props2["aria-disabled"] = true;
240
+ }
241
+ return props2;
242
+ }, [isIconOnly, ariaLabel, ariaDescribedBy, loading, disabled]);
243
+ const handleClick = (event) => {
244
+ if (disabled || loading) {
245
+ event.preventDefault();
246
+ return;
247
+ }
248
+ onClick == null ? void 0 : onClick(event);
249
+ };
250
+ if (asChild) {
251
+ return /* @__PURE__ */ jsxRuntime.jsx(
252
+ reactSlot.Slot,
253
+ __spreadProps(__spreadValues(__spreadValues({
254
+ ref,
255
+ className: buttonClasses
256
+ }, accessibilityProps), props), {
257
+ children
258
+ })
259
+ );
260
+ }
261
+ return /* @__PURE__ */ jsxRuntime.jsxs(
262
+ "button",
263
+ __spreadProps(__spreadValues(__spreadValues({
264
+ ref,
265
+ type,
266
+ className: buttonClasses,
267
+ disabled: disabled || loading,
268
+ onClick: handleClick
269
+ }, accessibilityProps), props), {
270
+ children: [
271
+ loading && /* @__PURE__ */ jsxRuntime.jsxs(
272
+ "svg",
273
+ {
274
+ className: "animate-spin -ml-1 mr-3 h-5 w-5 text-white",
275
+ xmlns: "http://www.w3.org/2000/svg",
276
+ fill: "none",
277
+ viewBox: "0 0 24 24",
278
+ children: [
279
+ /* @__PURE__ */ jsxRuntime.jsx(
280
+ "circle",
281
+ {
282
+ className: "opacity-25",
283
+ cx: "12",
284
+ cy: "12",
285
+ r: "10",
286
+ stroke: "currentColor"
287
+ }
288
+ ),
289
+ /* @__PURE__ */ jsxRuntime.jsx(
290
+ "path",
291
+ {
292
+ className: "opacity-75",
293
+ fill: "currentColor",
294
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
295
+ }
296
+ )
297
+ ]
298
+ }
299
+ ),
300
+ loading && loadingText ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: buttonLoadingClasses.text, children: loadingText }) : buttonContent
301
+ ]
302
+ })
303
+ );
304
+ });
305
+ Button.displayName = "Button";
306
+
307
+ exports.Button = Button;
@@ -0,0 +1,301 @@
1
+ import React, { forwardRef, useMemo } from 'react';
2
+ import { Slot } from '@radix-ui/react-slot';
3
+ import { clsx } from 'clsx';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __defProps = Object.defineProperties;
9
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
10
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
13
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
+ var __spreadValues = (a, b) => {
15
+ for (var prop in b || (b = {}))
16
+ if (__hasOwnProp.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols)
19
+ for (var prop of __getOwnPropSymbols(b)) {
20
+ if (__propIsEnum.call(b, prop))
21
+ __defNormalProp(a, prop, b[prop]);
22
+ }
23
+ return a;
24
+ };
25
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
+ var __objRest = (source, exclude) => {
27
+ var target = {};
28
+ for (var prop in source)
29
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
+ target[prop] = source[prop];
31
+ if (source != null && __getOwnPropSymbols)
32
+ for (var prop of __getOwnPropSymbols(source)) {
33
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
+ target[prop] = source[prop];
35
+ }
36
+ return target;
37
+ };
38
+ function cn(...inputs) {
39
+ return twMerge(clsx(inputs));
40
+ }
41
+
42
+ // src/tokens/buttons.ts
43
+ var buttonSizeClasses = {
44
+ sm: {
45
+ base: "h-8 px-2 py-1 text-sm rounded-[10px]",
46
+ icon: "h-8 w-8 rounded-[10px]",
47
+ iconSize: "w-4 h-4"
48
+ },
49
+ md: {
50
+ base: "h-10 px-4 py-2 text-base rounded-xl",
51
+ icon: "h-10 w-10 rounded-xl",
52
+ iconSize: "w-5 h-5"
53
+ },
54
+ lg: {
55
+ base: "h-12 px-6 py-3 text-lg rounded-2xl",
56
+ icon: "h-12 w-12 rounded-2xl",
57
+ iconSize: "w-[22px] h-[22px]"
58
+ }
59
+ };
60
+ var buttonVariantClasses = {
61
+ // Primary variants
62
+ primary: {
63
+ primary: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 active:bg-[hsl(var(--primary-pressed))] disabled:bg-neutral-300 disabled:text-neutral-500",
64
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/90 active:bg-secondary/80 disabled:bg-neutral-300 disabled:text-neutral-500",
65
+ success: "bg-emerald-600 text-white shadow-sm hover:bg-emerald-700 active:bg-emerald-800 disabled:bg-neutral-300 disabled:text-neutral-500",
66
+ warning: "bg-amber-600 text-white shadow-sm hover:bg-amber-700 active:bg-amber-800 disabled:bg-neutral-300 disabled:text-neutral-500",
67
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80 disabled:bg-neutral-300 disabled:text-neutral-500",
68
+ neutral: "bg-neutral-700 text-white shadow-sm hover:bg-neutral-800 active:bg-neutral-900 disabled:bg-neutral-300 disabled:text-neutral-500"
69
+ },
70
+ // Secondary variants (outlined)
71
+ secondary: {
72
+ primary: "border border-primary text-primary bg-transparent hover:bg-primary/10 active:bg-primary/20 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
73
+ secondary: "border border-secondary text-secondary bg-transparent hover:bg-secondary/10 active:bg-secondary/20 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
74
+ success: "border border-emerald-600 text-emerald-600 bg-transparent hover:bg-emerald-50 active:bg-emerald-100 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
75
+ warning: "border border-amber-600 text-amber-600 bg-transparent hover:bg-amber-50 active:bg-amber-100 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
76
+ destructive: "border border-destructive text-destructive bg-transparent hover:bg-destructive/10 active:bg-destructive/20 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent",
77
+ neutral: "border border-neutral-700 text-neutral-700 bg-transparent hover:bg-neutral-50 active:bg-neutral-100 disabled:border-neutral-300 disabled:text-neutral-500 disabled:bg-transparent"
78
+ },
79
+ // Ghost variants (text only)
80
+ ghost: {
81
+ primary: "text-primary bg-transparent hover:bg-primary/10 active:bg-primary/20 disabled:text-neutral-500 disabled:bg-transparent",
82
+ secondary: "text-secondary bg-transparent hover:bg-secondary/10 active:bg-secondary/20 disabled:text-neutral-500 disabled:bg-transparent",
83
+ success: "text-emerald-600 bg-transparent hover:bg-emerald-50 active:bg-emerald-100 disabled:text-neutral-500 disabled:bg-transparent",
84
+ warning: "text-amber-600 bg-transparent hover:bg-amber-50 active:bg-amber-100 disabled:text-neutral-500 disabled:bg-transparent",
85
+ destructive: "text-destructive bg-transparent hover:bg-destructive/10 active:bg-destructive/20 disabled:text-neutral-500 disabled:bg-transparent",
86
+ neutral: "text-neutral-700 bg-transparent hover:bg-neutral-100 active:bg-neutral-200 disabled:text-neutral-500 disabled:bg-transparent"
87
+ }
88
+ };
89
+ var buttonBaseClasses = "inline-flex items-center justify-center gap-2 whitespace-nowrap font-regular transition-all duration-200 focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed focus-visible:border-2 focus-visible:border-[--stroke-color-focus-border]";
90
+ var buttonLoadingClasses = {
91
+ spinner: "animate-spin",
92
+ container: "flex items-center justify-center gap-2",
93
+ text: "opacity-70"
94
+ };
95
+ var getButtonSizeClasses = (size, isIcon) => {
96
+ return isIcon ? buttonSizeClasses[size].icon : buttonSizeClasses[size].base;
97
+ };
98
+ var getButtonVariantClasses = (variant, color) => {
99
+ var _a;
100
+ if (variant === "icon") {
101
+ return buttonVariantClasses.ghost[color];
102
+ }
103
+ return ((_a = buttonVariantClasses[variant]) == null ? void 0 : _a[color]) || "";
104
+ };
105
+ var getButtonIconSize = (size) => {
106
+ return buttonSizeClasses[size].iconSize;
107
+ };
108
+ var defaultButtonConfig = {
109
+ variant: "primary",
110
+ size: "md",
111
+ color: "primary",
112
+ type: "button"
113
+ };
114
+ var LoadingSpinner = ({
115
+ size,
116
+ className
117
+ }) => {
118
+ const sizeClasses = {
119
+ sm: "w-4 h-4",
120
+ md: "w-5 h-5",
121
+ lg: "w-6 h-6"
122
+ };
123
+ return /* @__PURE__ */ jsx("div", { className: cn(buttonLoadingClasses.spinner, sizeClasses[size], className), children: /* @__PURE__ */ jsxs("svg", { fill: "none", viewBox: "0 0 24 24", className: "w-full h-full", children: [
124
+ /* @__PURE__ */ jsx(
125
+ "circle",
126
+ {
127
+ className: "opacity-25",
128
+ cx: "12",
129
+ cy: "12",
130
+ r: "10",
131
+ stroke: "currentColor"
132
+ }
133
+ ),
134
+ /* @__PURE__ */ jsx(
135
+ "path",
136
+ {
137
+ className: "opacity-75",
138
+ fill: "currentColor",
139
+ d: "m4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
140
+ }
141
+ )
142
+ ] }) });
143
+ };
144
+ var Button = forwardRef((_a, ref) => {
145
+ var _b = _a, {
146
+ variant = defaultButtonConfig.variant,
147
+ size = defaultButtonConfig.size,
148
+ color = defaultButtonConfig.color,
149
+ disabled = false,
150
+ loading = false,
151
+ loadingText,
152
+ icon,
153
+ iconLeft,
154
+ iconRight,
155
+ className,
156
+ children,
157
+ type = defaultButtonConfig.type,
158
+ "aria-label": ariaLabel,
159
+ "aria-describedby": ariaDescribedBy,
160
+ asChild = false,
161
+ onClick
162
+ } = _b, props = __objRest(_b, [
163
+ "variant",
164
+ "size",
165
+ "color",
166
+ "disabled",
167
+ "loading",
168
+ "loadingText",
169
+ "icon",
170
+ "iconLeft",
171
+ "iconRight",
172
+ "className",
173
+ "children",
174
+ "type",
175
+ "aria-label",
176
+ "aria-describedby",
177
+ "asChild",
178
+ "onClick"
179
+ ]);
180
+ const isIconOnly = variant === "icon" || !!(!children && (icon || iconLeft || iconRight));
181
+ const buttonClasses = useMemo(() => {
182
+ const sizeClasses = getButtonSizeClasses(size, isIconOnly);
183
+ const variantClasses = getButtonVariantClasses(variant, color);
184
+ return cn(
185
+ buttonBaseClasses,
186
+ sizeClasses,
187
+ variantClasses,
188
+ className
189
+ );
190
+ }, [variant, size, color, isIconOnly, className]);
191
+ const buttonContent = useMemo(() => {
192
+ if (loading) {
193
+ return /* @__PURE__ */ jsxs("div", { className: buttonLoadingClasses.container, children: [
194
+ /* @__PURE__ */ jsx(LoadingSpinner, { size }),
195
+ loadingText && /* @__PURE__ */ jsx("span", { className: buttonLoadingClasses.text, children: loadingText })
196
+ ] });
197
+ }
198
+ const iconSizeClass = getButtonIconSize(size);
199
+ const renderIcon = (iconNode) => {
200
+ if (React.isValidElement(iconNode)) {
201
+ return React.cloneElement(iconNode, {
202
+ className: cn(iconSizeClass, iconNode.props.className),
203
+ "aria-hidden": true
204
+ });
205
+ }
206
+ return iconNode;
207
+ };
208
+ if (isIconOnly) {
209
+ return renderIcon(icon || iconLeft || iconRight);
210
+ }
211
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center justify-center gap-2", children: [
212
+ iconLeft && renderIcon(iconLeft),
213
+ children && /* @__PURE__ */ jsx("span", { children }),
214
+ iconRight && renderIcon(iconRight)
215
+ ] });
216
+ }, [loading, loadingText, isIconOnly, icon, iconLeft, iconRight, children, size]);
217
+ const accessibilityProps = useMemo(() => {
218
+ const props2 = {};
219
+ if (isIconOnly && !ariaLabel) {
220
+ console.warn("Icon-only buttons should have an aria-label for accessibility");
221
+ }
222
+ if (ariaLabel) {
223
+ props2["aria-label"] = ariaLabel;
224
+ }
225
+ if (ariaDescribedBy) {
226
+ props2["aria-describedby"] = ariaDescribedBy;
227
+ }
228
+ if (loading) {
229
+ props2["aria-busy"] = true;
230
+ props2["aria-disabled"] = true;
231
+ }
232
+ if (disabled || loading) {
233
+ props2["aria-disabled"] = true;
234
+ }
235
+ return props2;
236
+ }, [isIconOnly, ariaLabel, ariaDescribedBy, loading, disabled]);
237
+ const handleClick = (event) => {
238
+ if (disabled || loading) {
239
+ event.preventDefault();
240
+ return;
241
+ }
242
+ onClick == null ? void 0 : onClick(event);
243
+ };
244
+ if (asChild) {
245
+ return /* @__PURE__ */ jsx(
246
+ Slot,
247
+ __spreadProps(__spreadValues(__spreadValues({
248
+ ref,
249
+ className: buttonClasses
250
+ }, accessibilityProps), props), {
251
+ children
252
+ })
253
+ );
254
+ }
255
+ return /* @__PURE__ */ jsxs(
256
+ "button",
257
+ __spreadProps(__spreadValues(__spreadValues({
258
+ ref,
259
+ type,
260
+ className: buttonClasses,
261
+ disabled: disabled || loading,
262
+ onClick: handleClick
263
+ }, accessibilityProps), props), {
264
+ children: [
265
+ loading && /* @__PURE__ */ jsxs(
266
+ "svg",
267
+ {
268
+ className: "animate-spin -ml-1 mr-3 h-5 w-5 text-white",
269
+ xmlns: "http://www.w3.org/2000/svg",
270
+ fill: "none",
271
+ viewBox: "0 0 24 24",
272
+ children: [
273
+ /* @__PURE__ */ jsx(
274
+ "circle",
275
+ {
276
+ className: "opacity-25",
277
+ cx: "12",
278
+ cy: "12",
279
+ r: "10",
280
+ stroke: "currentColor"
281
+ }
282
+ ),
283
+ /* @__PURE__ */ jsx(
284
+ "path",
285
+ {
286
+ className: "opacity-75",
287
+ fill: "currentColor",
288
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
289
+ }
290
+ )
291
+ ]
292
+ }
293
+ ),
294
+ loading && loadingText ? /* @__PURE__ */ jsx("span", { className: buttonLoadingClasses.text, children: loadingText }) : buttonContent
295
+ ]
296
+ })
297
+ );
298
+ });
299
+ Button.displayName = "Button";
300
+
301
+ export { Button };
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
+
4
+ declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
5
+
6
+ export { Checkbox };
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
+
4
+ declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
5
+
6
+ export { Checkbox };