@loykin/cron-input 0.0.1-dev.4 → 0.0.1
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 +34 -0
- package/dist/UIAdapterContext-DMhPKNaZ.d.cts +57 -0
- package/dist/UIAdapterContext-DMhPKNaZ.d.ts +57 -0
- package/dist/adapters/shadcn.cjs +66 -0
- package/dist/adapters/shadcn.cjs.map +1 -0
- package/dist/adapters/shadcn.d.cts +24 -0
- package/dist/adapters/shadcn.d.ts +24 -0
- package/dist/adapters/shadcn.js +64 -0
- package/dist/adapters/shadcn.js.map +1 -0
- package/dist/index.cjs +122 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +123 -67
- package/dist/index.js.map +1 -1
- package/dist/styles.css +109 -83
- package/package.json +6 -1
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ function Button({
|
|
|
23
23
|
{
|
|
24
24
|
"data-variant": variant,
|
|
25
25
|
"data-size": size,
|
|
26
|
-
className: cn("
|
|
26
|
+
className: cn("cron-input-btn", className),
|
|
27
27
|
...props
|
|
28
28
|
}
|
|
29
29
|
);
|
|
@@ -48,8 +48,8 @@ function PopoverContent({
|
|
|
48
48
|
align,
|
|
49
49
|
side,
|
|
50
50
|
sideOffset,
|
|
51
|
-
className: "
|
|
52
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Popup, { className: cn("
|
|
51
|
+
className: "cron-input-positioner",
|
|
52
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(popover.Popover.Popup, { className: cn("cron-input-popover-content", className), ...props })
|
|
53
53
|
}
|
|
54
54
|
) });
|
|
55
55
|
}
|
|
@@ -58,19 +58,73 @@ function Tabs({ className, ...props }) {
|
|
|
58
58
|
tabs.Tabs.Root,
|
|
59
59
|
{
|
|
60
60
|
"data-orientation": "horizontal",
|
|
61
|
-
className: cn("
|
|
61
|
+
className: cn("cron-input-tabs", className),
|
|
62
62
|
...props
|
|
63
63
|
}
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
function TabsList({ className, ...props }) {
|
|
67
|
-
return /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.List, { className: cn("
|
|
67
|
+
return /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.List, { className: cn("cron-input-tabs-list", className), ...props });
|
|
68
68
|
}
|
|
69
69
|
function TabsTrigger({ className, ...props }) {
|
|
70
|
-
return /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.Tab, { className: cn("
|
|
70
|
+
return /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.Tab, { className: cn("cron-input-tabs-trigger", className), ...props });
|
|
71
71
|
}
|
|
72
72
|
function TabsContent({ className, ...props }) {
|
|
73
|
-
return /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.Panel, { className: cn("
|
|
73
|
+
return /* @__PURE__ */ jsxRuntime.jsx(tabs.Tabs.Panel, { className: cn("cron-input-tabs-content", className), ...props });
|
|
74
|
+
}
|
|
75
|
+
var defaultUIAdapter = {
|
|
76
|
+
Button,
|
|
77
|
+
Popover,
|
|
78
|
+
PopoverTrigger,
|
|
79
|
+
PopoverContent,
|
|
80
|
+
Tabs,
|
|
81
|
+
TabsList,
|
|
82
|
+
TabsTrigger,
|
|
83
|
+
TabsContent
|
|
84
|
+
};
|
|
85
|
+
var CronInputUIContext = react.createContext(defaultUIAdapter);
|
|
86
|
+
function useResolvedCronInputUI(adapter) {
|
|
87
|
+
const parent = react.useContext(CronInputUIContext);
|
|
88
|
+
return react.useMemo(() => adapter ? { ...parent, ...adapter } : parent, [parent, adapter]);
|
|
89
|
+
}
|
|
90
|
+
function CronInputProvider({ adapter, children }) {
|
|
91
|
+
const value = useResolvedCronInputUI(adapter);
|
|
92
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CronInputUIContext.Provider, { value, children });
|
|
93
|
+
}
|
|
94
|
+
function useCronInputUI() {
|
|
95
|
+
return react.useContext(CronInputUIContext);
|
|
96
|
+
}
|
|
97
|
+
function Button2(props) {
|
|
98
|
+
const { Button: Component } = useCronInputUI();
|
|
99
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
100
|
+
}
|
|
101
|
+
function Popover2(props) {
|
|
102
|
+
const { Popover: Component } = useCronInputUI();
|
|
103
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
104
|
+
}
|
|
105
|
+
function PopoverTrigger2(props) {
|
|
106
|
+
const { PopoverTrigger: Component } = useCronInputUI();
|
|
107
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
108
|
+
}
|
|
109
|
+
function PopoverContent2(props) {
|
|
110
|
+
const { PopoverContent: Component } = useCronInputUI();
|
|
111
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
112
|
+
}
|
|
113
|
+
function Tabs2(props) {
|
|
114
|
+
const { Tabs: Component } = useCronInputUI();
|
|
115
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
116
|
+
}
|
|
117
|
+
function TabsList2(props) {
|
|
118
|
+
const { TabsList: Component } = useCronInputUI();
|
|
119
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
120
|
+
}
|
|
121
|
+
function TabsTrigger2(props) {
|
|
122
|
+
const { TabsTrigger: Component } = useCronInputUI();
|
|
123
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
124
|
+
}
|
|
125
|
+
function TabsContent2(props) {
|
|
126
|
+
const { TabsContent: Component } = useCronInputUI();
|
|
127
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
74
128
|
}
|
|
75
129
|
function useCronInput({ value, onChange }) {
|
|
76
130
|
const [isOpen, setIsOpen] = react.useState(false);
|
|
@@ -236,12 +290,12 @@ var DEFAULT_VALUE = { type: "daily", hour: 9, minute: 0 };
|
|
|
236
290
|
function NumberStepper({ value, min, max, padded = true, onChange }) {
|
|
237
291
|
const clamp = (n) => Math.min(max, Math.max(min, n));
|
|
238
292
|
const display = padded ? String(value).padStart(2, "0") : String(value);
|
|
239
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
293
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-stepper", children: [
|
|
240
294
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
241
295
|
"button",
|
|
242
296
|
{
|
|
243
297
|
type: "button",
|
|
244
|
-
className: "
|
|
298
|
+
className: "cron-input-stepper-btn",
|
|
245
299
|
onClick: () => onChange(clamp(value - 1)),
|
|
246
300
|
tabIndex: -1,
|
|
247
301
|
"aria-label": "Decrease",
|
|
@@ -253,7 +307,7 @@ function NumberStepper({ value, min, max, padded = true, onChange }) {
|
|
|
253
307
|
{
|
|
254
308
|
type: "text",
|
|
255
309
|
inputMode: "numeric",
|
|
256
|
-
className: "
|
|
310
|
+
className: "cron-input-stepper-input",
|
|
257
311
|
value: display,
|
|
258
312
|
onChange: (e) => {
|
|
259
313
|
const raw = e.target.value.replace(/\D/g, "");
|
|
@@ -278,7 +332,7 @@ function NumberStepper({ value, min, max, padded = true, onChange }) {
|
|
|
278
332
|
"button",
|
|
279
333
|
{
|
|
280
334
|
type: "button",
|
|
281
|
-
className: "
|
|
335
|
+
className: "cron-input-stepper-btn",
|
|
282
336
|
onClick: () => onChange(clamp(value + 1)),
|
|
283
337
|
tabIndex: -1,
|
|
284
338
|
"aria-label": "Increase",
|
|
@@ -288,9 +342,9 @@ function NumberStepper({ value, min, max, padded = true, onChange }) {
|
|
|
288
342
|
] });
|
|
289
343
|
}
|
|
290
344
|
function TimePicker({ hour, minute, onChange }) {
|
|
291
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
345
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-time", children: [
|
|
292
346
|
/* @__PURE__ */ jsxRuntime.jsx(NumberStepper, { value: hour, min: 0, max: 23, onChange: (h) => onChange(h, minute) }),
|
|
293
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
347
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-time-sep", children: ":" }),
|
|
294
348
|
/* @__PURE__ */ jsxRuntime.jsx(NumberStepper, { value: minute, min: 0, max: 59, onChange: (m) => onChange(hour, m) })
|
|
295
349
|
] });
|
|
296
350
|
}
|
|
@@ -308,11 +362,11 @@ function DayChips({ days, onChange }) {
|
|
|
308
362
|
const next = days.includes(day) ? days.filter((d) => d !== day) : [...days, day].sort((a, b) => a - b);
|
|
309
363
|
onChange(next);
|
|
310
364
|
};
|
|
311
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
365
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cron-input-day-chips", children: DAYS.map((d) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
312
366
|
"button",
|
|
313
367
|
{
|
|
314
368
|
type: "button",
|
|
315
|
-
className: cn("
|
|
369
|
+
className: cn("cron-input-day-chip", days.includes(d.index) && "cron-input-day-chip--active"),
|
|
316
370
|
onClick: () => toggle(d.index),
|
|
317
371
|
children: d.label
|
|
318
372
|
},
|
|
@@ -321,8 +375,8 @@ function DayChips({ days, onChange }) {
|
|
|
321
375
|
}
|
|
322
376
|
function IntervalTab({ every, unit, onChange }) {
|
|
323
377
|
const maxMap = { minute: 59, hour: 23, day: 30 };
|
|
324
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
325
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
378
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cron-input-tab-body", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-interval-row", children: [
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-label", children: "Every" }),
|
|
326
380
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
327
381
|
NumberStepper,
|
|
328
382
|
{
|
|
@@ -333,11 +387,11 @@ function IntervalTab({ every, unit, onChange }) {
|
|
|
333
387
|
onChange: (n) => onChange(n, unit)
|
|
334
388
|
}
|
|
335
389
|
),
|
|
336
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
390
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "cron-input-unit-seg", children: ["minute", "hour", "day"].map((u) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
337
391
|
"button",
|
|
338
392
|
{
|
|
339
393
|
type: "button",
|
|
340
|
-
className: cn("
|
|
394
|
+
className: cn("cron-input-unit-btn", unit === u && "cron-input-unit-btn--active"),
|
|
341
395
|
onClick: () => onChange(Math.min(every, maxMap[u]), u),
|
|
342
396
|
children: u === "minute" ? "min" : u === "hour" ? "hr" : "day"
|
|
343
397
|
},
|
|
@@ -346,27 +400,27 @@ function IntervalTab({ every, unit, onChange }) {
|
|
|
346
400
|
] }) });
|
|
347
401
|
}
|
|
348
402
|
function DailyTab({ hour, minute, onChange }) {
|
|
349
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
350
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
403
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cron-input-tab-body", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-field-row", children: [
|
|
404
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-label", children: "Every day at" }),
|
|
351
405
|
/* @__PURE__ */ jsxRuntime.jsx(TimePicker, { hour, minute, onChange })
|
|
352
406
|
] }) });
|
|
353
407
|
}
|
|
354
408
|
function WeeklyTab({ days, hour, minute, onChange }) {
|
|
355
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
356
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
357
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
409
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-tab-body", children: [
|
|
410
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-field-row cron-input-field-row--col", children: [
|
|
411
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-label", children: "Repeat on" }),
|
|
358
412
|
/* @__PURE__ */ jsxRuntime.jsx(DayChips, { days, onChange: (d) => onChange(d, hour, minute) })
|
|
359
413
|
] }),
|
|
360
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
361
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
414
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-field-row cron-input-field-row--mt", children: [
|
|
415
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-label", children: "At" }),
|
|
362
416
|
/* @__PURE__ */ jsxRuntime.jsx(TimePicker, { hour, minute, onChange: (h, m) => onChange(days, h, m) })
|
|
363
417
|
] })
|
|
364
418
|
] });
|
|
365
419
|
}
|
|
366
420
|
function MonthlyTab({ day, hour, minute, onChange }) {
|
|
367
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
368
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
369
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
421
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-tab-body", children: [
|
|
422
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-field-row", children: [
|
|
423
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-label", children: "On day" }),
|
|
370
424
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
371
425
|
NumberStepper,
|
|
372
426
|
{
|
|
@@ -377,10 +431,10 @@ function MonthlyTab({ day, hour, minute, onChange }) {
|
|
|
377
431
|
onChange: (d) => onChange(d, hour, minute)
|
|
378
432
|
}
|
|
379
433
|
),
|
|
380
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
434
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-label", children: "of every month" })
|
|
381
435
|
] }),
|
|
382
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
383
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
436
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-field-row cron-input-field-row--mt", children: [
|
|
437
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-label", children: "At" }),
|
|
384
438
|
/* @__PURE__ */ jsxRuntime.jsx(TimePicker, { hour, minute, onChange: (h, m) => onChange(day, h, m) })
|
|
385
439
|
] })
|
|
386
440
|
] });
|
|
@@ -394,13 +448,13 @@ function CustomTab({ expression, onChange }) {
|
|
|
394
448
|
const isValid = validateCronExpression(input);
|
|
395
449
|
const parsed = isValid && parts.length === 5 ? fromCronExpression(input) : null;
|
|
396
450
|
const FIELD_LABELS = ["min", "hour", "dom", "mon", "dow"];
|
|
397
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
398
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("
|
|
451
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-tab-body cron-input-custom", children: [
|
|
452
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("cron-input-custom-wrap", input && !isValid && "cron-input-custom-wrap--error"), children: [
|
|
399
453
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
400
454
|
"input",
|
|
401
455
|
{
|
|
402
456
|
type: "text",
|
|
403
|
-
className: "
|
|
457
|
+
className: "cron-input-custom-input",
|
|
404
458
|
value: input,
|
|
405
459
|
placeholder: "* * * * *",
|
|
406
460
|
spellCheck: false,
|
|
@@ -410,12 +464,12 @@ function CustomTab({ expression, onChange }) {
|
|
|
410
464
|
}
|
|
411
465
|
}
|
|
412
466
|
),
|
|
413
|
-
input && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("
|
|
467
|
+
input && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("cron-input-custom-badge", isValid ? "cron-input-custom-badge--ok" : "cron-input-custom-badge--err"), children: isValid ? "\u2713" : "\u2717" })
|
|
414
468
|
] }),
|
|
415
|
-
isValid && parsed && parsed.type !== "custom" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "
|
|
416
|
-
parts.length === 5 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
417
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
418
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
469
|
+
isValid && parsed && parsed.type !== "custom" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "cron-input-custom-desc", children: toDisplayString(parsed) }),
|
|
470
|
+
parts.length === 5 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cron-input-custom-fields", children: FIELD_LABELS.map((label, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-custom-field", children: [
|
|
471
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-custom-field-val", children: parts[i] }),
|
|
472
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-custom-field-lbl", children: label })
|
|
419
473
|
] }, label)) })
|
|
420
474
|
] });
|
|
421
475
|
}
|
|
@@ -429,7 +483,8 @@ function CronInput({
|
|
|
429
483
|
popoverSide = "bottom",
|
|
430
484
|
renderTrigger,
|
|
431
485
|
portalContainer,
|
|
432
|
-
className
|
|
486
|
+
className,
|
|
487
|
+
uiAdapter
|
|
433
488
|
}) {
|
|
434
489
|
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
435
490
|
const [uncontrolled, setUncontrolled] = react.useState(defaultValue);
|
|
@@ -447,9 +502,9 @@ function CronInput({
|
|
|
447
502
|
setDraft(switchTab(draft, tab));
|
|
448
503
|
};
|
|
449
504
|
const handleDraft = (next) => setDraft(next);
|
|
450
|
-
|
|
505
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(Popover2, { open: isOpen, onOpenChange: disabled ? void 0 : setIsOpen, children: [
|
|
451
506
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
452
|
-
|
|
507
|
+
PopoverTrigger2,
|
|
453
508
|
{
|
|
454
509
|
disabled,
|
|
455
510
|
render: (triggerProps) => renderTrigger ? renderTrigger(triggerProps, { open: isOpen, value }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -457,32 +512,32 @@ function CronInput({
|
|
|
457
512
|
{
|
|
458
513
|
...triggerProps,
|
|
459
514
|
disabled,
|
|
460
|
-
className: cn("
|
|
515
|
+
className: cn("cron-input-trigger", isOpen && "cron-input-trigger--open", className),
|
|
461
516
|
children: [
|
|
462
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { size: 13, className: "
|
|
463
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
517
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { size: 13, className: "cron-input-trigger-icon" }),
|
|
518
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-trigger-label", children: toDisplayString(value) })
|
|
464
519
|
]
|
|
465
520
|
}
|
|
466
521
|
)
|
|
467
522
|
}
|
|
468
523
|
),
|
|
469
524
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
470
|
-
|
|
525
|
+
PopoverContent2,
|
|
471
526
|
{
|
|
472
527
|
align: popoverAlign,
|
|
473
528
|
side: popoverSide,
|
|
474
529
|
sideOffset: 4,
|
|
475
530
|
container: portalContainer,
|
|
476
531
|
children: [
|
|
477
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
478
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
479
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
480
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
481
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
482
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
483
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
532
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Tabs2, { value: draft.type, onValueChange: handleTabChange, children: [
|
|
533
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TabsList2, { children: [
|
|
534
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsTrigger2, { value: "interval", children: labels.interval }),
|
|
535
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsTrigger2, { value: "daily", children: labels.daily }),
|
|
536
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsTrigger2, { value: "weekly", children: labels.weekly }),
|
|
537
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsTrigger2, { value: "monthly", children: labels.monthly }),
|
|
538
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsTrigger2, { value: "custom", children: labels.custom })
|
|
484
539
|
] }),
|
|
485
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
540
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsContent2, { value: "interval", children: draft.type === "interval" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
486
541
|
IntervalTab,
|
|
487
542
|
{
|
|
488
543
|
every: draft.every,
|
|
@@ -490,7 +545,7 @@ function CronInput({
|
|
|
490
545
|
onChange: (every, unit) => handleDraft({ type: "interval", every, unit })
|
|
491
546
|
}
|
|
492
547
|
) }),
|
|
493
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
548
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsContent2, { value: "daily", children: draft.type === "daily" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
494
549
|
DailyTab,
|
|
495
550
|
{
|
|
496
551
|
hour: draft.hour,
|
|
@@ -498,7 +553,7 @@ function CronInput({
|
|
|
498
553
|
onChange: (hour, minute) => handleDraft({ type: "daily", hour, minute })
|
|
499
554
|
}
|
|
500
555
|
) }),
|
|
501
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
556
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsContent2, { value: "weekly", children: draft.type === "weekly" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
502
557
|
WeeklyTab,
|
|
503
558
|
{
|
|
504
559
|
days: draft.days,
|
|
@@ -507,7 +562,7 @@ function CronInput({
|
|
|
507
562
|
onChange: (days, hour, minute) => handleDraft({ type: "weekly", days, hour, minute })
|
|
508
563
|
}
|
|
509
564
|
) }),
|
|
510
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
565
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsContent2, { value: "monthly", children: draft.type === "monthly" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
511
566
|
MonthlyTab,
|
|
512
567
|
{
|
|
513
568
|
day: draft.day,
|
|
@@ -516,7 +571,7 @@ function CronInput({
|
|
|
516
571
|
onChange: (day, hour, minute) => handleDraft({ type: "monthly", day, hour, minute })
|
|
517
572
|
}
|
|
518
573
|
) }),
|
|
519
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
574
|
+
/* @__PURE__ */ jsxRuntime.jsx(TabsContent2, { value: "custom", children: draft.type === "custom" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
520
575
|
CustomTab,
|
|
521
576
|
{
|
|
522
577
|
expression: draft.expression,
|
|
@@ -524,12 +579,12 @@ function CronInput({
|
|
|
524
579
|
}
|
|
525
580
|
) })
|
|
526
581
|
] }),
|
|
527
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
528
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "
|
|
529
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
530
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
582
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-footer", children: [
|
|
583
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cron-input-preview", children: toDisplayString(draft) }),
|
|
584
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cron-input-footer-actions", children: [
|
|
585
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "outline", size: "sm", onClick: onCancel, children: labels.cancel }),
|
|
531
586
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
532
|
-
|
|
587
|
+
Button2,
|
|
533
588
|
{
|
|
534
589
|
size: "sm",
|
|
535
590
|
onClick: onApply,
|
|
@@ -543,14 +598,17 @@ function CronInput({
|
|
|
543
598
|
}
|
|
544
599
|
)
|
|
545
600
|
] });
|
|
601
|
+
return uiAdapter ? /* @__PURE__ */ jsxRuntime.jsx(CronInputProvider, { adapter: uiAdapter, children: content }) : content;
|
|
546
602
|
}
|
|
547
603
|
|
|
548
604
|
exports.CronInput = CronInput;
|
|
605
|
+
exports.CronInputProvider = CronInputProvider;
|
|
549
606
|
exports.DEFAULT_VALUE = DEFAULT_VALUE;
|
|
550
607
|
exports.fromCronExpression = fromCronExpression;
|
|
551
608
|
exports.toCronExpression = toCronExpression;
|
|
552
609
|
exports.toDisplayString = toDisplayString;
|
|
553
610
|
exports.useCronInput = useCronInput;
|
|
611
|
+
exports.useCronInputUI = useCronInputUI;
|
|
554
612
|
exports.validateCronExpression = validateCronExpression;
|
|
555
613
|
//# sourceMappingURL=index.cjs.map
|
|
556
614
|
//# sourceMappingURL=index.cjs.map
|