anteriority-ui 1.0.0
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/.github/workflows/ci.yml +31 -0
- package/.github/workflows/publish.yml +45 -0
- package/.npmrc.bak +1 -0
- package/.storybook/main.js +15 -0
- package/.storybook/preview.jsx +26 -0
- package/AnteriorityUI.md +2400 -0
- package/CLAUDE.md +91 -0
- package/README.md +182 -0
- package/assets/anteriorityUI/AnteriorityUI.logo.jpeg +0 -0
- package/assets/favicon/anteriorityUI.ico +0 -0
- package/common/api/client.js +43 -0
- package/common/storage/LocalStorage.js +13 -0
- package/common/styles/typography.css +5 -0
- package/common/styles/variables.css +192 -0
- package/common/theme/muiTheme.js +9 -0
- package/features/password-reset/api.js +39 -0
- package/features/user-profile/api.js +5 -0
- package/hooks/useAdminPasswordReset.js +133 -0
- package/index.js +57 -0
- package/package.json +57 -0
- package/pnpm-workspace.yaml +3 -0
- package/screens/components/AlertModal/AlertModal.jsx +259 -0
- package/screens/components/AlertModal/AlertModal.module.css +185 -0
- package/screens/components/AlertModal/AlertModal.stories.jsx +87 -0
- package/screens/components/Avatar/index.jsx +0 -0
- package/screens/components/Avatar/index.module.css +0 -0
- package/screens/components/Avatar/utils.js +0 -0
- package/screens/components/Badge/index.jsx +33 -0
- package/screens/components/Badge/index.module.css +18 -0
- package/screens/components/Badge/index.stories.jsx +40 -0
- package/screens/components/Barnner/index.jsx +21 -0
- package/screens/components/Barnner/index.module.css +33 -0
- package/screens/components/Barnner/index.stories.jsx +39 -0
- package/screens/components/Barnner/utils.js +0 -0
- package/screens/components/BlueLink/index.jsx +27 -0
- package/screens/components/BlueLink/index.module.css +11 -0
- package/screens/components/BlueLink/index.stories.jsx +29 -0
- package/screens/components/Breadcrumbs/index.jsx +62 -0
- package/screens/components/Breadcrumbs/index.module.css +158 -0
- package/screens/components/Breadcrumbs/index.stories.jsx +37 -0
- package/screens/components/Button/index.jsx +169 -0
- package/screens/components/Button/index.module.css +168 -0
- package/screens/components/Button/index.stories.jsx +71 -0
- package/screens/components/Button/utils.js +28 -0
- package/screens/components/CalendarComponent/CustomDatePicker.jsx +248 -0
- package/screens/components/CalendarComponent/CustomDatePicker.module.css +323 -0
- package/screens/components/CalendarComponent/CustomDatePicker.stories.jsx +45 -0
- package/screens/components/CalendarPicker/Constants.js +12 -0
- package/screens/components/CalendarPicker/index.jsx +263 -0
- package/screens/components/CalendarPicker/index.module.css +147 -0
- package/screens/components/CalendarPicker/index.stories.jsx +45 -0
- package/screens/components/CalendarPicker/utils.js +42 -0
- package/screens/components/CardV1/index.jsx +165 -0
- package/screens/components/CardV1/index.module.css +232 -0
- package/screens/components/CardV1/index.stories.jsx +62 -0
- package/screens/components/CardV1/utils.js +49 -0
- package/screens/components/ChatWindow/index.jsx +251 -0
- package/screens/components/ChatWindow/index.module.css +311 -0
- package/screens/components/ChatWindow/index.stories.jsx +62 -0
- package/screens/components/Checks/index.jsx +31 -0
- package/screens/components/Checks/index.module.css +32 -0
- package/screens/components/Checks/index.stories.jsx +32 -0
- package/screens/components/Container/index.jsx +36 -0
- package/screens/components/Container/index.module.css +24 -0
- package/screens/components/Container/index.stories.jsx +32 -0
- package/screens/components/CopyText/index.jsx +42 -0
- package/screens/components/CopyText/index.module.css +52 -0
- package/screens/components/CopyText/index.stories.jsx +24 -0
- package/screens/components/CountdownBar/constants.js +3 -0
- package/screens/components/CountdownBar/index.jsx +81 -0
- package/screens/components/CountdownBar/index.module.css +45 -0
- package/screens/components/CountdownBar/index.stories.jsx +43 -0
- package/screens/components/CountdownBar/utils.js +119 -0
- package/screens/components/DateTag/index.jsx +33 -0
- package/screens/components/DateTag/index.module.css +12 -0
- package/screens/components/DateTag/index.stories.jsx +29 -0
- package/screens/components/DesplegablePanel/constants.js +0 -0
- package/screens/components/DesplegablePanel/index.jsx +61 -0
- package/screens/components/DesplegablePanel/index.module.css +120 -0
- package/screens/components/DesplegablePanel/index.stories.jsx +44 -0
- package/screens/components/DesplegablePanel/utils.js +0 -0
- package/screens/components/DrawPanel/index.jsx +217 -0
- package/screens/components/DrawPanel/index.module.css +252 -0
- package/screens/components/DrawPanel/index.stories.jsx +66 -0
- package/screens/components/DrawPanel/utils.js +0 -0
- package/screens/components/Filter/index.jsx +105 -0
- package/screens/components/Filter/index.module.css +91 -0
- package/screens/components/Filter/index.stories.jsx +46 -0
- package/screens/components/Filter/utils.js +0 -0
- package/screens/components/FormControls/FormControls.module.css +86 -0
- package/screens/components/FormControls/index.jsx +51 -0
- package/screens/components/FormControls/index.stories.jsx +36 -0
- package/screens/components/Frame/index.jsx +54 -0
- package/screens/components/Frame/index.module.css +102 -0
- package/screens/components/Frame/index.stories.jsx +37 -0
- package/screens/components/Frame/utils.js +0 -0
- package/screens/components/GreenHighlight/index.jsx +11 -0
- package/screens/components/GreenHighlight/index.module.css +7 -0
- package/screens/components/GreenHighlight/index.stories.jsx +26 -0
- package/screens/components/GreenHighlight/utils.jsx +45 -0
- package/screens/components/HoursPicker/Constants.js +26 -0
- package/screens/components/HoursPicker/index.jsx +350 -0
- package/screens/components/HoursPicker/index.module.css +99 -0
- package/screens/components/HoursPicker/index.stories.jsx +44 -0
- package/screens/components/HoursPicker/utils.js +48 -0
- package/screens/components/InfoTooltip/index.jsx +59 -0
- package/screens/components/InfoTooltip/index.module.css +98 -0
- package/screens/components/InfoTooltip/index.stories.jsx +35 -0
- package/screens/components/Input/index.jsx +36 -0
- package/screens/components/Input/index.module.css +49 -0
- package/screens/components/Input/index.stories.jsx +37 -0
- package/screens/components/Input/utils.js +0 -0
- package/screens/components/Loading/index.jsx +76 -0
- package/screens/components/Loading/index.module.css +193 -0
- package/screens/components/Loading/index.stories.jsx +38 -0
- package/screens/components/Loading/utils.js +0 -0
- package/screens/components/MarkdownContent/index.jsx +16 -0
- package/screens/components/MarkdownContent/index.module.css +149 -0
- package/screens/components/MarkdownContent/index.stories.jsx +30 -0
- package/screens/components/MarkdownEditor/index.jsx +430 -0
- package/screens/components/MarkdownEditor/index.module.css +192 -0
- package/screens/components/MarkdownEditor/index.stories.jsx +50 -0
- package/screens/components/Material-UI/Components/InputWithIcon/index.jsx +87 -0
- package/screens/components/Material-UI/Components/InputWithIcon/index.stories.jsx +49 -0
- package/screens/components/Material-UI/Components/MenuPopover/index.jsx +117 -0
- package/screens/components/Material-UI/Components/MenuPopover/index.stories.jsx +36 -0
- package/screens/components/Material-UI/Components/MultilinePlaceholder/index.jsx +44 -0
- package/screens/components/Material-UI/Components/MultilinePlaceholder/index.stories.jsx +45 -0
- package/screens/components/Material-UI/Components/Paginador/index.jsx +79 -0
- package/screens/components/Material-UI/Components/Paginador/index.stories.jsx +49 -0
- package/screens/components/Material-UI/Components/Search/index.jsx +81 -0
- package/screens/components/Material-UI/Components/Search/index.stories.jsx +68 -0
- package/screens/components/Material-UI/Components/Selector/index.jsx +100 -0
- package/screens/components/Material-UI/Components/Selector/index.module.css +0 -0
- package/screens/components/Material-UI/Components/Selector/index.stories.jsx +52 -0
- package/screens/components/Material-UI/Components/Selector/utils.js +0 -0
- package/screens/components/Material-UI/Components/TextField/index.jsx +61 -0
- package/screens/components/Material-UI/Components/TextField/index.stories.jsx +53 -0
- package/screens/components/ModalTooltip/ModalTooltip.jsx +122 -0
- package/screens/components/ModalTooltip/ModalTooltip.module.css +65 -0
- package/screens/components/ModalTooltip/ModalTooltip.stories.jsx +39 -0
- package/screens/components/Notification/Error/ErrorMessage.jsx +30 -0
- package/screens/components/Notification/Error/ErrorMessage.module.css +57 -0
- package/screens/components/Notification/Error/ErrorMessage.stories.jsx +37 -0
- package/screens/components/PasswordResetPanel/index.jsx +325 -0
- package/screens/components/PasswordResetPanel/index.stories.jsx +26 -0
- package/screens/components/PlaceholderButton/index.jsx +169 -0
- package/screens/components/PlaceholderButton/index.module.css +162 -0
- package/screens/components/PlaceholderButton/index.stories.jsx +69 -0
- package/screens/components/PlaceholderButton/utils.js +42 -0
- package/screens/components/Profile/Avatar/index.jsx +125 -0
- package/screens/components/Profile/Avatar/index.module.css +86 -0
- package/screens/components/Profile/Avatar/index.stories.jsx +48 -0
- package/screens/components/Profile/Avatar/utils.js +18 -0
- package/screens/components/Profile/index.jsx +58 -0
- package/screens/components/Profile/index.module.css +0 -0
- package/screens/components/Profile/index.stories.jsx +38 -0
- package/screens/components/Profile/utils.js +0 -0
- package/screens/components/ScrollBar/index.jsx +62 -0
- package/screens/components/ScrollBar/index.module.css +78 -0
- package/screens/components/ScrollBar/index.stories.jsx +64 -0
- package/screens/components/ScrollBar/utils.js +127 -0
- package/screens/components/Sidebar/constants.js +16 -0
- package/screens/components/Sidebar/index.jsx +399 -0
- package/screens/components/Sidebar/index.module.css +405 -0
- package/screens/components/Sidebar/index.stories.jsx +86 -0
- package/screens/components/Sidebar/utils.js +75 -0
- package/screens/components/Skeleton/index.jsx +11 -0
- package/screens/components/Skeleton/index.module.css +26 -0
- package/screens/components/Skeleton/index.stories.jsx +42 -0
- package/screens/components/SubSidebarLayout/index.jsx +44 -0
- package/screens/components/SubSidebarLayout/index.module.css +80 -0
- package/screens/components/SubSidebarLayout/index.stories.jsx +51 -0
- package/screens/components/SummaryCard/index.jsx +50 -0
- package/screens/components/SummaryCard/index.module.css +30 -0
- package/screens/components/SummaryCard/index.stories.jsx +29 -0
- package/screens/components/Swich/constants.js +4 -0
- package/screens/components/Swich/index.jsx +85 -0
- package/screens/components/Swich/index.module.css +68 -0
- package/screens/components/Swich/index.stories.jsx +44 -0
- package/screens/components/Swich/utils.js +0 -0
- package/screens/components/TableA/index.jsx +156 -0
- package/screens/components/TableA/index.module.css +105 -0
- package/screens/components/TableA/index.stories.jsx +116 -0
- package/screens/components/TableA/utils.js +11 -0
- package/screens/components/TableB/index.jsx +222 -0
- package/screens/components/TableB/index.module.css +295 -0
- package/screens/components/TableB/index.stories.jsx +110 -0
- package/screens/components/TableB/utils.js +11 -0
- package/screens/components/ToggleCard/index.jsx +64 -0
- package/screens/components/ToggleCard/index.module.css +111 -0
- package/screens/components/ToggleCard/index.stories.jsx +49 -0
- package/screens/components/UserEditPopover/index.jsx +102 -0
- package/screens/components/UserEditPopover/index.module.css +97 -0
- package/screens/components/UserEditPopover/index.stories.jsx +49 -0
- package/scripts/build.mjs +129 -0
- package/scripts/check-case.mjs +127 -0
- package/scripts/verify-dist.mjs +45 -0
- package/vitest.config.js +36 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
.inputGroup {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 0.25rem;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.calendarFrame {
|
|
9
|
+
width: 330px !important;
|
|
10
|
+
padding: 1.25rem !important;
|
|
11
|
+
border-radius: 14px !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.headerTitleContainer {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 0.35rem;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
padding: 4px 8px;
|
|
20
|
+
border-radius: 6px;
|
|
21
|
+
transition: background-color 0.15s ease;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.headerTitleContainer:hover {
|
|
25
|
+
background-color: #f1f5f9;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.monthName {
|
|
29
|
+
font-size: 0.95rem;
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
color: #0f172a;
|
|
32
|
+
text-transform: capitalize;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dropdownChevron {
|
|
36
|
+
color: #64748b;
|
|
37
|
+
transition: transform 0.2s ease;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.chevronChevronOpen {
|
|
41
|
+
transform: rotate(180deg);
|
|
42
|
+
color: var(--cp-accent, #10b981);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.navigation {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: 0.25rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.selectorsPanel {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
gap: 1rem;
|
|
55
|
+
padding: 0.5rem 0;
|
|
56
|
+
animation: fadeIn 0.2s ease;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.selectorGroup {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: 0.35rem;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.weekDaysGrid {
|
|
66
|
+
display: grid;
|
|
67
|
+
grid-template-columns: repeat(7, 1fr);
|
|
68
|
+
gap: 4px;
|
|
69
|
+
margin-bottom: 0.5rem;
|
|
70
|
+
text-align: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.weekDayName {
|
|
74
|
+
font-size: 0.80rem;
|
|
75
|
+
font-weight: 700;
|
|
76
|
+
color: #94a3b8;
|
|
77
|
+
width: 36px;
|
|
78
|
+
height: 36px;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
margin: auto;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.daysGrid {
|
|
86
|
+
display: grid;
|
|
87
|
+
grid-template-columns: repeat(7, 1fr);
|
|
88
|
+
gap: 4px;
|
|
89
|
+
text-align: center;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.dayCell {
|
|
93
|
+
font-size: 0.9rem;
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
color: #334155;
|
|
96
|
+
width: 36px;
|
|
97
|
+
height: 36px;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
margin: auto;
|
|
102
|
+
border-radius: 50%;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
user-select: none;
|
|
105
|
+
transition: all 0.15s ease;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.dayCell:hover:not(.otherMonth) {
|
|
109
|
+
background-color: #f1f5f9;
|
|
110
|
+
color: #0f172a;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.todayDay {
|
|
114
|
+
font-weight: 700;
|
|
115
|
+
color: var(--cp-accent, #10b981);
|
|
116
|
+
background-color: #ecfdf5;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.selectedDay {
|
|
120
|
+
background-color: var(--cp-selected, #0f172a);
|
|
121
|
+
color: #ffffff;
|
|
122
|
+
font-weight: 700;
|
|
123
|
+
box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.selectedDay:hover {
|
|
127
|
+
background-color: #1e293b;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.otherMonth {
|
|
131
|
+
color: #cbd5e1;
|
|
132
|
+
opacity: 0.3;
|
|
133
|
+
cursor: not-allowed;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.footer {
|
|
137
|
+
display: flex;
|
|
138
|
+
justify-content: space-between;
|
|
139
|
+
margin-top: 1.25rem;
|
|
140
|
+
padding-top: 0.75rem;
|
|
141
|
+
border-top: 1px solid #f1f5f9;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@keyframes fadeIn {
|
|
145
|
+
from { opacity: 0; }
|
|
146
|
+
to { opacity: 1; }
|
|
147
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CalendarPicker from './index';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/CalendarPicker',
|
|
6
|
+
component: CalendarPicker,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const Default = {
|
|
10
|
+
args: {
|
|
11
|
+
label: 'Fecha de nacimiento',
|
|
12
|
+
name: 'birthDate',
|
|
13
|
+
value: '',
|
|
14
|
+
onChange: (e) => console.log('changed', e.target.value),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const WithValue = {
|
|
19
|
+
args: {
|
|
20
|
+
label: 'Fecha de la cita',
|
|
21
|
+
name: 'appointmentDate',
|
|
22
|
+
value: '2024-06-15',
|
|
23
|
+
onChange: (e) => console.log('changed', e.target.value),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Required = {
|
|
28
|
+
args: {
|
|
29
|
+
label: 'Fecha requerida',
|
|
30
|
+
name: 'requiredDate',
|
|
31
|
+
value: '',
|
|
32
|
+
required: true,
|
|
33
|
+
onChange: (e) => console.log('changed', e.target.value),
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const Disabled = {
|
|
38
|
+
args: {
|
|
39
|
+
label: 'Fecha bloqueada',
|
|
40
|
+
name: 'disabledDate',
|
|
41
|
+
value: '2024-01-01',
|
|
42
|
+
disabled: true,
|
|
43
|
+
onChange: (e) => console.log('changed', e.target.value),
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { startOfMonth, startOfWeek, addDays } from 'date-fns';
|
|
2
|
+
|
|
3
|
+
export const parseValueToDate = (value) => {
|
|
4
|
+
if (value instanceof Date && !Number.isNaN(value.getTime())) {
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
if (typeof value === 'string' && value.trim() !== '') {
|
|
8
|
+
const match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
9
|
+
if (match) {
|
|
10
|
+
const year = Number(match[1]);
|
|
11
|
+
const month = Number(match[2]);
|
|
12
|
+
const day = Number(match[3]);
|
|
13
|
+
return new Date(year, month - 1, day);
|
|
14
|
+
}
|
|
15
|
+
const fallbackDate = new Date(value);
|
|
16
|
+
if (!Number.isNaN(fallbackDate.getTime())) {
|
|
17
|
+
return new Date(
|
|
18
|
+
fallbackDate.getUTCFullYear(),
|
|
19
|
+
fallbackDate.getUTCMonth(),
|
|
20
|
+
fallbackDate.getUTCDate()
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const getDaysForMonth = (currentDate) => {
|
|
28
|
+
const monthStart = startOfMonth(currentDate);
|
|
29
|
+
const startDate = startOfWeek(monthStart, { weekStartsOn: 1 });
|
|
30
|
+
|
|
31
|
+
const days = [];
|
|
32
|
+
let dayCursor = startDate;
|
|
33
|
+
for (let i = 0; i < 42; i++) {
|
|
34
|
+
days.push(dayCursor);
|
|
35
|
+
dayCursor = addDays(dayCursor, 1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
monthStart,
|
|
40
|
+
days
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styles from './index.module.css';
|
|
3
|
+
import ModalTooltip from '../ModalTooltip/ModalTooltip';
|
|
4
|
+
|
|
5
|
+
import Button from '../Button';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Reusable CardV1 component
|
|
9
|
+
*
|
|
10
|
+
* Props:
|
|
11
|
+
* - badgeIcon: Lucide icon component
|
|
12
|
+
* - badgeText: string
|
|
13
|
+
* - badgeBgColor: string (hex or var)
|
|
14
|
+
* - badgeTextColor: string (hex or var)
|
|
15
|
+
* - extraBadges: Array of { text, bgColor, textColor }
|
|
16
|
+
* - actionIcon: Lucide icon component
|
|
17
|
+
* - onActionClick: function
|
|
18
|
+
* - actionDisabled: boolean
|
|
19
|
+
* - actionTooltip: string
|
|
20
|
+
* - isSpinning: boolean (for refresh icons)
|
|
21
|
+
* - actionCustomClass: custom className for action button
|
|
22
|
+
* - isLoading: boolean
|
|
23
|
+
* - isError: boolean
|
|
24
|
+
* - isEmpty: boolean
|
|
25
|
+
* - errorText: string
|
|
26
|
+
* - emptyText: string
|
|
27
|
+
* - primaryText: React node (subtitle/label)
|
|
28
|
+
* - secondaryText: React node (main large value)
|
|
29
|
+
* - secondaryTextStyle: object (inline styles for main value)
|
|
30
|
+
* - footerIcon: Lucide icon component
|
|
31
|
+
* - footerIconColor: string (hex or var)
|
|
32
|
+
* - footerContent: React node (text or elements)
|
|
33
|
+
* - children: React node (custom inner content inserted after secondaryText)
|
|
34
|
+
*/
|
|
35
|
+
const CardV1 = ({
|
|
36
|
+
badgeIcon: BadgeIcon,
|
|
37
|
+
badgeText,
|
|
38
|
+
badgeBgColor = '#f1f5f9',
|
|
39
|
+
badgeTextColor = '#475569',
|
|
40
|
+
extraBadges = [],
|
|
41
|
+
actionIcon: ActionIcon,
|
|
42
|
+
onActionClick,
|
|
43
|
+
actionDisabled = false,
|
|
44
|
+
actionTooltip,
|
|
45
|
+
isSpinning = false,
|
|
46
|
+
actionCustomClass,
|
|
47
|
+
isLoading = false,
|
|
48
|
+
isError = false,
|
|
49
|
+
isEmpty = false,
|
|
50
|
+
errorText = 'Error',
|
|
51
|
+
emptyText = 'Vacío',
|
|
52
|
+
primaryText,
|
|
53
|
+
secondaryText,
|
|
54
|
+
secondaryTextStyle = {},
|
|
55
|
+
footerIcon: FooterIcon,
|
|
56
|
+
footerIconColor,
|
|
57
|
+
footerContent,
|
|
58
|
+
className = '',
|
|
59
|
+
variant = 'default', // 'default' or 'glass-pink-green'
|
|
60
|
+
children
|
|
61
|
+
}) => {
|
|
62
|
+
const cardClassName = `${styles.card} ${variant === 'glass-pink-green' ? 'glass-pink-green' : ''} ${className}`.trim();
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div className={cardClassName}>
|
|
66
|
+
{/* TOP SECTION */}
|
|
67
|
+
<div className={styles.topSection}>
|
|
68
|
+
<div className={styles.badgeContainer}>
|
|
69
|
+
{badgeText && (
|
|
70
|
+
<div
|
|
71
|
+
className={styles.badge}
|
|
72
|
+
style={{ backgroundColor: badgeBgColor, color: badgeTextColor }}
|
|
73
|
+
>
|
|
74
|
+
{BadgeIcon && <BadgeIcon size={14} />}
|
|
75
|
+
<span>{badgeText}</span>
|
|
76
|
+
</div>
|
|
77
|
+
)}
|
|
78
|
+
|
|
79
|
+
{extraBadges.map((badge, idx) => (
|
|
80
|
+
<div
|
|
81
|
+
key={idx}
|
|
82
|
+
className={styles.badge}
|
|
83
|
+
style={{ backgroundColor: badge.bgColor, color: badge.textColor }}
|
|
84
|
+
>
|
|
85
|
+
<span>{badge.text}</span>
|
|
86
|
+
</div>
|
|
87
|
+
))}
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
{ActionIcon && (
|
|
91
|
+
actionTooltip ? (
|
|
92
|
+
<ModalTooltip text={actionTooltip}>
|
|
93
|
+
<Button
|
|
94
|
+
type="button"
|
|
95
|
+
onClick={onActionClick}
|
|
96
|
+
disabled={actionDisabled}
|
|
97
|
+
color={Button.COLORS.TRANSPARENT}
|
|
98
|
+
icon={ActionIcon}
|
|
99
|
+
loading={isSpinning}
|
|
100
|
+
circle
|
|
101
|
+
/>
|
|
102
|
+
</ModalTooltip>
|
|
103
|
+
) : (
|
|
104
|
+
<Button
|
|
105
|
+
type="button"
|
|
106
|
+
onClick={onActionClick}
|
|
107
|
+
disabled={actionDisabled}
|
|
108
|
+
color={Button.COLORS.TRANSPARENT}
|
|
109
|
+
icon={ActionIcon}
|
|
110
|
+
loading={isSpinning}
|
|
111
|
+
circle
|
|
112
|
+
/>
|
|
113
|
+
)
|
|
114
|
+
)}
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
{/* MAIN CONTENT */}
|
|
118
|
+
<div className={styles.mainContent}>
|
|
119
|
+
{isLoading ? (
|
|
120
|
+
<div className={styles.skeleton} />
|
|
121
|
+
) : isError ? (
|
|
122
|
+
<div className={styles.priceContainer}>
|
|
123
|
+
<span className={`${styles.price} ${styles.errorText}`}>{errorText}</span>
|
|
124
|
+
</div>
|
|
125
|
+
) : isEmpty ? (
|
|
126
|
+
<div className={styles.priceContainer}>
|
|
127
|
+
<span className={`${styles.price} ${styles.emptyText}`}>{emptyText}</span>
|
|
128
|
+
</div>
|
|
129
|
+
) : (
|
|
130
|
+
<div className={styles.priceContainer} style={{ flexDirection: 'column', alignItems: 'flex-start', gap: '4px' }}>
|
|
131
|
+
{primaryText && (
|
|
132
|
+
<span className={styles.currencyLabel}>{primaryText}</span>
|
|
133
|
+
)}
|
|
134
|
+
{secondaryText && (
|
|
135
|
+
<div className={styles.messageWrapper}>
|
|
136
|
+
<span className={styles.price} style={secondaryTextStyle}>
|
|
137
|
+
{secondaryText}
|
|
138
|
+
</span>
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
141
|
+
{children}
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{/* FOOTER */}
|
|
147
|
+
{footerContent && (
|
|
148
|
+
<div className={styles.footer}>
|
|
149
|
+
{FooterIcon && (
|
|
150
|
+
<FooterIcon
|
|
151
|
+
size={12}
|
|
152
|
+
className={styles.trend}
|
|
153
|
+
style={footerIconColor ? { color: footerIconColor } : {}}
|
|
154
|
+
/>
|
|
155
|
+
)}
|
|
156
|
+
{footerContent}
|
|
157
|
+
</div>
|
|
158
|
+
)}
|
|
159
|
+
|
|
160
|
+
<hr style={{ border: '0', borderTop: '1px solid #131414', margin: '1.5rem 0' }} />
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export default CardV1;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
.card {
|
|
2
|
+
background: var(--color-card-bg, #ffffff);
|
|
3
|
+
border: 1px solid var(--color-border, #e2e8f0);
|
|
4
|
+
border-radius: 10px;
|
|
5
|
+
padding: 12px;
|
|
6
|
+
width: 180px;
|
|
7
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
|
|
8
|
+
|
|
9
|
+
transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
|
|
10
|
+
box-shadow 0.3s ease,
|
|
11
|
+
border-color 0.3s ease;
|
|
12
|
+
will-change: transform;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.card:hover {
|
|
16
|
+
transform: translateY(-4px);
|
|
17
|
+
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.04),
|
|
18
|
+
0 2px 6px rgba(0, 0, 0, 0.02);
|
|
19
|
+
border-color: #cbd5e1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.topSection {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
align-items: center;
|
|
26
|
+
margin-bottom: 8px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.badge {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: 4px;
|
|
33
|
+
padding: 2px 8px;
|
|
34
|
+
border-radius: 20px;
|
|
35
|
+
font-size: 0.65rem;
|
|
36
|
+
font-weight: 700;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.badgeContainer {
|
|
40
|
+
display: flex;
|
|
41
|
+
gap: 6px;
|
|
42
|
+
align-items: center;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.mainContent {
|
|
46
|
+
margin-bottom: 8px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.priceContainer {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: baseline;
|
|
52
|
+
gap: 4px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.currencyLabel {
|
|
56
|
+
font-size: 0.8rem;
|
|
57
|
+
color: #64748b;
|
|
58
|
+
font-weight: 600;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.price {
|
|
62
|
+
font-size: 1.4rem;
|
|
63
|
+
font-weight: 800;
|
|
64
|
+
color: #1e293b;
|
|
65
|
+
letter-spacing: -0.5px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.footer {
|
|
69
|
+
margin-top: 8px;
|
|
70
|
+
font-size: 0.6rem;
|
|
71
|
+
color: #94a3b8;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 4px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.trend {
|
|
78
|
+
color: #22c55e;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.refreshBtn {
|
|
82
|
+
background: none;
|
|
83
|
+
border: none;
|
|
84
|
+
color: #cbd5e1;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
padding: 4px;
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
border-radius: 50%;
|
|
91
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.refreshBtn:hover:not(:disabled) {
|
|
95
|
+
color: #0ea5e9;
|
|
96
|
+
background-color: #e0f2fe;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.spin {
|
|
100
|
+
animation: rotate 1s linear infinite;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@keyframes rotate {
|
|
104
|
+
from {
|
|
105
|
+
transform: rotate(0deg);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
to {
|
|
109
|
+
transform: rotate(360deg);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.skeleton {
|
|
114
|
+
height: 24px;
|
|
115
|
+
width: 80%;
|
|
116
|
+
background: #f1f5f9;
|
|
117
|
+
border-radius: 4px;
|
|
118
|
+
animation: pulse 1.5s infinite;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
@keyframes pulse {
|
|
122
|
+
0% {
|
|
123
|
+
opacity: 0.6;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
50% {
|
|
127
|
+
opacity: 1;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
100% {
|
|
131
|
+
opacity: 0.6;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Extras from Notification */
|
|
136
|
+
.messageWrapper {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
gap: 2px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.titleText {
|
|
143
|
+
font-size: 0.9rem;
|
|
144
|
+
font-weight: 700;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.shortMessage {
|
|
148
|
+
font-size: 0.85rem;
|
|
149
|
+
color: #475569;
|
|
150
|
+
font-weight: normal;
|
|
151
|
+
line-height: 1.3;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.errorText {
|
|
155
|
+
color: #ef4444;
|
|
156
|
+
font-size: 1.2rem;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.emptyText {
|
|
160
|
+
color: #94a3b8;
|
|
161
|
+
font-size: 1.6rem;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.viewMoreBtn {
|
|
165
|
+
background: none;
|
|
166
|
+
border: none;
|
|
167
|
+
color: #2563eb;
|
|
168
|
+
font-size: 0.75rem;
|
|
169
|
+
font-weight: 700;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
padding: 0;
|
|
172
|
+
display: inline-flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
gap: 2px;
|
|
175
|
+
margin-top: 2px;
|
|
176
|
+
width: max-content;
|
|
177
|
+
transition: color 0.2s ease;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.viewMoreBtn:hover {
|
|
181
|
+
color: #1d4ed8;
|
|
182
|
+
text-decoration: underline;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.footerContent {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
gap: 4px;
|
|
189
|
+
text-transform: capitalize;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.footerLabel {
|
|
193
|
+
color: #64748b;
|
|
194
|
+
font-weight: 500;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.footerDivider {
|
|
198
|
+
color: #cbd5e1;
|
|
199
|
+
margin: 0 2px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.markAsReadBtn {
|
|
203
|
+
background: none;
|
|
204
|
+
border: none;
|
|
205
|
+
color: #94a3b8;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
padding: 4px;
|
|
208
|
+
display: flex;
|
|
209
|
+
align-items: center;
|
|
210
|
+
justify-content: center;
|
|
211
|
+
border-radius: 50%;
|
|
212
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.markAsReadBtn:hover:not(:disabled) {
|
|
216
|
+
color: #22c55e;
|
|
217
|
+
background-color: #f0fdf4;
|
|
218
|
+
transform: scale(1.1) rotate(8deg);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.markAsReadBtn:disabled {
|
|
222
|
+
cursor: not-allowed;
|
|
223
|
+
opacity: 0.6;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.markAsReadBtn svg {
|
|
227
|
+
transition: transform 0.2s ease;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.markAsReadBtn:active:not(:disabled) svg {
|
|
231
|
+
transform: scale(0.8);
|
|
232
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DollarSign, TrendingUp, TrendingDown, RefreshCw } from 'lucide-react';
|
|
3
|
+
import CardV1 from './index';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/CardV1',
|
|
7
|
+
component: CardV1,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Default = {
|
|
11
|
+
args: {
|
|
12
|
+
badgeIcon: DollarSign,
|
|
13
|
+
badgeText: 'Ingresos',
|
|
14
|
+
badgeBgColor: '#dbeafe',
|
|
15
|
+
badgeTextColor: '#1e40af',
|
|
16
|
+
primaryText: 'Total del mes',
|
|
17
|
+
secondaryText: '$12,450',
|
|
18
|
+
footerIcon: TrendingUp,
|
|
19
|
+
footerIconColor: '#22c55e',
|
|
20
|
+
footerContent: '+12% vs mes anterior',
|
|
21
|
+
actionIcon: RefreshCw,
|
|
22
|
+
onActionClick: () => console.log('refresh clicked'),
|
|
23
|
+
actionTooltip: 'Actualizar',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const WithExtraBadges = {
|
|
28
|
+
args: {
|
|
29
|
+
badgeIcon: DollarSign,
|
|
30
|
+
badgeText: 'Ingresos',
|
|
31
|
+
badgeBgColor: '#dbeafe',
|
|
32
|
+
badgeTextColor: '#1e40af',
|
|
33
|
+
extraBadges: [
|
|
34
|
+
{ text: 'Nuevo', bgColor: '#fef3c7', textColor: '#92400e' },
|
|
35
|
+
{ text: 'VIP', bgColor: '#fce7f3', textColor: '#9d174d' },
|
|
36
|
+
],
|
|
37
|
+
primaryText: 'Total del mes',
|
|
38
|
+
secondaryText: '$8,920',
|
|
39
|
+
footerIcon: TrendingDown,
|
|
40
|
+
footerIconColor: '#ef4444',
|
|
41
|
+
footerContent: '-5% vs mes anterior',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const Loading = {
|
|
46
|
+
args: {
|
|
47
|
+
badgeText: 'Ingresos',
|
|
48
|
+
isLoading: true,
|
|
49
|
+
primaryText: 'Total del mes',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const ErrorState = {
|
|
54
|
+
args: {
|
|
55
|
+
badgeText: 'Ingresos',
|
|
56
|
+
isError: true,
|
|
57
|
+
errorText: 'No se pudo cargar',
|
|
58
|
+
actionIcon: RefreshCw,
|
|
59
|
+
onActionClick: () => console.log('retry clicked'),
|
|
60
|
+
isSpinning: false,
|
|
61
|
+
},
|
|
62
|
+
};
|