@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.
- package/README.md +68 -4
- package/dist/atoms/avatar/index.d.mts +12 -0
- package/dist/atoms/avatar/index.d.ts +12 -0
- package/dist/atoms/avatar/index.js +99 -0
- package/dist/atoms/avatar/index.mjs +76 -0
- package/dist/atoms/badge/index.d.mts +16 -0
- package/dist/atoms/badge/index.d.ts +16 -0
- package/dist/atoms/badge/index.js +149 -0
- package/dist/atoms/badge/index.mjs +146 -0
- package/dist/atoms/button/index.d.mts +11 -0
- package/dist/atoms/button/index.d.ts +11 -0
- package/dist/atoms/button/index.js +307 -0
- package/dist/atoms/button/index.mjs +301 -0
- package/dist/atoms/checkbox/index.d.mts +6 -0
- package/dist/atoms/checkbox/index.d.ts +6 -0
- package/dist/atoms/checkbox/index.js +98 -0
- package/dist/atoms/checkbox/index.mjs +75 -0
- package/dist/atoms/input/index.d.mts +12 -0
- package/dist/atoms/input/index.d.ts +12 -0
- package/dist/atoms/input/index.js +104 -0
- package/dist/atoms/input/index.mjs +82 -0
- package/dist/atoms/label/index.d.mts +8 -0
- package/dist/atoms/label/index.d.ts +8 -0
- package/dist/atoms/label/index.js +77 -0
- package/dist/atoms/label/index.mjs +54 -0
- package/dist/atoms/radio/index.d.mts +7 -0
- package/dist/atoms/radio/index.d.ts +7 -0
- package/dist/atoms/radio/index.js +97 -0
- package/dist/atoms/radio/index.mjs +73 -0
- package/dist/atoms/switch/index.d.mts +6 -0
- package/dist/atoms/switch/index.d.ts +6 -0
- package/dist/atoms/switch/index.js +97 -0
- package/dist/atoms/switch/index.mjs +74 -0
- package/dist/atoms/tag/index.d.mts +14 -0
- package/dist/atoms/tag/index.d.ts +14 -0
- package/dist/atoms/tag/index.js +128 -0
- package/dist/atoms/tag/index.mjs +122 -0
- package/dist/atoms/textarea/index.d.mts +11 -0
- package/dist/atoms/textarea/index.d.ts +11 -0
- package/dist/atoms/textarea/index.js +125 -0
- package/dist/atoms/textarea/index.mjs +103 -0
- package/dist/atoms/typography/index.d.mts +20 -0
- package/dist/atoms/typography/index.d.ts +20 -0
- package/dist/atoms/typography/index.js +140 -0
- package/dist/atoms/typography/index.mjs +115 -0
- package/dist/hooks/index.d.mts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +17 -0
- package/dist/hooks/index.mjs +15 -0
- package/dist/hooks/use-pagination.d.mts +10 -0
- package/dist/hooks/use-pagination.d.ts +10 -0
- package/dist/hooks/use-pagination.js +54 -0
- package/dist/hooks/use-pagination.mjs +51 -0
- package/dist/hooks/use-toast.d.mts +2 -0
- package/dist/hooks/use-toast.d.ts +2 -0
- package/dist/hooks/use-toast.js +2 -0
- package/dist/hooks/use-toast.mjs +1 -0
- package/dist/hooks/useModal.d.mts +7 -0
- package/dist/hooks/useModal.d.ts +7 -0
- package/dist/hooks/useModal.js +17 -0
- package/dist/hooks/useModal.mjs +15 -0
- package/dist/index.d.mts +50 -1298
- package/dist/index.d.ts +50 -1298
- package/dist/molecules/accordion/index.d.mts +17 -0
- package/dist/molecules/accordion/index.d.ts +17 -0
- package/dist/molecules/accordion/index.js +154 -0
- package/dist/molecules/accordion/index.mjs +128 -0
- package/dist/molecules/alert/index.d.mts +14 -0
- package/dist/molecules/alert/index.d.ts +14 -0
- package/dist/molecules/alert/index.js +425 -0
- package/dist/molecules/alert/index.mjs +402 -0
- package/dist/molecules/card/index.d.mts +10 -0
- package/dist/molecules/card/index.d.ts +10 -0
- package/dist/molecules/card/index.js +128 -0
- package/dist/molecules/card/index.mjs +101 -0
- package/dist/molecules/chart/index.d.mts +80 -0
- package/dist/molecules/chart/index.d.ts +80 -0
- package/dist/molecules/chart/index.js +300 -0
- package/dist/molecules/chart/index.mjs +272 -0
- package/dist/molecules/data-table/index.d.mts +57 -0
- package/dist/molecules/data-table/index.d.ts +57 -0
- package/dist/molecules/data-table/index.js +1456 -0
- package/dist/molecules/data-table/index.mjs +1430 -0
- package/dist/molecules/date-picker/index.d.mts +12 -0
- package/dist/molecules/date-picker/index.d.ts +12 -0
- package/dist/molecules/date-picker/index.js +756 -0
- package/dist/molecules/date-picker/index.mjs +734 -0
- package/dist/molecules/dropdown/index.d.mts +21 -0
- package/dist/molecules/dropdown/index.d.ts +21 -0
- package/dist/molecules/dropdown/index.js +221 -0
- package/dist/molecules/dropdown/index.mjs +198 -0
- package/dist/molecules/form/index.d.mts +19 -0
- package/dist/molecules/form/index.d.ts +19 -0
- package/dist/molecules/form/index.js +139 -0
- package/dist/molecules/form/index.mjs +114 -0
- package/dist/molecules/pagination/index.d.mts +15 -0
- package/dist/molecules/pagination/index.d.ts +15 -0
- package/dist/molecules/pagination/index.js +605 -0
- package/dist/molecules/pagination/index.mjs +583 -0
- package/dist/molecules/progress-bar/index.d.mts +15 -0
- package/dist/molecules/progress-bar/index.d.ts +15 -0
- package/dist/molecules/progress-bar/index.js +166 -0
- package/dist/molecules/progress-bar/index.mjs +144 -0
- package/dist/molecules/select/index.d.mts +15 -0
- package/dist/molecules/select/index.d.ts +15 -0
- package/dist/molecules/select/index.js +201 -0
- package/dist/molecules/select/index.mjs +169 -0
- package/dist/molecules/stepper/index.d.mts +67 -0
- package/dist/molecules/stepper/index.d.ts +67 -0
- package/dist/molecules/stepper/index.js +287 -0
- package/dist/molecules/stepper/index.mjs +260 -0
- package/dist/molecules/tabs/index.d.mts +9 -0
- package/dist/molecules/tabs/index.d.ts +9 -0
- package/dist/molecules/tabs/index.js +112 -0
- package/dist/molecules/tabs/index.mjs +86 -0
- package/dist/tokens/badge.d.mts +39 -0
- package/dist/tokens/badge.d.ts +39 -0
- package/dist/tokens/badge.js +61 -0
- package/dist/tokens/badge.mjs +59 -0
- package/dist/tokens/buttons.d.mts +277 -0
- package/dist/tokens/buttons.d.ts +277 -0
- package/dist/tokens/buttons.js +191 -0
- package/dist/tokens/buttons.mjs +173 -0
- package/dist/tokens/colors.d.mts +65 -0
- package/dist/tokens/colors.d.ts +65 -0
- package/dist/tokens/colors.js +68 -0
- package/dist/tokens/colors.mjs +66 -0
- package/dist/tokens/effects.d.mts +124 -0
- package/dist/tokens/effects.d.ts +124 -0
- package/dist/tokens/effects.js +130 -0
- package/dist/tokens/effects.mjs +115 -0
- package/dist/tokens/grids.d.mts +331 -0
- package/dist/tokens/grids.d.ts +331 -0
- package/dist/tokens/grids.js +305 -0
- package/dist/tokens/grids.mjs +292 -0
- package/dist/tokens/icons.d.mts +134 -0
- package/dist/tokens/icons.d.ts +134 -0
- package/dist/tokens/icons.js +108 -0
- package/dist/tokens/icons.mjs +97 -0
- package/dist/tokens/index.d.mts +6 -0
- package/dist/tokens/index.d.ts +6 -0
- package/dist/tokens/index.js +775 -0
- package/dist/tokens/index.mjs +743 -0
- package/dist/tokens/progress-bar.d.mts +31 -0
- package/dist/tokens/progress-bar.d.ts +31 -0
- package/dist/tokens/progress-bar.js +70 -0
- package/dist/tokens/progress-bar.mjs +68 -0
- package/dist/tokens/spacing.d.mts +90 -0
- package/dist/tokens/spacing.d.ts +90 -0
- package/dist/tokens/spacing.js +120 -0
- package/dist/tokens/spacing.mjs +109 -0
- package/dist/tokens/stroke.d.mts +292 -0
- package/dist/tokens/stroke.d.ts +292 -0
- package/dist/tokens/stroke.js +202 -0
- package/dist/tokens/stroke.mjs +186 -0
- package/dist/tokens/tab.d.mts +31 -0
- package/dist/tokens/tab.d.ts +31 -0
- package/dist/tokens/tab.js +48 -0
- package/dist/tokens/tab.mjs +46 -0
- package/dist/tokens/tag.d.mts +53 -0
- package/dist/tokens/tag.d.ts +53 -0
- package/dist/tokens/tag.js +80 -0
- package/dist/tokens/tag.mjs +78 -0
- package/dist/tokens/typography.d.mts +394 -0
- package/dist/tokens/typography.d.ts +394 -0
- package/dist/tokens/typography.js +302 -0
- package/dist/tokens/typography.mjs +292 -0
- package/dist/utils/classNames.d.mts +3 -0
- package/dist/utils/classNames.d.ts +3 -0
- package/dist/utils/classNames.js +8 -0
- package/dist/utils/classNames.mjs +6 -0
- package/dist/utils/cn.d.mts +5 -0
- package/dist/utils/cn.d.ts +5 -0
- package/dist/utils/cn.js +11 -0
- package/dist/utils/cn.mjs +9 -0
- package/dist/utils/index.d.mts +3 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/index.mjs +12 -0
- package/package.json +34 -1
package/README.md
CHANGED
|
@@ -6,6 +6,27 @@ A comprehensive, extensible design system built with **shadcn/ui** and **Tailwin
|
|
|
6
6
|
|
|
7
7
|
The Raya Design System provides a unified approach to building consistent, accessible, and beautiful user interfaces across all Raya products. Built on top of industry-standard tools, it ensures rapid development while maintaining design consistency.
|
|
8
8
|
|
|
9
|
+
## ⚡ Bundle Size Optimization
|
|
10
|
+
|
|
11
|
+
**v0.2.2** introduces major bundle size optimizations:
|
|
12
|
+
|
|
13
|
+
- **Icons Package**: Reduced from ~856KB to ~5.3KB gzipped (98% reduction)
|
|
14
|
+
- **Main Package**: Individual imports reduce bundle size by up to 94%
|
|
15
|
+
- **Tree-shaking**: Optimal support for importing only what you need
|
|
16
|
+
|
|
17
|
+
### Bundle Size Comparison
|
|
18
|
+
|
|
19
|
+
| Import Method | Bundle Size | Best For |
|
|
20
|
+
|--------------|-------------|----------|
|
|
21
|
+
| Barrel Import (`@grupor5/raya`) | ~97KB gzipped | Prototypes, small apps |
|
|
22
|
+
| Individual Imports | ~3-50KB gzipped | Production apps |
|
|
23
|
+
| Single Component | ~3-11KB gzipped | Micro-frontends |
|
|
24
|
+
|
|
25
|
+
**Example**: `Button + Input + Card`
|
|
26
|
+
- **Before**: ~321KB (barrel import)
|
|
27
|
+
- **After**: ~18KB (individual imports)
|
|
28
|
+
- **Reduction**: 94% smaller!
|
|
29
|
+
|
|
9
30
|
## ✅ Current Status
|
|
10
31
|
|
|
11
32
|
- **Colors**: ✅ Validated and corrected against design palette
|
|
@@ -199,16 +220,45 @@ Finalmente, importa los estilos base de Raya en tu archivo CSS principal (por ej
|
|
|
199
220
|
|
|
200
221
|
Esto asegura que todas las variables CSS y estilos base del sistema de diseño estén disponibles en tu aplicación.
|
|
201
222
|
|
|
202
|
-
### Uso de Iconos
|
|
223
|
+
### Uso de Componentes e Iconos
|
|
224
|
+
|
|
225
|
+
#### Componentes del Sistema de Diseño
|
|
203
226
|
|
|
204
|
-
Los
|
|
227
|
+
Los componentes ahora soportan importaciones individuales para optimizar el bundle size:
|
|
205
228
|
|
|
206
229
|
```tsx
|
|
207
|
-
// Importación individual (recomendado para
|
|
230
|
+
// ✅ Importación individual (recomendado para bundle size óptimo)
|
|
231
|
+
import { Button } from '@grupor5/raya/atoms/button';
|
|
232
|
+
import { Card } from '@grupor5/raya/molecules/card';
|
|
233
|
+
import { Input } from '@grupor5/raya/atoms/input';
|
|
234
|
+
|
|
235
|
+
// ✅ Importación por barrel (carga todos los componentes)
|
|
236
|
+
import { Button, Card, Input } from '@grupor5/raya';
|
|
237
|
+
|
|
238
|
+
// ✅ Importación de tokens individuales
|
|
239
|
+
import { colors } from '@grupor5/raya/tokens/colors';
|
|
240
|
+
import { spacing } from '@grupor5/raya/tokens/spacing';
|
|
241
|
+
|
|
242
|
+
function MyComponent() {
|
|
243
|
+
return (
|
|
244
|
+
<Card className="p-6">
|
|
245
|
+
<Input placeholder="Ingresa tu nombre" />
|
|
246
|
+
<Button variant="primary">Enviar</Button>
|
|
247
|
+
</Card>
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### Uso de Iconos
|
|
253
|
+
|
|
254
|
+
Los iconos se importan desde el paquete separado `@grupor5/raya-icons`:
|
|
255
|
+
|
|
256
|
+
```tsx
|
|
257
|
+
// ✅ Importación individual (recomendado para tree-shaking óptimo)
|
|
208
258
|
import { AddIcon } from '@grupor5/raya-icons/icons/AddIcon';
|
|
209
259
|
import { EditIcon } from '@grupor5/raya-icons/icons/EditIcon';
|
|
210
260
|
|
|
211
|
-
// Importación por barrel (solo iconos comunes)
|
|
261
|
+
// ✅ Importación por barrel (solo iconos comunes - 27 iconos)
|
|
212
262
|
import { AddIcon, EditIcon, CheckIcon } from '@grupor5/raya-icons';
|
|
213
263
|
|
|
214
264
|
function MyComponent() {
|
|
@@ -221,6 +271,20 @@ function MyComponent() {
|
|
|
221
271
|
}
|
|
222
272
|
```
|
|
223
273
|
|
|
274
|
+
#### Recomendaciones de Bundle Size
|
|
275
|
+
|
|
276
|
+
- **Para aplicaciones pequeñas**: Usa importaciones por barrel para simplicidad
|
|
277
|
+
- **Para aplicaciones grandes**: Usa importaciones individuales para optimizar bundle size
|
|
278
|
+
- **Componentes pesados**: Siempre usa importación individual para DataTable, Chart, DatePicker
|
|
279
|
+
|
|
280
|
+
```tsx
|
|
281
|
+
// ❌ Evitar para componentes pesados
|
|
282
|
+
import { DataTable } from '@grupor5/raya';
|
|
283
|
+
|
|
284
|
+
// ✅ Preferir importación individual
|
|
285
|
+
import { DataTable } from '@grupor5/raya/molecules/data-table';
|
|
286
|
+
```
|
|
287
|
+
|
|
224
288
|
## 🧩 Components (Coming Soon)
|
|
225
289
|
|
|
226
290
|
React components built on shadcn/ui foundation:
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
src?: string | null;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
|
|
10
|
+
declare function AvatarSkeleton(): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Avatar, AvatarSkeleton };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
src?: string | null;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
|
|
10
|
+
declare function AvatarSkeleton(): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { Avatar, AvatarSkeleton };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var tailwindMerge = require('tailwind-merge');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
var __defProp = Object.defineProperty;
|
|
29
|
+
var __defProps = Object.defineProperties;
|
|
30
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
31
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
32
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
33
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
34
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
35
|
+
var __spreadValues = (a, b) => {
|
|
36
|
+
for (var prop in b || (b = {}))
|
|
37
|
+
if (__hasOwnProp.call(b, prop))
|
|
38
|
+
__defNormalProp(a, prop, b[prop]);
|
|
39
|
+
if (__getOwnPropSymbols)
|
|
40
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
41
|
+
if (__propIsEnum.call(b, prop))
|
|
42
|
+
__defNormalProp(a, prop, b[prop]);
|
|
43
|
+
}
|
|
44
|
+
return a;
|
|
45
|
+
};
|
|
46
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
47
|
+
var __objRest = (source, exclude) => {
|
|
48
|
+
var target = {};
|
|
49
|
+
for (var prop in source)
|
|
50
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
51
|
+
target[prop] = source[prop];
|
|
52
|
+
if (source != null && __getOwnPropSymbols)
|
|
53
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
54
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
55
|
+
target[prop] = source[prop];
|
|
56
|
+
}
|
|
57
|
+
return target;
|
|
58
|
+
};
|
|
59
|
+
function cn(...inputs) {
|
|
60
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
61
|
+
}
|
|
62
|
+
function getInitials(name) {
|
|
63
|
+
const [firstName, lastName] = name.split(" ");
|
|
64
|
+
if (firstName && lastName) {
|
|
65
|
+
return `${firstName[0]}${lastName[0]}`.toUpperCase();
|
|
66
|
+
}
|
|
67
|
+
return firstName ? `${firstName.substring(0, 2)}`.toUpperCase() : "N/A";
|
|
68
|
+
}
|
|
69
|
+
var Avatar = React__namespace.forwardRef(
|
|
70
|
+
(_a, ref) => {
|
|
71
|
+
var _b = _a, { src, name, className } = _b, props = __objRest(_b, ["src", "name", "className"]);
|
|
72
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
73
|
+
"div",
|
|
74
|
+
__spreadProps(__spreadValues({
|
|
75
|
+
ref,
|
|
76
|
+
className: cn(
|
|
77
|
+
"relative flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-neutral-200 text-sm font-semibold text-primary",
|
|
78
|
+
className
|
|
79
|
+
)
|
|
80
|
+
}, props), {
|
|
81
|
+
children: src ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
82
|
+
"img",
|
|
83
|
+
{
|
|
84
|
+
src,
|
|
85
|
+
alt: name,
|
|
86
|
+
className: "h-full w-full rounded-full object-cover"
|
|
87
|
+
}
|
|
88
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: getInitials(name) })
|
|
89
|
+
})
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
Avatar.displayName = "Avatar";
|
|
94
|
+
function AvatarSkeleton() {
|
|
95
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-10 w-10 shrink-0 animate-pulse rounded-full bg-neutral-200" });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
exports.Avatar = Avatar;
|
|
99
|
+
exports.AvatarSkeleton = AvatarSkeleton;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __defProps = Object.defineProperties;
|
|
8
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
9
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
10
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
function cn(...inputs) {
|
|
38
|
+
return twMerge(clsx(inputs));
|
|
39
|
+
}
|
|
40
|
+
function getInitials(name) {
|
|
41
|
+
const [firstName, lastName] = name.split(" ");
|
|
42
|
+
if (firstName && lastName) {
|
|
43
|
+
return `${firstName[0]}${lastName[0]}`.toUpperCase();
|
|
44
|
+
}
|
|
45
|
+
return firstName ? `${firstName.substring(0, 2)}`.toUpperCase() : "N/A";
|
|
46
|
+
}
|
|
47
|
+
var Avatar = React.forwardRef(
|
|
48
|
+
(_a, ref) => {
|
|
49
|
+
var _b = _a, { src, name, className } = _b, props = __objRest(_b, ["src", "name", "className"]);
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
__spreadProps(__spreadValues({
|
|
53
|
+
ref,
|
|
54
|
+
className: cn(
|
|
55
|
+
"relative flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-neutral-200 text-sm font-semibold text-primary",
|
|
56
|
+
className
|
|
57
|
+
)
|
|
58
|
+
}, props), {
|
|
59
|
+
children: src ? /* @__PURE__ */ jsx(
|
|
60
|
+
"img",
|
|
61
|
+
{
|
|
62
|
+
src,
|
|
63
|
+
alt: name,
|
|
64
|
+
className: "h-full w-full rounded-full object-cover"
|
|
65
|
+
}
|
|
66
|
+
) : /* @__PURE__ */ jsx("span", { children: getInitials(name) })
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
Avatar.displayName = "Avatar";
|
|
72
|
+
function AvatarSkeleton() {
|
|
73
|
+
return /* @__PURE__ */ jsx("div", { className: "h-10 w-10 shrink-0 animate-pulse rounded-full bg-neutral-200" });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { Avatar, AvatarSkeleton };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const badgeVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "success" | "danger" | "pending" | "in-progress" | null | undefined;
|
|
8
|
+
shape?: "rounded" | "circular" | null | undefined;
|
|
9
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
10
|
+
visual?: "solid" | "dot" | null | undefined;
|
|
11
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
12
|
+
interface BadgeProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
13
|
+
}
|
|
14
|
+
declare function Badge({ className, variant, size, visual, shape, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { Badge, type BadgeProps, badgeVariants };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { VariantProps } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
declare const badgeVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "success" | "danger" | "pending" | "in-progress" | null | undefined;
|
|
8
|
+
shape?: "rounded" | "circular" | null | undefined;
|
|
9
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
10
|
+
visual?: "solid" | "dot" | null | undefined;
|
|
11
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
12
|
+
interface BadgeProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
13
|
+
}
|
|
14
|
+
declare function Badge({ className, variant, size, visual, shape, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { Badge, type BadgeProps, badgeVariants };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var tailwindMerge = require('tailwind-merge');
|
|
6
|
+
var rayaIcons = require('@grupor5/raya-icons');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __defProps = Object.defineProperties;
|
|
11
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
12
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
15
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16
|
+
var __spreadValues = (a, b) => {
|
|
17
|
+
for (var prop in b || (b = {}))
|
|
18
|
+
if (__hasOwnProp.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
if (__getOwnPropSymbols)
|
|
21
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
22
|
+
if (__propIsEnum.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
}
|
|
25
|
+
return a;
|
|
26
|
+
};
|
|
27
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
28
|
+
var __objRest = (source, exclude) => {
|
|
29
|
+
var target = {};
|
|
30
|
+
for (var prop in source)
|
|
31
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
if (source != null && __getOwnPropSymbols)
|
|
34
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
35
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
36
|
+
target[prop] = source[prop];
|
|
37
|
+
}
|
|
38
|
+
return target;
|
|
39
|
+
};
|
|
40
|
+
function cn(...inputs) {
|
|
41
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
42
|
+
}
|
|
43
|
+
var badgeVariants = classVarianceAuthority.cva(
|
|
44
|
+
"inline-flex items-center justify-center rounded-badge border px-badge-x py-badge-y text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
45
|
+
{
|
|
46
|
+
variants: {
|
|
47
|
+
variant: {
|
|
48
|
+
default: "border-transparent",
|
|
49
|
+
success: "border-transparent",
|
|
50
|
+
danger: "border-transparent",
|
|
51
|
+
pending: "border-transparent",
|
|
52
|
+
"in-progress": "border-transparent"
|
|
53
|
+
},
|
|
54
|
+
shape: {
|
|
55
|
+
rounded: "",
|
|
56
|
+
circular: "rounded-full !px-0"
|
|
57
|
+
},
|
|
58
|
+
size: {
|
|
59
|
+
sm: "text-badge-sm",
|
|
60
|
+
md: "text-badge-md",
|
|
61
|
+
lg: "text-badge-lg"
|
|
62
|
+
},
|
|
63
|
+
visual: {
|
|
64
|
+
solid: "",
|
|
65
|
+
dot: "bg-transparent"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
compoundVariants: [
|
|
69
|
+
// Default
|
|
70
|
+
{
|
|
71
|
+
variant: "default",
|
|
72
|
+
visual: "solid",
|
|
73
|
+
className: "bg-badge-default-background text-badge-default-text-on-solid"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
variant: "default",
|
|
77
|
+
visual: "dot",
|
|
78
|
+
className: "text-badge-default-text"
|
|
79
|
+
},
|
|
80
|
+
// In Progress
|
|
81
|
+
{
|
|
82
|
+
variant: "in-progress",
|
|
83
|
+
visual: "solid",
|
|
84
|
+
className: "bg-badge-in-progress-background text-badge-in-progress-text"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
variant: "in-progress",
|
|
88
|
+
visual: "dot",
|
|
89
|
+
className: "text-badge-in-progress-text"
|
|
90
|
+
},
|
|
91
|
+
// Success
|
|
92
|
+
{
|
|
93
|
+
variant: "success",
|
|
94
|
+
visual: "solid",
|
|
95
|
+
className: "bg-badge-success-background text-badge-success-text"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
variant: "success",
|
|
99
|
+
visual: "dot",
|
|
100
|
+
className: "text-badge-success-text"
|
|
101
|
+
},
|
|
102
|
+
// Pending
|
|
103
|
+
{
|
|
104
|
+
variant: "pending",
|
|
105
|
+
visual: "solid",
|
|
106
|
+
className: "bg-badge-pending-background text-badge-pending-text"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
variant: "pending",
|
|
110
|
+
visual: "dot",
|
|
111
|
+
className: "text-badge-pending-text"
|
|
112
|
+
},
|
|
113
|
+
// Danger
|
|
114
|
+
{
|
|
115
|
+
variant: "danger",
|
|
116
|
+
visual: "solid",
|
|
117
|
+
className: "bg-badge-danger-background text-badge-danger-text"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
variant: "danger",
|
|
121
|
+
visual: "dot",
|
|
122
|
+
className: "text-badge-danger-text"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
defaultVariants: {
|
|
126
|
+
variant: "default",
|
|
127
|
+
size: "md",
|
|
128
|
+
visual: "solid",
|
|
129
|
+
shape: "rounded"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
function Badge(_a) {
|
|
134
|
+
var _b = _a, { className, variant, size, visual, shape } = _b, props = __objRest(_b, ["className", "variant", "size", "visual", "shape"]);
|
|
135
|
+
const iconSize = size === "sm" ? 8 : size === "lg" ? 12 : 10;
|
|
136
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", __spreadProps(__spreadValues({ className: cn(badgeVariants({ variant, size, visual, shape }), className) }, props), { children: [
|
|
137
|
+
visual === "dot" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
rayaIcons.DotIcon,
|
|
139
|
+
{
|
|
140
|
+
size: iconSize,
|
|
141
|
+
className: cn("flex-shrink-0", { "mr-1.5": !!props.children })
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
props.children
|
|
145
|
+
] }));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
exports.Badge = Badge;
|
|
149
|
+
exports.badgeVariants = badgeVariants;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { DotIcon } from '@grupor5/raya-icons';
|
|
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
|
+
var badgeVariants = cva(
|
|
42
|
+
"inline-flex items-center justify-center rounded-badge border px-badge-x py-badge-y text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
43
|
+
{
|
|
44
|
+
variants: {
|
|
45
|
+
variant: {
|
|
46
|
+
default: "border-transparent",
|
|
47
|
+
success: "border-transparent",
|
|
48
|
+
danger: "border-transparent",
|
|
49
|
+
pending: "border-transparent",
|
|
50
|
+
"in-progress": "border-transparent"
|
|
51
|
+
},
|
|
52
|
+
shape: {
|
|
53
|
+
rounded: "",
|
|
54
|
+
circular: "rounded-full !px-0"
|
|
55
|
+
},
|
|
56
|
+
size: {
|
|
57
|
+
sm: "text-badge-sm",
|
|
58
|
+
md: "text-badge-md",
|
|
59
|
+
lg: "text-badge-lg"
|
|
60
|
+
},
|
|
61
|
+
visual: {
|
|
62
|
+
solid: "",
|
|
63
|
+
dot: "bg-transparent"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
compoundVariants: [
|
|
67
|
+
// Default
|
|
68
|
+
{
|
|
69
|
+
variant: "default",
|
|
70
|
+
visual: "solid",
|
|
71
|
+
className: "bg-badge-default-background text-badge-default-text-on-solid"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
variant: "default",
|
|
75
|
+
visual: "dot",
|
|
76
|
+
className: "text-badge-default-text"
|
|
77
|
+
},
|
|
78
|
+
// In Progress
|
|
79
|
+
{
|
|
80
|
+
variant: "in-progress",
|
|
81
|
+
visual: "solid",
|
|
82
|
+
className: "bg-badge-in-progress-background text-badge-in-progress-text"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
variant: "in-progress",
|
|
86
|
+
visual: "dot",
|
|
87
|
+
className: "text-badge-in-progress-text"
|
|
88
|
+
},
|
|
89
|
+
// Success
|
|
90
|
+
{
|
|
91
|
+
variant: "success",
|
|
92
|
+
visual: "solid",
|
|
93
|
+
className: "bg-badge-success-background text-badge-success-text"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
variant: "success",
|
|
97
|
+
visual: "dot",
|
|
98
|
+
className: "text-badge-success-text"
|
|
99
|
+
},
|
|
100
|
+
// Pending
|
|
101
|
+
{
|
|
102
|
+
variant: "pending",
|
|
103
|
+
visual: "solid",
|
|
104
|
+
className: "bg-badge-pending-background text-badge-pending-text"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
variant: "pending",
|
|
108
|
+
visual: "dot",
|
|
109
|
+
className: "text-badge-pending-text"
|
|
110
|
+
},
|
|
111
|
+
// Danger
|
|
112
|
+
{
|
|
113
|
+
variant: "danger",
|
|
114
|
+
visual: "solid",
|
|
115
|
+
className: "bg-badge-danger-background text-badge-danger-text"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
variant: "danger",
|
|
119
|
+
visual: "dot",
|
|
120
|
+
className: "text-badge-danger-text"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
defaultVariants: {
|
|
124
|
+
variant: "default",
|
|
125
|
+
size: "md",
|
|
126
|
+
visual: "solid",
|
|
127
|
+
shape: "rounded"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
function Badge(_a) {
|
|
132
|
+
var _b = _a, { className, variant, size, visual, shape } = _b, props = __objRest(_b, ["className", "variant", "size", "visual", "shape"]);
|
|
133
|
+
const iconSize = size === "sm" ? 8 : size === "lg" ? 12 : 10;
|
|
134
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ className: cn(badgeVariants({ variant, size, visual, shape }), className) }, props), { children: [
|
|
135
|
+
visual === "dot" && /* @__PURE__ */ jsx(
|
|
136
|
+
DotIcon,
|
|
137
|
+
{
|
|
138
|
+
size: iconSize,
|
|
139
|
+
className: cn("flex-shrink-0", { "mr-1.5": !!props.children })
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
props.children
|
|
143
|
+
] }));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { ButtonProps as ButtonProps$1 } from '../../tokens/buttons.mjs';
|
|
3
|
+
|
|
4
|
+
interface ButtonProps extends Omit<ButtonProps$1, 'icon' | 'iconLeft' | 'iconRight'> {
|
|
5
|
+
icon?: React__default.ReactNode;
|
|
6
|
+
iconLeft?: React__default.ReactNode;
|
|
7
|
+
iconRight?: React__default.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
|
|
11
|
+
export { Button, type ButtonProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { ButtonProps as ButtonProps$1 } from '../../tokens/buttons.js';
|
|
3
|
+
|
|
4
|
+
interface ButtonProps extends Omit<ButtonProps$1, 'icon' | 'iconLeft' | 'iconRight'> {
|
|
5
|
+
icon?: React__default.ReactNode;
|
|
6
|
+
iconLeft?: React__default.ReactNode;
|
|
7
|
+
iconRight?: React__default.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const Button: React__default.ForwardRefExoticComponent<ButtonProps & React__default.RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
|
|
11
|
+
export { Button, type ButtonProps };
|