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