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