next-recomponents 1.6.82 → 1.6.84
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/dist/index.css +132 -0
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +130 -2
- package/dist/index.mjs +129 -2
- package/package.json +2 -1
- package/src/calendar/calendar.icon.tsx +15 -0
- package/src/calendar/index.tsx +91 -0
- package/src/index.tsx +1 -0
- package/src/table/filter.menu.tsx +6 -1
- package/src/table/index.tsx +9 -1
package/dist/index.css
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* ../../node_modules/react-calendar/dist/Calendar.css */
|
|
2
|
+
.react-calendar {
|
|
3
|
+
width: 350px;
|
|
4
|
+
max-width: 100%;
|
|
5
|
+
background: white;
|
|
6
|
+
border: 1px solid #a0a096;
|
|
7
|
+
font-family:
|
|
8
|
+
"Arial",
|
|
9
|
+
"Helvetica",
|
|
10
|
+
sans-serif;
|
|
11
|
+
line-height: 1.125em;
|
|
12
|
+
}
|
|
13
|
+
.react-calendar--doubleView {
|
|
14
|
+
width: 700px;
|
|
15
|
+
}
|
|
16
|
+
.react-calendar--doubleView .react-calendar__viewContainer {
|
|
17
|
+
display: flex;
|
|
18
|
+
margin: -0.5em;
|
|
19
|
+
}
|
|
20
|
+
.react-calendar--doubleView .react-calendar__viewContainer > * {
|
|
21
|
+
width: 50%;
|
|
22
|
+
margin: 0.5em;
|
|
23
|
+
}
|
|
24
|
+
.react-calendar,
|
|
25
|
+
.react-calendar *,
|
|
26
|
+
.react-calendar *:before,
|
|
27
|
+
.react-calendar *:after {
|
|
28
|
+
-moz-box-sizing: border-box;
|
|
29
|
+
-webkit-box-sizing: border-box;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
}
|
|
32
|
+
.react-calendar button {
|
|
33
|
+
margin: 0;
|
|
34
|
+
border: 0;
|
|
35
|
+
outline: none;
|
|
36
|
+
}
|
|
37
|
+
.react-calendar button:enabled:hover {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
.react-calendar__navigation {
|
|
41
|
+
display: flex;
|
|
42
|
+
height: 44px;
|
|
43
|
+
margin-bottom: 1em;
|
|
44
|
+
}
|
|
45
|
+
.react-calendar__navigation button {
|
|
46
|
+
min-width: 44px;
|
|
47
|
+
background: none;
|
|
48
|
+
}
|
|
49
|
+
.react-calendar__navigation button:disabled {
|
|
50
|
+
background-color: #f0f0f0;
|
|
51
|
+
}
|
|
52
|
+
.react-calendar__navigation button:enabled:hover,
|
|
53
|
+
.react-calendar__navigation button:enabled:focus {
|
|
54
|
+
background-color: #e6e6e6;
|
|
55
|
+
}
|
|
56
|
+
.react-calendar__month-view__weekdays {
|
|
57
|
+
text-align: center;
|
|
58
|
+
text-transform: uppercase;
|
|
59
|
+
font: inherit;
|
|
60
|
+
font-size: 0.75em;
|
|
61
|
+
font-weight: bold;
|
|
62
|
+
}
|
|
63
|
+
.react-calendar__month-view__weekdays__weekday {
|
|
64
|
+
padding: 0.5em;
|
|
65
|
+
}
|
|
66
|
+
.react-calendar__month-view__weekNumbers .react-calendar__tile {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
font: inherit;
|
|
71
|
+
font-size: 0.75em;
|
|
72
|
+
font-weight: bold;
|
|
73
|
+
}
|
|
74
|
+
.react-calendar__month-view__days__day--weekend {
|
|
75
|
+
color: #d10000;
|
|
76
|
+
}
|
|
77
|
+
.react-calendar__month-view__days__day--neighboringMonth,
|
|
78
|
+
.react-calendar__decade-view__years__year--neighboringDecade,
|
|
79
|
+
.react-calendar__century-view__decades__decade--neighboringCentury {
|
|
80
|
+
color: #757575;
|
|
81
|
+
}
|
|
82
|
+
.react-calendar__year-view .react-calendar__tile,
|
|
83
|
+
.react-calendar__decade-view .react-calendar__tile,
|
|
84
|
+
.react-calendar__century-view .react-calendar__tile {
|
|
85
|
+
padding: 2em 0.5em;
|
|
86
|
+
}
|
|
87
|
+
.react-calendar__tile {
|
|
88
|
+
max-width: 100%;
|
|
89
|
+
padding: 10px 6.6667px;
|
|
90
|
+
background: none;
|
|
91
|
+
text-align: center;
|
|
92
|
+
font: inherit;
|
|
93
|
+
font-size: 0.833em;
|
|
94
|
+
}
|
|
95
|
+
.react-calendar__tile:disabled {
|
|
96
|
+
background-color: #f0f0f0;
|
|
97
|
+
color: #ababab;
|
|
98
|
+
}
|
|
99
|
+
.react-calendar__month-view__days__day--neighboringMonth:disabled,
|
|
100
|
+
.react-calendar__decade-view__years__year--neighboringDecade:disabled,
|
|
101
|
+
.react-calendar__century-view__decades__decade--neighboringCentury:disabled {
|
|
102
|
+
color: #cdcdcd;
|
|
103
|
+
}
|
|
104
|
+
.react-calendar__tile:enabled:hover,
|
|
105
|
+
.react-calendar__tile:enabled:focus {
|
|
106
|
+
background-color: #e6e6e6;
|
|
107
|
+
}
|
|
108
|
+
.react-calendar__tile--now {
|
|
109
|
+
background: #ffff76;
|
|
110
|
+
}
|
|
111
|
+
.react-calendar__tile--now:enabled:hover,
|
|
112
|
+
.react-calendar__tile--now:enabled:focus {
|
|
113
|
+
background: #ffffa9;
|
|
114
|
+
}
|
|
115
|
+
.react-calendar__tile--hasActive {
|
|
116
|
+
background: #76baff;
|
|
117
|
+
}
|
|
118
|
+
.react-calendar__tile--hasActive:enabled:hover,
|
|
119
|
+
.react-calendar__tile--hasActive:enabled:focus {
|
|
120
|
+
background: #a9d4ff;
|
|
121
|
+
}
|
|
122
|
+
.react-calendar__tile--active {
|
|
123
|
+
background: #006edc;
|
|
124
|
+
color: white;
|
|
125
|
+
}
|
|
126
|
+
.react-calendar__tile--active:enabled:hover,
|
|
127
|
+
.react-calendar__tile--active:enabled:focus {
|
|
128
|
+
background: #1087ff;
|
|
129
|
+
}
|
|
130
|
+
.react-calendar--selectRange .react-calendar__tile--hover {
|
|
131
|
+
background-color: #e6e6e6;
|
|
132
|
+
}
|
package/dist/index.d.mts
CHANGED
|
@@ -163,4 +163,11 @@ declare function useExcel(): {
|
|
|
163
163
|
export: (data: any[][], fileName?: string) => void;
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
declare function MyCalendar({ enabledDates, onChange, defaultValue, className, }: {
|
|
167
|
+
enabledDates: Date[];
|
|
168
|
+
onChange: (e: any) => void;
|
|
169
|
+
defaultValue?: string;
|
|
170
|
+
className?: string;
|
|
171
|
+
}): react_jsx_runtime.JSX.Element;
|
|
172
|
+
|
|
173
|
+
export { Alert, Button, Container, Form, Input, Modal, MyCalendar, Pre, Select, Table, TextArea, regularExpresions, useDates, useExcel, useResources };
|
package/dist/index.d.ts
CHANGED
|
@@ -163,4 +163,11 @@ declare function useExcel(): {
|
|
|
163
163
|
export: (data: any[][], fileName?: string) => void;
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
declare function MyCalendar({ enabledDates, onChange, defaultValue, className, }: {
|
|
167
|
+
enabledDates: Date[];
|
|
168
|
+
onChange: (e: any) => void;
|
|
169
|
+
defaultValue?: string;
|
|
170
|
+
className?: string;
|
|
171
|
+
}): react_jsx_runtime.JSX.Element;
|
|
172
|
+
|
|
173
|
+
export { Alert, Button, Container, Form, Input, Modal, MyCalendar, Pre, Select, Table, TextArea, regularExpresions, useDates, useExcel, useResources };
|
package/dist/index.js
CHANGED
|
@@ -2974,6 +2974,7 @@ __export(index_exports, {
|
|
|
2974
2974
|
Form: () => Form,
|
|
2975
2975
|
Input: () => Input,
|
|
2976
2976
|
Modal: () => Modal,
|
|
2977
|
+
MyCalendar: () => MyCalendar,
|
|
2977
2978
|
Pre: () => pre_default,
|
|
2978
2979
|
Select: () => Select,
|
|
2979
2980
|
Table: () => Table,
|
|
@@ -11352,7 +11353,12 @@ function FilterMenu({
|
|
|
11352
11353
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "px-2 w-full h-[150px]", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
11353
11354
|
"div",
|
|
11354
11355
|
{
|
|
11355
|
-
style: {
|
|
11356
|
+
style: {
|
|
11357
|
+
maxHeight: "100px",
|
|
11358
|
+
overflowY: "auto",
|
|
11359
|
+
contentVisibility: "auto",
|
|
11360
|
+
containIntrinsicSize: "100px"
|
|
11361
|
+
},
|
|
11356
11362
|
className: "border h-full flex gap-2 flex-col p-1",
|
|
11357
11363
|
children: [
|
|
11358
11364
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex gap-2 items-center justify-start ", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { children: [
|
|
@@ -43382,7 +43388,19 @@ function HTable(_a) {
|
|
|
43382
43388
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
43383
43389
|
function Table(_a) {
|
|
43384
43390
|
var props = __objRest(_a, []);
|
|
43385
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
43391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
43392
|
+
"div",
|
|
43393
|
+
{
|
|
43394
|
+
className: "bg-gray-200 border rounded shadow p-1",
|
|
43395
|
+
style: {
|
|
43396
|
+
maxHeight: "500px",
|
|
43397
|
+
overflowY: "auto",
|
|
43398
|
+
contentVisibility: "auto",
|
|
43399
|
+
containIntrinsicSize: "500px"
|
|
43400
|
+
},
|
|
43401
|
+
children: Array.isArray(props.data) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(HTable, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: " p-5 border rounded shadow bg-yellw-500", children: "No es un array" })
|
|
43402
|
+
}
|
|
43403
|
+
);
|
|
43386
43404
|
}
|
|
43387
43405
|
|
|
43388
43406
|
// src/text-area/index.tsx
|
|
@@ -44197,6 +44215,115 @@ function useExcel() {
|
|
|
44197
44215
|
}
|
|
44198
44216
|
return { import: importFile, export: exportFile };
|
|
44199
44217
|
}
|
|
44218
|
+
|
|
44219
|
+
// src/calendar/index.tsx
|
|
44220
|
+
var import_react31 = require("react");
|
|
44221
|
+
var import_Calendar = require("react-calendar/dist/Calendar.css");
|
|
44222
|
+
var import_react_calendar = __toESM(require("react-calendar"));
|
|
44223
|
+
|
|
44224
|
+
// src/calendar/calendar.icon.tsx
|
|
44225
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
44226
|
+
function CalendarIcon() {
|
|
44227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
44228
|
+
"svg",
|
|
44229
|
+
{
|
|
44230
|
+
stroke: "currentColor",
|
|
44231
|
+
fill: "currentColor",
|
|
44232
|
+
strokeWidth: "0",
|
|
44233
|
+
viewBox: "0 0 448 512",
|
|
44234
|
+
height: "20px",
|
|
44235
|
+
width: "20px",
|
|
44236
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44237
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" })
|
|
44238
|
+
}
|
|
44239
|
+
);
|
|
44240
|
+
}
|
|
44241
|
+
|
|
44242
|
+
// src/calendar/index.tsx
|
|
44243
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
44244
|
+
function MyCalendar({
|
|
44245
|
+
enabledDates,
|
|
44246
|
+
onChange,
|
|
44247
|
+
defaultValue = "",
|
|
44248
|
+
className = ""
|
|
44249
|
+
}) {
|
|
44250
|
+
const modalRef = (0, import_react31.useRef)(null);
|
|
44251
|
+
const [date, setDate] = (0, import_react31.useState)(defaultValue);
|
|
44252
|
+
const [selectedDate, setSelectedDate] = (0, import_react31.useState)(/* @__PURE__ */ new Date());
|
|
44253
|
+
const [visible, setVisible] = (0, import_react31.useState)(false);
|
|
44254
|
+
const isDateDisabled = ({ date: date2, view }) => {
|
|
44255
|
+
if (view === "month") {
|
|
44256
|
+
return !enabledDates.some(
|
|
44257
|
+
(enabledDate) => date2.getFullYear() === enabledDate.getFullYear() && date2.getMonth() === enabledDate.getMonth() && date2.getDate() === enabledDate.getDate()
|
|
44258
|
+
);
|
|
44259
|
+
}
|
|
44260
|
+
return false;
|
|
44261
|
+
};
|
|
44262
|
+
function handleChange(e) {
|
|
44263
|
+
var _a, _b;
|
|
44264
|
+
setSelectedDate(e);
|
|
44265
|
+
const date2 = new Date(e);
|
|
44266
|
+
const formattedDate = date2.toISOString().split("T")[0];
|
|
44267
|
+
setDate(formattedDate);
|
|
44268
|
+
onChange(e);
|
|
44269
|
+
(_b = (_a = modalRef == null ? void 0 : modalRef.current) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a);
|
|
44270
|
+
}
|
|
44271
|
+
(0, import_react31.useEffect)(() => {
|
|
44272
|
+
setVisible(typeof window != "undefined");
|
|
44273
|
+
}, [typeof window]);
|
|
44274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
|
|
44275
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
44276
|
+
"div",
|
|
44277
|
+
{
|
|
44278
|
+
onClick: (e) => {
|
|
44279
|
+
var _a, _b;
|
|
44280
|
+
return (_b = (_a = modalRef == null ? void 0 : modalRef.current) == null ? void 0 : _a.showModal) == null ? void 0 : _b.call(_a);
|
|
44281
|
+
},
|
|
44282
|
+
className: "cursor-pointer flex items-center justify-center",
|
|
44283
|
+
children: [
|
|
44284
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
44285
|
+
"input",
|
|
44286
|
+
{
|
|
44287
|
+
className: [
|
|
44288
|
+
"p-2 w-full rounded border shadow cursor-pointer",
|
|
44289
|
+
className
|
|
44290
|
+
].join(" "),
|
|
44291
|
+
value: date,
|
|
44292
|
+
onChange: (e) => {
|
|
44293
|
+
},
|
|
44294
|
+
readOnly: true
|
|
44295
|
+
}
|
|
44296
|
+
),
|
|
44297
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute", style: { right: "10px" }, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CalendarIcon, {}) })
|
|
44298
|
+
]
|
|
44299
|
+
}
|
|
44300
|
+
),
|
|
44301
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
44302
|
+
"dialog",
|
|
44303
|
+
{
|
|
44304
|
+
ref: modalRef,
|
|
44305
|
+
onClick: (e) => {
|
|
44306
|
+
var _a;
|
|
44307
|
+
const element = e.target;
|
|
44308
|
+
if ((element == null ? void 0 : element.id) == "my-calendar-modal-item") {
|
|
44309
|
+
(_a = modalRef.current) == null ? void 0 : _a.close();
|
|
44310
|
+
}
|
|
44311
|
+
},
|
|
44312
|
+
id: "my-calendar-modal-item",
|
|
44313
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
44314
|
+
import_react_calendar.default,
|
|
44315
|
+
{
|
|
44316
|
+
onChange: (e) => {
|
|
44317
|
+
handleChange(e);
|
|
44318
|
+
},
|
|
44319
|
+
value: selectedDate,
|
|
44320
|
+
tileDisabled: isDateDisabled
|
|
44321
|
+
}
|
|
44322
|
+
)
|
|
44323
|
+
}
|
|
44324
|
+
)
|
|
44325
|
+
] });
|
|
44326
|
+
}
|
|
44200
44327
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44201
44328
|
0 && (module.exports = {
|
|
44202
44329
|
Alert,
|
|
@@ -44205,6 +44332,7 @@ function useExcel() {
|
|
|
44205
44332
|
Form,
|
|
44206
44333
|
Input,
|
|
44207
44334
|
Modal,
|
|
44335
|
+
MyCalendar,
|
|
44208
44336
|
Pre,
|
|
44209
44337
|
Select,
|
|
44210
44338
|
Table,
|
package/dist/index.mjs
CHANGED
|
@@ -11337,7 +11337,12 @@ function FilterMenu({
|
|
|
11337
11337
|
/* @__PURE__ */ jsx10("div", { className: "px-2 w-full h-[150px]", children: /* @__PURE__ */ jsxs8(
|
|
11338
11338
|
"div",
|
|
11339
11339
|
{
|
|
11340
|
-
style: {
|
|
11340
|
+
style: {
|
|
11341
|
+
maxHeight: "100px",
|
|
11342
|
+
overflowY: "auto",
|
|
11343
|
+
contentVisibility: "auto",
|
|
11344
|
+
containIntrinsicSize: "100px"
|
|
11345
|
+
},
|
|
11341
11346
|
className: "border h-full flex gap-2 flex-col p-1",
|
|
11342
11347
|
children: [
|
|
11343
11348
|
/* @__PURE__ */ jsx10("div", { className: "flex gap-2 items-center justify-start ", children: /* @__PURE__ */ jsxs8("label", { children: [
|
|
@@ -43367,7 +43372,19 @@ function HTable(_a) {
|
|
|
43367
43372
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
43368
43373
|
function Table(_a) {
|
|
43369
43374
|
var props = __objRest(_a, []);
|
|
43370
|
-
return /* @__PURE__ */ jsx12(
|
|
43375
|
+
return /* @__PURE__ */ jsx12(
|
|
43376
|
+
"div",
|
|
43377
|
+
{
|
|
43378
|
+
className: "bg-gray-200 border rounded shadow p-1",
|
|
43379
|
+
style: {
|
|
43380
|
+
maxHeight: "500px",
|
|
43381
|
+
overflowY: "auto",
|
|
43382
|
+
contentVisibility: "auto",
|
|
43383
|
+
containIntrinsicSize: "500px"
|
|
43384
|
+
},
|
|
43385
|
+
children: Array.isArray(props.data) ? /* @__PURE__ */ jsx12(HTable, __spreadValues({}, props)) : /* @__PURE__ */ jsx12("div", { className: " p-5 border rounded shadow bg-yellw-500", children: "No es un array" })
|
|
43386
|
+
}
|
|
43387
|
+
);
|
|
43371
43388
|
}
|
|
43372
43389
|
|
|
43373
43390
|
// src/text-area/index.tsx
|
|
@@ -44188,6 +44205,115 @@ function useExcel() {
|
|
|
44188
44205
|
}
|
|
44189
44206
|
return { import: importFile, export: exportFile };
|
|
44190
44207
|
}
|
|
44208
|
+
|
|
44209
|
+
// src/calendar/index.tsx
|
|
44210
|
+
import { useEffect as useEffect9, useRef as useRef7, useState as useState10 } from "react";
|
|
44211
|
+
import "react-calendar/dist/Calendar.css";
|
|
44212
|
+
import Calendar from "react-calendar";
|
|
44213
|
+
|
|
44214
|
+
// src/calendar/calendar.icon.tsx
|
|
44215
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
44216
|
+
function CalendarIcon() {
|
|
44217
|
+
return /* @__PURE__ */ jsx20(
|
|
44218
|
+
"svg",
|
|
44219
|
+
{
|
|
44220
|
+
stroke: "currentColor",
|
|
44221
|
+
fill: "currentColor",
|
|
44222
|
+
strokeWidth: "0",
|
|
44223
|
+
viewBox: "0 0 448 512",
|
|
44224
|
+
height: "20px",
|
|
44225
|
+
width: "20px",
|
|
44226
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44227
|
+
children: /* @__PURE__ */ jsx20("path", { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" })
|
|
44228
|
+
}
|
|
44229
|
+
);
|
|
44230
|
+
}
|
|
44231
|
+
|
|
44232
|
+
// src/calendar/index.tsx
|
|
44233
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
44234
|
+
function MyCalendar({
|
|
44235
|
+
enabledDates,
|
|
44236
|
+
onChange,
|
|
44237
|
+
defaultValue = "",
|
|
44238
|
+
className = ""
|
|
44239
|
+
}) {
|
|
44240
|
+
const modalRef = useRef7(null);
|
|
44241
|
+
const [date, setDate] = useState10(defaultValue);
|
|
44242
|
+
const [selectedDate, setSelectedDate] = useState10(/* @__PURE__ */ new Date());
|
|
44243
|
+
const [visible, setVisible] = useState10(false);
|
|
44244
|
+
const isDateDisabled = ({ date: date2, view }) => {
|
|
44245
|
+
if (view === "month") {
|
|
44246
|
+
return !enabledDates.some(
|
|
44247
|
+
(enabledDate) => date2.getFullYear() === enabledDate.getFullYear() && date2.getMonth() === enabledDate.getMonth() && date2.getDate() === enabledDate.getDate()
|
|
44248
|
+
);
|
|
44249
|
+
}
|
|
44250
|
+
return false;
|
|
44251
|
+
};
|
|
44252
|
+
function handleChange(e) {
|
|
44253
|
+
var _a, _b;
|
|
44254
|
+
setSelectedDate(e);
|
|
44255
|
+
const date2 = new Date(e);
|
|
44256
|
+
const formattedDate = date2.toISOString().split("T")[0];
|
|
44257
|
+
setDate(formattedDate);
|
|
44258
|
+
onChange(e);
|
|
44259
|
+
(_b = (_a = modalRef == null ? void 0 : modalRef.current) == null ? void 0 : _a.close) == null ? void 0 : _b.call(_a);
|
|
44260
|
+
}
|
|
44261
|
+
useEffect9(() => {
|
|
44262
|
+
setVisible(typeof window != "undefined");
|
|
44263
|
+
}, [typeof window]);
|
|
44264
|
+
return /* @__PURE__ */ jsxs13("div", { className: "relative", children: [
|
|
44265
|
+
/* @__PURE__ */ jsxs13(
|
|
44266
|
+
"div",
|
|
44267
|
+
{
|
|
44268
|
+
onClick: (e) => {
|
|
44269
|
+
var _a, _b;
|
|
44270
|
+
return (_b = (_a = modalRef == null ? void 0 : modalRef.current) == null ? void 0 : _a.showModal) == null ? void 0 : _b.call(_a);
|
|
44271
|
+
},
|
|
44272
|
+
className: "cursor-pointer flex items-center justify-center",
|
|
44273
|
+
children: [
|
|
44274
|
+
/* @__PURE__ */ jsx21(
|
|
44275
|
+
"input",
|
|
44276
|
+
{
|
|
44277
|
+
className: [
|
|
44278
|
+
"p-2 w-full rounded border shadow cursor-pointer",
|
|
44279
|
+
className
|
|
44280
|
+
].join(" "),
|
|
44281
|
+
value: date,
|
|
44282
|
+
onChange: (e) => {
|
|
44283
|
+
},
|
|
44284
|
+
readOnly: true
|
|
44285
|
+
}
|
|
44286
|
+
),
|
|
44287
|
+
/* @__PURE__ */ jsx21("div", { className: "absolute", style: { right: "10px" }, children: /* @__PURE__ */ jsx21(CalendarIcon, {}) })
|
|
44288
|
+
]
|
|
44289
|
+
}
|
|
44290
|
+
),
|
|
44291
|
+
visible && /* @__PURE__ */ jsx21(
|
|
44292
|
+
"dialog",
|
|
44293
|
+
{
|
|
44294
|
+
ref: modalRef,
|
|
44295
|
+
onClick: (e) => {
|
|
44296
|
+
var _a;
|
|
44297
|
+
const element = e.target;
|
|
44298
|
+
if ((element == null ? void 0 : element.id) == "my-calendar-modal-item") {
|
|
44299
|
+
(_a = modalRef.current) == null ? void 0 : _a.close();
|
|
44300
|
+
}
|
|
44301
|
+
},
|
|
44302
|
+
id: "my-calendar-modal-item",
|
|
44303
|
+
children: /* @__PURE__ */ jsx21(
|
|
44304
|
+
Calendar,
|
|
44305
|
+
{
|
|
44306
|
+
onChange: (e) => {
|
|
44307
|
+
handleChange(e);
|
|
44308
|
+
},
|
|
44309
|
+
value: selectedDate,
|
|
44310
|
+
tileDisabled: isDateDisabled
|
|
44311
|
+
}
|
|
44312
|
+
)
|
|
44313
|
+
}
|
|
44314
|
+
)
|
|
44315
|
+
] });
|
|
44316
|
+
}
|
|
44191
44317
|
export {
|
|
44192
44318
|
Alert,
|
|
44193
44319
|
Button,
|
|
@@ -44195,6 +44321,7 @@ export {
|
|
|
44195
44321
|
Form,
|
|
44196
44322
|
Input,
|
|
44197
44323
|
Modal,
|
|
44324
|
+
MyCalendar,
|
|
44198
44325
|
pre_default as Pre,
|
|
44199
44326
|
Select,
|
|
44200
44327
|
Table,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-recomponents",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.84",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"axios": "^1.9.0",
|
|
22
22
|
"moment": "^2.30.1",
|
|
23
23
|
"react": "^19.1.0",
|
|
24
|
+
"react-calendar": "^6.0.0",
|
|
24
25
|
"react-dom": "^19.1.0"
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default function CalendarIcon() {
|
|
2
|
+
return (
|
|
3
|
+
<svg
|
|
4
|
+
stroke="currentColor"
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
strokeWidth="0"
|
|
7
|
+
viewBox="0 0 448 512"
|
|
8
|
+
height="20px"
|
|
9
|
+
width="20px"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
>
|
|
12
|
+
<path d="M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z"></path>
|
|
13
|
+
</svg>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
import "react-calendar/dist/Calendar.css";
|
|
4
|
+
import Calendar from "react-calendar";
|
|
5
|
+
import CalendarIcon from "./calendar.icon";
|
|
6
|
+
|
|
7
|
+
export default function MyCalendar({
|
|
8
|
+
enabledDates,
|
|
9
|
+
onChange,
|
|
10
|
+
defaultValue = "",
|
|
11
|
+
className = "",
|
|
12
|
+
}: {
|
|
13
|
+
enabledDates: Date[];
|
|
14
|
+
onChange: (e: any) => void;
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
}) {
|
|
18
|
+
const modalRef = useRef<HTMLDialogElement>(null);
|
|
19
|
+
const [date, setDate] = useState<any>(defaultValue);
|
|
20
|
+
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
|
|
21
|
+
const [visible, setVisible] = useState(false);
|
|
22
|
+
const isDateDisabled = ({ date, view }: { date: Date; view: any }) => {
|
|
23
|
+
if (view === "month") {
|
|
24
|
+
// Solo aplica en la vista mensual
|
|
25
|
+
return !enabledDates.some(
|
|
26
|
+
(enabledDate) =>
|
|
27
|
+
date.getFullYear() === enabledDate.getFullYear() &&
|
|
28
|
+
date.getMonth() === enabledDate.getMonth() &&
|
|
29
|
+
date.getDate() === enabledDate.getDate()
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
function handleChange(e: any) {
|
|
36
|
+
setSelectedDate(e);
|
|
37
|
+
const date = new Date(e);
|
|
38
|
+
const formattedDate = date.toISOString().split("T")[0];
|
|
39
|
+
setDate(formattedDate);
|
|
40
|
+
onChange(e);
|
|
41
|
+
modalRef?.current?.close?.();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
setVisible(typeof window != "undefined");
|
|
46
|
+
}, [typeof window]);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div className="relative">
|
|
50
|
+
<div
|
|
51
|
+
onClick={(e) => modalRef?.current?.showModal?.()}
|
|
52
|
+
className="cursor-pointer flex items-center justify-center"
|
|
53
|
+
>
|
|
54
|
+
<input
|
|
55
|
+
className={[
|
|
56
|
+
"p-2 w-full rounded border shadow cursor-pointer",
|
|
57
|
+
className,
|
|
58
|
+
].join(" ")}
|
|
59
|
+
value={date}
|
|
60
|
+
onChange={(e) => {}}
|
|
61
|
+
readOnly
|
|
62
|
+
/>
|
|
63
|
+
<div className="absolute" style={{ right: "10px" }}>
|
|
64
|
+
<CalendarIcon />
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{visible && (
|
|
69
|
+
<dialog
|
|
70
|
+
ref={modalRef}
|
|
71
|
+
onClick={(e) => {
|
|
72
|
+
const element = e.target as HTMLElement;
|
|
73
|
+
|
|
74
|
+
if (element?.id == "my-calendar-modal-item") {
|
|
75
|
+
modalRef.current?.close();
|
|
76
|
+
}
|
|
77
|
+
}}
|
|
78
|
+
id="my-calendar-modal-item"
|
|
79
|
+
>
|
|
80
|
+
<Calendar
|
|
81
|
+
onChange={(e) => {
|
|
82
|
+
handleChange(e);
|
|
83
|
+
}}
|
|
84
|
+
value={selectedDate}
|
|
85
|
+
tileDisabled={isDateDisabled} // Aplica restricciones
|
|
86
|
+
/>
|
|
87
|
+
</dialog>
|
|
88
|
+
)}
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
91
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -72,7 +72,12 @@ export default function FilterMenu({
|
|
|
72
72
|
</div>
|
|
73
73
|
<div className="px-2 w-full h-[150px]">
|
|
74
74
|
<div
|
|
75
|
-
style={{
|
|
75
|
+
style={{
|
|
76
|
+
maxHeight: "100px",
|
|
77
|
+
overflowY: "auto",
|
|
78
|
+
contentVisibility: "auto",
|
|
79
|
+
containIntrinsicSize: "100px",
|
|
80
|
+
}}
|
|
76
81
|
className="border h-full flex gap-2 flex-col p-1"
|
|
77
82
|
>
|
|
78
83
|
<div className="flex gap-2 items-center justify-start ">
|
package/src/table/index.tsx
CHANGED
|
@@ -20,7 +20,15 @@ export interface TableProps
|
|
|
20
20
|
|
|
21
21
|
export default function Table({ ...props }: TableProps) {
|
|
22
22
|
return (
|
|
23
|
-
<div
|
|
23
|
+
<div
|
|
24
|
+
className="bg-gray-200 border rounded shadow p-1"
|
|
25
|
+
style={{
|
|
26
|
+
maxHeight: "500px",
|
|
27
|
+
overflowY: "auto",
|
|
28
|
+
contentVisibility: "auto",
|
|
29
|
+
containIntrinsicSize: "500px",
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
24
32
|
{Array.isArray(props.data) ? (
|
|
25
33
|
<HTable {...props} />
|
|
26
34
|
) : (
|