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