@grupor5/raya 0.2.1 → 0.2.2

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 +47 -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,605 @@
1
+ 'use strict';
2
+
3
+ var lucideReact = require('lucide-react');
4
+ var React2 = require('react');
5
+ var clsx = require('clsx');
6
+ var tailwindMerge = require('tailwind-merge');
7
+ var reactSlot = require('@radix-ui/react-slot');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+ var SelectPrimitive = require('@radix-ui/react-select');
10
+ var reactIcons = require('@radix-ui/react-icons');
11
+
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
31
+ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
32
+
33
+ var __defProp = Object.defineProperty;
34
+ var __defProps = Object.defineProperties;
35
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
36
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
37
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
38
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
39
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
40
+ var __spreadValues = (a, b) => {
41
+ for (var prop in b || (b = {}))
42
+ if (__hasOwnProp.call(b, prop))
43
+ __defNormalProp(a, prop, b[prop]);
44
+ if (__getOwnPropSymbols)
45
+ for (var prop of __getOwnPropSymbols(b)) {
46
+ if (__propIsEnum.call(b, prop))
47
+ __defNormalProp(a, prop, b[prop]);
48
+ }
49
+ return a;
50
+ };
51
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
52
+ var __objRest = (source, exclude) => {
53
+ var target = {};
54
+ for (var prop in source)
55
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
56
+ target[prop] = source[prop];
57
+ if (source != null && __getOwnPropSymbols)
58
+ for (var prop of __getOwnPropSymbols(source)) {
59
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
60
+ target[prop] = source[prop];
61
+ }
62
+ return target;
63
+ };
64
+ var DOTS = "...";
65
+ var range = (start, end) => {
66
+ const length = end - start + 1;
67
+ return Array.from({ length }, (_, idx) => idx + start);
68
+ };
69
+ var usePagination = ({
70
+ totalCount,
71
+ pageSize,
72
+ siblingCount = 1,
73
+ currentPage
74
+ }) => {
75
+ const paginationRange = React2.useMemo(() => {
76
+ const totalPageCount = Math.ceil(totalCount / pageSize);
77
+ if (totalPageCount <= 10) {
78
+ return range(1, totalPageCount);
79
+ }
80
+ const leftSiblingIndex = Math.max(currentPage - siblingCount, 1);
81
+ const rightSiblingIndex = Math.min(
82
+ currentPage + siblingCount,
83
+ totalPageCount
84
+ );
85
+ const shouldShowLeftDots = leftSiblingIndex > 2;
86
+ const shouldShowRightDots = rightSiblingIndex < totalPageCount - 2;
87
+ const firstPageIndex = 1;
88
+ const lastPageIndex = totalPageCount;
89
+ if (!shouldShowLeftDots && shouldShowRightDots) {
90
+ const leftItemCount = 3 + 2 * siblingCount;
91
+ const leftRange = range(1, leftItemCount);
92
+ return [...leftRange, DOTS, totalPageCount];
93
+ }
94
+ if (shouldShowLeftDots && !shouldShowRightDots) {
95
+ const rightItemCount = 3 + 2 * siblingCount;
96
+ const rightRange = range(
97
+ totalPageCount - rightItemCount + 1,
98
+ totalPageCount
99
+ );
100
+ return [firstPageIndex, DOTS, ...rightRange];
101
+ }
102
+ if (shouldShowLeftDots && shouldShowRightDots) {
103
+ const middleRange = range(leftSiblingIndex, rightSiblingIndex);
104
+ return [firstPageIndex, DOTS, ...middleRange, DOTS, lastPageIndex];
105
+ }
106
+ return range(1, totalPageCount);
107
+ }, [totalCount, pageSize, siblingCount, currentPage]);
108
+ return paginationRange;
109
+ };
110
+ function cn(...inputs) {
111
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
112
+ }
113
+
114
+ // src/tokens/buttons.ts
115
+ var buttonSizeClasses = {
116
+ sm: {
117
+ base: "h-8 px-2 py-1 text-sm rounded-[10px]",
118
+ icon: "h-8 w-8 rounded-[10px]",
119
+ iconSize: "w-4 h-4"
120
+ },
121
+ md: {
122
+ base: "h-10 px-4 py-2 text-base rounded-xl",
123
+ icon: "h-10 w-10 rounded-xl",
124
+ iconSize: "w-5 h-5"
125
+ },
126
+ lg: {
127
+ base: "h-12 px-6 py-3 text-lg rounded-2xl",
128
+ icon: "h-12 w-12 rounded-2xl",
129
+ iconSize: "w-[22px] h-[22px]"
130
+ }
131
+ };
132
+ var buttonVariantClasses = {
133
+ // Primary variants
134
+ primary: {
135
+ 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",
136
+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/90 active:bg-secondary/80 disabled:bg-neutral-300 disabled:text-neutral-500",
137
+ success: "bg-emerald-600 text-white shadow-sm hover:bg-emerald-700 active:bg-emerald-800 disabled:bg-neutral-300 disabled:text-neutral-500",
138
+ warning: "bg-amber-600 text-white shadow-sm hover:bg-amber-700 active:bg-amber-800 disabled:bg-neutral-300 disabled:text-neutral-500",
139
+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 active:bg-destructive/80 disabled:bg-neutral-300 disabled:text-neutral-500",
140
+ neutral: "bg-neutral-700 text-white shadow-sm hover:bg-neutral-800 active:bg-neutral-900 disabled:bg-neutral-300 disabled:text-neutral-500"
141
+ },
142
+ // Secondary variants (outlined)
143
+ secondary: {
144
+ 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",
145
+ 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",
146
+ 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",
147
+ 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",
148
+ 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",
149
+ 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"
150
+ },
151
+ // Ghost variants (text only)
152
+ ghost: {
153
+ primary: "text-primary bg-transparent hover:bg-primary/10 active:bg-primary/20 disabled:text-neutral-500 disabled:bg-transparent",
154
+ secondary: "text-secondary bg-transparent hover:bg-secondary/10 active:bg-secondary/20 disabled:text-neutral-500 disabled:bg-transparent",
155
+ success: "text-emerald-600 bg-transparent hover:bg-emerald-50 active:bg-emerald-100 disabled:text-neutral-500 disabled:bg-transparent",
156
+ warning: "text-amber-600 bg-transparent hover:bg-amber-50 active:bg-amber-100 disabled:text-neutral-500 disabled:bg-transparent",
157
+ destructive: "text-destructive bg-transparent hover:bg-destructive/10 active:bg-destructive/20 disabled:text-neutral-500 disabled:bg-transparent",
158
+ neutral: "text-neutral-700 bg-transparent hover:bg-neutral-100 active:bg-neutral-200 disabled:text-neutral-500 disabled:bg-transparent"
159
+ }
160
+ };
161
+ 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]";
162
+ var buttonLoadingClasses = {
163
+ spinner: "animate-spin",
164
+ container: "flex items-center justify-center gap-2",
165
+ text: "opacity-70"
166
+ };
167
+ var getButtonSizeClasses = (size, isIcon) => {
168
+ return isIcon ? buttonSizeClasses[size].icon : buttonSizeClasses[size].base;
169
+ };
170
+ var getButtonVariantClasses = (variant, color) => {
171
+ var _a;
172
+ if (variant === "icon") {
173
+ return buttonVariantClasses.ghost[color];
174
+ }
175
+ return ((_a = buttonVariantClasses[variant]) == null ? void 0 : _a[color]) || "";
176
+ };
177
+ var getButtonIconSize = (size) => {
178
+ return buttonSizeClasses[size].iconSize;
179
+ };
180
+ var defaultButtonConfig = {
181
+ variant: "primary",
182
+ size: "md",
183
+ color: "primary",
184
+ type: "button"
185
+ };
186
+ var LoadingSpinner = ({
187
+ size,
188
+ className
189
+ }) => {
190
+ const sizeClasses = {
191
+ sm: "w-4 h-4",
192
+ md: "w-5 h-5",
193
+ lg: "w-6 h-6"
194
+ };
195
+ 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: [
196
+ /* @__PURE__ */ jsxRuntime.jsx(
197
+ "circle",
198
+ {
199
+ className: "opacity-25",
200
+ cx: "12",
201
+ cy: "12",
202
+ r: "10",
203
+ stroke: "currentColor"
204
+ }
205
+ ),
206
+ /* @__PURE__ */ jsxRuntime.jsx(
207
+ "path",
208
+ {
209
+ className: "opacity-75",
210
+ fill: "currentColor",
211
+ 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"
212
+ }
213
+ )
214
+ ] }) });
215
+ };
216
+ var Button = React2.forwardRef((_a, ref) => {
217
+ var _b = _a, {
218
+ variant = defaultButtonConfig.variant,
219
+ size = defaultButtonConfig.size,
220
+ color = defaultButtonConfig.color,
221
+ disabled = false,
222
+ loading = false,
223
+ loadingText,
224
+ icon,
225
+ iconLeft,
226
+ iconRight,
227
+ className,
228
+ children,
229
+ type = defaultButtonConfig.type,
230
+ "aria-label": ariaLabel,
231
+ "aria-describedby": ariaDescribedBy,
232
+ asChild = false,
233
+ onClick
234
+ } = _b, props = __objRest(_b, [
235
+ "variant",
236
+ "size",
237
+ "color",
238
+ "disabled",
239
+ "loading",
240
+ "loadingText",
241
+ "icon",
242
+ "iconLeft",
243
+ "iconRight",
244
+ "className",
245
+ "children",
246
+ "type",
247
+ "aria-label",
248
+ "aria-describedby",
249
+ "asChild",
250
+ "onClick"
251
+ ]);
252
+ const isIconOnly = variant === "icon" || !!(!children && (icon || iconLeft || iconRight));
253
+ const buttonClasses = React2.useMemo(() => {
254
+ const sizeClasses = getButtonSizeClasses(size, isIconOnly);
255
+ const variantClasses = getButtonVariantClasses(variant, color);
256
+ return cn(
257
+ buttonBaseClasses,
258
+ sizeClasses,
259
+ variantClasses,
260
+ className
261
+ );
262
+ }, [variant, size, color, isIconOnly, className]);
263
+ const buttonContent = React2.useMemo(() => {
264
+ if (loading) {
265
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: buttonLoadingClasses.container, children: [
266
+ /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner, { size }),
267
+ loadingText && /* @__PURE__ */ jsxRuntime.jsx("span", { className: buttonLoadingClasses.text, children: loadingText })
268
+ ] });
269
+ }
270
+ const iconSizeClass = getButtonIconSize(size);
271
+ const renderIcon = (iconNode) => {
272
+ if (React2__namespace.default.isValidElement(iconNode)) {
273
+ return React2__namespace.default.cloneElement(iconNode, {
274
+ className: cn(iconSizeClass, iconNode.props.className),
275
+ "aria-hidden": true
276
+ });
277
+ }
278
+ return iconNode;
279
+ };
280
+ if (isIconOnly) {
281
+ return renderIcon(icon || iconLeft || iconRight);
282
+ }
283
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center justify-center gap-2", children: [
284
+ iconLeft && renderIcon(iconLeft),
285
+ children && /* @__PURE__ */ jsxRuntime.jsx("span", { children }),
286
+ iconRight && renderIcon(iconRight)
287
+ ] });
288
+ }, [loading, loadingText, isIconOnly, icon, iconLeft, iconRight, children, size]);
289
+ const accessibilityProps = React2.useMemo(() => {
290
+ const props2 = {};
291
+ if (isIconOnly && !ariaLabel) {
292
+ console.warn("Icon-only buttons should have an aria-label for accessibility");
293
+ }
294
+ if (ariaLabel) {
295
+ props2["aria-label"] = ariaLabel;
296
+ }
297
+ if (ariaDescribedBy) {
298
+ props2["aria-describedby"] = ariaDescribedBy;
299
+ }
300
+ if (loading) {
301
+ props2["aria-busy"] = true;
302
+ props2["aria-disabled"] = true;
303
+ }
304
+ if (disabled || loading) {
305
+ props2["aria-disabled"] = true;
306
+ }
307
+ return props2;
308
+ }, [isIconOnly, ariaLabel, ariaDescribedBy, loading, disabled]);
309
+ const handleClick = (event) => {
310
+ if (disabled || loading) {
311
+ event.preventDefault();
312
+ return;
313
+ }
314
+ onClick == null ? void 0 : onClick(event);
315
+ };
316
+ if (asChild) {
317
+ return /* @__PURE__ */ jsxRuntime.jsx(
318
+ reactSlot.Slot,
319
+ __spreadProps(__spreadValues(__spreadValues({
320
+ ref,
321
+ className: buttonClasses
322
+ }, accessibilityProps), props), {
323
+ children
324
+ })
325
+ );
326
+ }
327
+ return /* @__PURE__ */ jsxRuntime.jsxs(
328
+ "button",
329
+ __spreadProps(__spreadValues(__spreadValues({
330
+ ref,
331
+ type,
332
+ className: buttonClasses,
333
+ disabled: disabled || loading,
334
+ onClick: handleClick
335
+ }, accessibilityProps), props), {
336
+ children: [
337
+ loading && /* @__PURE__ */ jsxRuntime.jsxs(
338
+ "svg",
339
+ {
340
+ className: "animate-spin -ml-1 mr-3 h-5 w-5 text-white",
341
+ xmlns: "http://www.w3.org/2000/svg",
342
+ fill: "none",
343
+ viewBox: "0 0 24 24",
344
+ children: [
345
+ /* @__PURE__ */ jsxRuntime.jsx(
346
+ "circle",
347
+ {
348
+ className: "opacity-25",
349
+ cx: "12",
350
+ cy: "12",
351
+ r: "10",
352
+ stroke: "currentColor"
353
+ }
354
+ ),
355
+ /* @__PURE__ */ jsxRuntime.jsx(
356
+ "path",
357
+ {
358
+ className: "opacity-75",
359
+ fill: "currentColor",
360
+ 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"
361
+ }
362
+ )
363
+ ]
364
+ }
365
+ ),
366
+ loading && loadingText ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: buttonLoadingClasses.text, children: loadingText }) : buttonContent
367
+ ]
368
+ })
369
+ );
370
+ });
371
+ Button.displayName = "Button";
372
+ var Select = SelectPrimitive__namespace.Root;
373
+ var SelectValue = SelectPrimitive__namespace.Value;
374
+ var SelectTrigger = React2__namespace.forwardRef((_a, ref) => {
375
+ var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
376
+ return /* @__PURE__ */ jsxRuntime.jsxs(
377
+ SelectPrimitive__namespace.Trigger,
378
+ __spreadProps(__spreadValues({
379
+ ref,
380
+ className: cn(
381
+ "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
382
+ className
383
+ )
384
+ }, props), {
385
+ children: [
386
+ children,
387
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ChevronDownIcon, { className: "h-4 w-4 opacity-50" }) })
388
+ ]
389
+ })
390
+ );
391
+ });
392
+ SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
393
+ var SelectScrollUpButton = React2__namespace.forwardRef((_a, ref) => {
394
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
395
+ return /* @__PURE__ */ jsxRuntime.jsx(
396
+ SelectPrimitive__namespace.ScrollUpButton,
397
+ __spreadProps(__spreadValues({
398
+ ref,
399
+ className: cn(
400
+ "flex cursor-default items-center justify-center py-1",
401
+ className
402
+ )
403
+ }, props), {
404
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ChevronUpIcon, { className: "h-4 w-4" })
405
+ })
406
+ );
407
+ });
408
+ SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
409
+ var SelectScrollDownButton = React2__namespace.forwardRef((_a, ref) => {
410
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
411
+ return /* @__PURE__ */ jsxRuntime.jsx(
412
+ SelectPrimitive__namespace.ScrollDownButton,
413
+ __spreadProps(__spreadValues({
414
+ ref,
415
+ className: cn(
416
+ "flex cursor-default items-center justify-center py-1",
417
+ className
418
+ )
419
+ }, props), {
420
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.ChevronDownIcon, { className: "h-4 w-4" })
421
+ })
422
+ );
423
+ });
424
+ SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
425
+ var SelectContent = React2__namespace.forwardRef((_a, ref) => {
426
+ var _b = _a, { className, children, position = "popper" } = _b, props = __objRest(_b, ["className", "children", "position"]);
427
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
428
+ SelectPrimitive__namespace.Content,
429
+ __spreadProps(__spreadValues({
430
+ ref,
431
+ className: cn(
432
+ "relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
433
+ position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
434
+ className
435
+ ),
436
+ position
437
+ }, props), {
438
+ children: [
439
+ /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
440
+ /* @__PURE__ */ jsxRuntime.jsx(
441
+ SelectPrimitive__namespace.Viewport,
442
+ {
443
+ className: cn(
444
+ "p-1",
445
+ position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
446
+ ),
447
+ children
448
+ }
449
+ ),
450
+ /* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
451
+ ]
452
+ })
453
+ ) });
454
+ });
455
+ SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
456
+ var SelectLabel = React2__namespace.forwardRef((_a, ref) => {
457
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
458
+ return /* @__PURE__ */ jsxRuntime.jsx(
459
+ SelectPrimitive__namespace.Label,
460
+ __spreadValues({
461
+ ref,
462
+ className: cn("px-2 py-1.5 text-sm font-semibold", className)
463
+ }, props)
464
+ );
465
+ });
466
+ SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
467
+ var SelectItem = React2__namespace.forwardRef((_a, ref) => {
468
+ var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
469
+ return /* @__PURE__ */ jsxRuntime.jsxs(
470
+ SelectPrimitive__namespace.Item,
471
+ __spreadProps(__spreadValues({
472
+ ref,
473
+ className: cn(
474
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
475
+ className
476
+ )
477
+ }, props), {
478
+ children: [
479
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.CheckIcon, { className: "h-4 w-4" }) }) }),
480
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
481
+ ]
482
+ })
483
+ );
484
+ });
485
+ SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
486
+ var SelectSeparator = React2__namespace.forwardRef((_a, ref) => {
487
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
488
+ return /* @__PURE__ */ jsxRuntime.jsx(
489
+ SelectPrimitive__namespace.Separator,
490
+ __spreadValues({
491
+ ref,
492
+ className: cn("-mx-1 my-1 h-px bg-muted", className)
493
+ }, props)
494
+ );
495
+ });
496
+ SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
497
+ function Pagination(_a) {
498
+ var _b = _a, {
499
+ totalCount,
500
+ pageSize,
501
+ currentPage,
502
+ onPageChange,
503
+ onPageSizeChange,
504
+ siblingCount = 1,
505
+ pageSizes = [10, 20, 30, 40, 50],
506
+ className
507
+ } = _b, props = __objRest(_b, [
508
+ "totalCount",
509
+ "pageSize",
510
+ "currentPage",
511
+ "onPageChange",
512
+ "onPageSizeChange",
513
+ "siblingCount",
514
+ "pageSizes",
515
+ "className"
516
+ ]);
517
+ const paginationRange = usePagination({
518
+ currentPage,
519
+ totalCount,
520
+ pageSize,
521
+ siblingCount
522
+ });
523
+ if (currentPage === 0 || paginationRange && paginationRange.length < 2) {
524
+ return null;
525
+ }
526
+ const onNext = () => {
527
+ onPageChange(currentPage + 1);
528
+ };
529
+ const onPrevious = () => {
530
+ onPageChange(currentPage - 1);
531
+ };
532
+ const lastPage = paginationRange ? paginationRange[paginationRange.length - 1] : 0;
533
+ return /* @__PURE__ */ jsxRuntime.jsxs(
534
+ "div",
535
+ __spreadProps(__spreadValues({
536
+ className: cn("flex items-center justify-end space-x-6 px-2", className)
537
+ }, props), {
538
+ children: [
539
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
540
+ /* @__PURE__ */ jsxRuntime.jsxs(
541
+ Button,
542
+ {
543
+ variant: "ghost",
544
+ className: "h-9 w-9 p-0",
545
+ onClick: onPrevious,
546
+ disabled: currentPage === 1,
547
+ children: [
548
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to previous page" }),
549
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { className: "h-5 w-5" })
550
+ ]
551
+ }
552
+ ),
553
+ paginationRange == null ? void 0 : paginationRange.map((pageNumber, index) => {
554
+ if (pageNumber === DOTS) {
555
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-1 text-muted-foreground", children: "\u2026" }, index);
556
+ }
557
+ const isCurrent = currentPage === pageNumber;
558
+ return /* @__PURE__ */ jsxRuntime.jsx(
559
+ Button,
560
+ {
561
+ variant: "ghost",
562
+ className: cn(
563
+ "h-9 w-9 rounded-md p-0 text-sm font-medium",
564
+ isCurrent && "bg-pagination-current text-white hover:bg-pagination-current/90",
565
+ !isCurrent && "text-primary hover:bg-pagination-hover"
566
+ ),
567
+ onClick: () => onPageChange(Number(pageNumber)),
568
+ children: pageNumber
569
+ },
570
+ index
571
+ );
572
+ }),
573
+ /* @__PURE__ */ jsxRuntime.jsxs(
574
+ Button,
575
+ {
576
+ variant: "ghost",
577
+ className: "h-9 w-9 p-0",
578
+ onClick: onNext,
579
+ disabled: currentPage === lastPage,
580
+ children: [
581
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Go to next page" }),
582
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { className: "h-5 w-5" })
583
+ ]
584
+ }
585
+ )
586
+ ] }),
587
+ onPageSizeChange && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center space-x-2", children: /* @__PURE__ */ jsxRuntime.jsxs(
588
+ Select,
589
+ {
590
+ value: `${pageSize}`,
591
+ onValueChange: (value) => {
592
+ onPageSizeChange(Number(value));
593
+ },
594
+ children: [
595
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-9 w-auto min-w-[180px]", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Resultados por p\xE1gina" }) }),
596
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { side: "top", children: pageSizes.map((size) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: `${size}`, children: size }, size)) })
597
+ ]
598
+ }
599
+ ) })
600
+ ]
601
+ })
602
+ );
603
+ }
604
+
605
+ exports.Pagination = Pagination;