@djangocfg/ui-tools 2.1.129 → 2.1.131
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 +57 -1
- package/dist/CronScheduler.client-5UEBG4EY.mjs +67 -0
- package/dist/CronScheduler.client-5UEBG4EY.mjs.map +1 -0
- package/dist/CronScheduler.client-ZDNFXYWJ.cjs +72 -0
- package/dist/CronScheduler.client-ZDNFXYWJ.cjs.map +1 -0
- package/dist/chunk-JFGLA6DT.cjs +1013 -0
- package/dist/chunk-JFGLA6DT.cjs.map +1 -0
- package/dist/chunk-MQDWUBVX.mjs +993 -0
- package/dist/chunk-MQDWUBVX.mjs.map +1 -0
- package/dist/index.cjs +109 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +280 -1
- package/dist/index.d.ts +280 -1
- package/dist/index.mjs +32 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +5 -0
- package/src/tools/CronScheduler/CronScheduler.client.tsx +140 -0
- package/src/tools/CronScheduler/CronScheduler.story.tsx +220 -0
- package/src/tools/CronScheduler/components/CronCheatsheet.tsx +101 -0
- package/src/tools/CronScheduler/components/CustomInput.tsx +67 -0
- package/src/tools/CronScheduler/components/DayChips.tsx +130 -0
- package/src/tools/CronScheduler/components/MonthDayGrid.tsx +143 -0
- package/src/tools/CronScheduler/components/SchedulePreview.tsx +103 -0
- package/src/tools/CronScheduler/components/ScheduleTypeSelector.tsx +57 -0
- package/src/tools/CronScheduler/components/TimeSelector.tsx +132 -0
- package/src/tools/CronScheduler/components/index.ts +24 -0
- package/src/tools/CronScheduler/context/CronSchedulerContext.tsx +237 -0
- package/src/tools/CronScheduler/context/hooks.ts +86 -0
- package/src/tools/CronScheduler/context/index.ts +18 -0
- package/src/tools/CronScheduler/index.tsx +91 -0
- package/src/tools/CronScheduler/lazy.tsx +67 -0
- package/src/tools/CronScheduler/types/index.ts +112 -0
- package/src/tools/CronScheduler/utils/cron-builder.ts +100 -0
- package/src/tools/CronScheduler/utils/cron-humanize.ts +218 -0
- package/src/tools/CronScheduler/utils/cron-parser.ts +188 -0
- package/src/tools/CronScheduler/utils/index.ts +12 -0
- package/src/tools/index.ts +36 -0
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ This package contains heavy components that are loaded lazily to keep your initi
|
|
|
22
22
|
| `@djangocfg/ui-tools` | Heavy tools with lazy loading |
|
|
23
23
|
| `@djangocfg/ui-nextjs` | Next.js apps (extends ui-core) |
|
|
24
24
|
|
|
25
|
-
## Tools (
|
|
25
|
+
## Tools (12)
|
|
26
26
|
|
|
27
27
|
| Tool | Bundle Size | Description |
|
|
28
28
|
|------|-------------|-------------|
|
|
@@ -37,6 +37,7 @@ This package contains heavy components that are loaded lazily to keep your initi
|
|
|
37
37
|
| `VideoPlayer` | ~150KB | Professional video player with Vidstack |
|
|
38
38
|
| `JsonTree` | ~100KB | JSON visualization with modes (full/compact/inline) |
|
|
39
39
|
| `ImageViewer` | ~50KB | Image viewer with zoom/pan/rotate |
|
|
40
|
+
| `CronScheduler` | ~15KB | Cron expression builder with intuitive UI |
|
|
40
41
|
|
|
41
42
|
## Tree-Shakeable Imports
|
|
42
43
|
|
|
@@ -248,6 +249,60 @@ const schema = {
|
|
|
248
249
|
|-------|-------------|
|
|
249
250
|
| `useMediaCacheStore` | Media caching for video/audio players |
|
|
250
251
|
|
|
252
|
+
## Cron Scheduler
|
|
253
|
+
|
|
254
|
+
Compact cron expression builder with intuitive UI. Supports Daily, Weekly, Monthly schedules and custom cron expressions.
|
|
255
|
+
|
|
256
|
+
```tsx
|
|
257
|
+
import { CronScheduler } from '@djangocfg/ui-tools';
|
|
258
|
+
|
|
259
|
+
<CronScheduler
|
|
260
|
+
value="0 9 * * 1-5"
|
|
261
|
+
onChange={(cron) => console.log(cron)}
|
|
262
|
+
showPreview
|
|
263
|
+
allowCopy
|
|
264
|
+
/>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Props
|
|
268
|
+
|
|
269
|
+
| Prop | Type | Default | Description |
|
|
270
|
+
|------|------|---------|-------------|
|
|
271
|
+
| `value` | `string` | - | Cron expression (Unix 5-field format) |
|
|
272
|
+
| `onChange` | `(cron: string) => void` | - | Callback when schedule changes |
|
|
273
|
+
| `defaultType` | `'daily' \| 'weekly' \| 'monthly' \| 'custom'` | `'daily'` | Initial schedule type |
|
|
274
|
+
| `showPreview` | `boolean` | `true` | Show human-readable preview |
|
|
275
|
+
| `showCronExpression` | `boolean` | `true` | Show cron expression in preview |
|
|
276
|
+
| `allowCopy` | `boolean` | `false` | Enable copy to clipboard |
|
|
277
|
+
| `timeFormat` | `'12h' \| '24h'` | `'24h'` | Time display format |
|
|
278
|
+
| `disabled` | `boolean` | `false` | Disable all interactions |
|
|
279
|
+
|
|
280
|
+
### Context Hooks
|
|
281
|
+
|
|
282
|
+
For custom compositions, use the context hooks:
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
import {
|
|
286
|
+
CronSchedulerProvider,
|
|
287
|
+
useCronType,
|
|
288
|
+
useCronTime,
|
|
289
|
+
useCronWeekDays,
|
|
290
|
+
useCronMonthDays,
|
|
291
|
+
useCronPreview,
|
|
292
|
+
} from '@djangocfg/ui-tools';
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Utilities
|
|
296
|
+
|
|
297
|
+
```tsx
|
|
298
|
+
import {
|
|
299
|
+
buildCron, // State → Cron expression
|
|
300
|
+
parseCron, // Cron → State
|
|
301
|
+
humanizeCron, // Cron → Human description
|
|
302
|
+
isValidCron, // Validate cron syntax
|
|
303
|
+
} from '@djangocfg/ui-tools';
|
|
304
|
+
```
|
|
305
|
+
|
|
251
306
|
## JSON Tree
|
|
252
307
|
|
|
253
308
|
JSON visualization with three display modes:
|
|
@@ -287,6 +342,7 @@ import {
|
|
|
287
342
|
LazyVideoPlayer, // ~150KB
|
|
288
343
|
LazyJsonTree, // ~100KB
|
|
289
344
|
LazyImageViewer, // ~50KB
|
|
345
|
+
LazyCronScheduler, // ~15KB
|
|
290
346
|
} from '@djangocfg/ui-tools';
|
|
291
347
|
|
|
292
348
|
// Just use them - no Suspense wrapper needed!
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useCronType, ScheduleTypeSelector, TimeSelector, DayChips, MonthDayGrid, CustomInput, SchedulePreview, CronSchedulerProvider } from './chunk-MQDWUBVX.mjs';
|
|
2
|
+
import { __name } from './chunk-CGILA3WO.mjs';
|
|
3
|
+
import { cn } from '@djangocfg/ui-core/lib';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function CronSchedulerInner({
|
|
7
|
+
showPreview,
|
|
8
|
+
showCronExpression,
|
|
9
|
+
allowCopy,
|
|
10
|
+
timeFormat,
|
|
11
|
+
disabled,
|
|
12
|
+
className
|
|
13
|
+
}) {
|
|
14
|
+
const { type } = useCronType();
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3", className), children: [
|
|
16
|
+
/* @__PURE__ */ jsx(ScheduleTypeSelector, { disabled }),
|
|
17
|
+
type !== "custom" && /* @__PURE__ */ jsx(TimeSelector, { format: timeFormat, disabled }),
|
|
18
|
+
type === "weekly" && /* @__PURE__ */ jsx(DayChips, { disabled, showPresets: true }),
|
|
19
|
+
type === "monthly" && /* @__PURE__ */ jsx(MonthDayGrid, { disabled, showPresets: true }),
|
|
20
|
+
type === "custom" && /* @__PURE__ */ jsx(CustomInput, { disabled }),
|
|
21
|
+
showPreview && /* @__PURE__ */ jsx(
|
|
22
|
+
SchedulePreview,
|
|
23
|
+
{
|
|
24
|
+
showCronExpression: true,
|
|
25
|
+
allowCopy
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
__name(CronSchedulerInner, "CronSchedulerInner");
|
|
31
|
+
function CronScheduler({
|
|
32
|
+
value,
|
|
33
|
+
onChange,
|
|
34
|
+
defaultType = "daily",
|
|
35
|
+
showPreview = true,
|
|
36
|
+
showCronExpression = false,
|
|
37
|
+
allowCopy = false,
|
|
38
|
+
timeFormat = "24h",
|
|
39
|
+
disabled = false,
|
|
40
|
+
className
|
|
41
|
+
}) {
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
CronSchedulerProvider,
|
|
44
|
+
{
|
|
45
|
+
value,
|
|
46
|
+
onChange,
|
|
47
|
+
defaultType,
|
|
48
|
+
children: /* @__PURE__ */ jsx(
|
|
49
|
+
CronSchedulerInner,
|
|
50
|
+
{
|
|
51
|
+
showPreview,
|
|
52
|
+
showCronExpression,
|
|
53
|
+
allowCopy,
|
|
54
|
+
timeFormat,
|
|
55
|
+
disabled,
|
|
56
|
+
className
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
__name(CronScheduler, "CronScheduler");
|
|
63
|
+
var CronScheduler_client_default = CronScheduler;
|
|
64
|
+
|
|
65
|
+
export { CronScheduler, CronScheduler_client_default as default };
|
|
66
|
+
//# sourceMappingURL=CronScheduler.client-5UEBG4EY.mjs.map
|
|
67
|
+
//# sourceMappingURL=CronScheduler.client-5UEBG4EY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tools/CronScheduler/CronScheduler.client.tsx"],"names":[],"mappings":";;;;;AAmCA,SAAS,kBAAA,CAAmB;AAAA,EAC1B,WAAA;AAAA,EACA,kBAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAA4B;AAC1B,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,WAAA,EAAY;AAE7B,EAAA,4BACG,KAAA,EAAA,EAAI,SAAA,EAAW,EAAA,CAAG,WAAA,EAAa,SAAS,CAAA,EAEvC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,wBAAqB,QAAA,EAAoB,CAAA;AAAA,IAGzC,SAAS,QAAA,oBACR,GAAA,CAAC,YAAA,EAAA,EAAa,MAAA,EAAQ,YAAY,QAAA,EAAoB,CAAA;AAAA,IAIvD,SAAS,QAAA,oBACR,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,EAAoB,aAAW,IAAA,EAAC,CAAA;AAAA,IAI3C,SAAS,SAAA,oBACR,GAAA,CAAC,YAAA,EAAA,EAAa,QAAA,EAAoB,aAAW,IAAA,EAAC,CAAA;AAAA,IAI/C,IAAA,KAAS,QAAA,oBACR,GAAA,CAAC,WAAA,EAAA,EAAY,QAAA,EAAoB,CAAA;AAAA,IAIlC,WAAA,oBACC,GAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,kBAAA,EAAkB,IAAA;AAAA,QAClB;AAAA;AAAA;AACF,GAAA,EAEJ,CAAA;AAEJ;AA5CS,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA;AA2EF,SAAS,aAAA,CAAc;AAAA,EAC5B,KAAA;AAAA,EACA,QAAA;AAAA,EACA,WAAA,GAAc,OAAA;AAAA,EACd,WAAA,GAAc,IAAA;AAAA,EACd,kBAAA,GAAqB,KAAA;AAAA,EACrB,SAAA,GAAY,KAAA;AAAA,EACZ,UAAA,GAAa,KAAA;AAAA,EACb,QAAA,GAAW,KAAA;AAAA,EACX;AACF,CAAA,EAAuB;AACrB,EAAA,uBACE,GAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,WAAA;AAAA,UACA,kBAAA;AAAA,UACA,SAAA;AAAA,UACA,UAAA;AAAA,UACA,QAAA;AAAA,UACA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;AA3BgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA;AA6BhB,IAAO,4BAAA,GAAQ","file":"CronScheduler.client-5UEBG4EY.mjs","sourcesContent":["'use client';\n\n/**\n * CronScheduler Client Component\n *\n * Compact cron expression builder following Apple HIG principles.\n * Uses context-based architecture for state management.\n */\n\nimport { cn } from '@djangocfg/ui-core/lib';\nimport { CronSchedulerProvider } from './context/CronSchedulerContext';\nimport { useCronType } from './context/hooks';\nimport {\n ScheduleTypeSelector,\n TimeSelector,\n DayChips,\n MonthDayGrid,\n CustomInput,\n SchedulePreview,\n} from './components';\nimport type { CronSchedulerProps } from './types';\n\n// ============================================================================\n// Inner Component (uses context)\n// ============================================================================\n\ninterface CronSchedulerInnerProps {\n showPreview: boolean;\n showCronExpression: boolean;\n allowCopy: boolean;\n timeFormat: '12h' | '24h';\n disabled: boolean;\n className?: string;\n}\n\nfunction CronSchedulerInner({\n showPreview,\n showCronExpression,\n allowCopy,\n timeFormat,\n disabled,\n className,\n}: CronSchedulerInnerProps) {\n const { type } = useCronType();\n\n return (\n <div className={cn('space-y-3', className)}>\n {/* Schedule Type Selector */}\n <ScheduleTypeSelector disabled={disabled} />\n\n {/* Time Selector (shown for daily, weekly, monthly) */}\n {type !== 'custom' && (\n <TimeSelector format={timeFormat} disabled={disabled} />\n )}\n\n {/* Day Chips (weekly only) */}\n {type === 'weekly' && (\n <DayChips disabled={disabled} showPresets />\n )}\n\n {/* Month Day Grid (monthly only) */}\n {type === 'monthly' && (\n <MonthDayGrid disabled={disabled} showPresets />\n )}\n\n {/* Custom Input (custom only) */}\n {type === 'custom' && (\n <CustomInput disabled={disabled} />\n )}\n\n {/* Preview - always show cron expression */}\n {showPreview && (\n <SchedulePreview\n showCronExpression\n allowCopy={allowCopy}\n />\n )}\n </div>\n );\n}\n\n// ============================================================================\n// Main Component (with Provider)\n// ============================================================================\n\n/**\n * CronScheduler - Compact cron expression builder\n *\n * A user-friendly interface for creating cron schedules without\n * needing to know cron syntax. Follows Apple HIG design principles.\n *\n * @example\n * // Basic usage\n * <CronScheduler\n * value={cronExpression}\n * onChange={setCronExpression}\n * />\n *\n * @example\n * // With all options\n * <CronScheduler\n * value=\"0 9 * * 1-5\"\n * onChange={handleChange}\n * defaultType=\"weekly\"\n * showPreview\n * showCronExpression\n * allowCopy\n * timeFormat=\"24h\"\n * />\n */\nexport function CronScheduler({\n value,\n onChange,\n defaultType = 'daily',\n showPreview = true,\n showCronExpression = false,\n allowCopy = false,\n timeFormat = '24h',\n disabled = false,\n className,\n}: CronSchedulerProps) {\n return (\n <CronSchedulerProvider\n value={value}\n onChange={onChange}\n defaultType={defaultType}\n >\n <CronSchedulerInner\n showPreview={showPreview}\n showCronExpression={showCronExpression}\n allowCopy={allowCopy}\n timeFormat={timeFormat}\n disabled={disabled}\n className={className}\n />\n </CronSchedulerProvider>\n );\n}\n\nexport default CronScheduler;\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var chunkJFGLA6DT_cjs = require('./chunk-JFGLA6DT.cjs');
|
|
6
|
+
var chunkWGEGR3DF_cjs = require('./chunk-WGEGR3DF.cjs');
|
|
7
|
+
var lib = require('@djangocfg/ui-core/lib');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
function CronSchedulerInner({
|
|
11
|
+
showPreview,
|
|
12
|
+
showCronExpression,
|
|
13
|
+
allowCopy,
|
|
14
|
+
timeFormat,
|
|
15
|
+
disabled,
|
|
16
|
+
className
|
|
17
|
+
}) {
|
|
18
|
+
const { type } = chunkJFGLA6DT_cjs.useCronType();
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: lib.cn("space-y-3", className), children: [
|
|
20
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkJFGLA6DT_cjs.ScheduleTypeSelector, { disabled }),
|
|
21
|
+
type !== "custom" && /* @__PURE__ */ jsxRuntime.jsx(chunkJFGLA6DT_cjs.TimeSelector, { format: timeFormat, disabled }),
|
|
22
|
+
type === "weekly" && /* @__PURE__ */ jsxRuntime.jsx(chunkJFGLA6DT_cjs.DayChips, { disabled, showPresets: true }),
|
|
23
|
+
type === "monthly" && /* @__PURE__ */ jsxRuntime.jsx(chunkJFGLA6DT_cjs.MonthDayGrid, { disabled, showPresets: true }),
|
|
24
|
+
type === "custom" && /* @__PURE__ */ jsxRuntime.jsx(chunkJFGLA6DT_cjs.CustomInput, { disabled }),
|
|
25
|
+
showPreview && /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
chunkJFGLA6DT_cjs.SchedulePreview,
|
|
27
|
+
{
|
|
28
|
+
showCronExpression: true,
|
|
29
|
+
allowCopy
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
chunkWGEGR3DF_cjs.__name(CronSchedulerInner, "CronSchedulerInner");
|
|
35
|
+
function CronScheduler({
|
|
36
|
+
value,
|
|
37
|
+
onChange,
|
|
38
|
+
defaultType = "daily",
|
|
39
|
+
showPreview = true,
|
|
40
|
+
showCronExpression = false,
|
|
41
|
+
allowCopy = false,
|
|
42
|
+
timeFormat = "24h",
|
|
43
|
+
disabled = false,
|
|
44
|
+
className
|
|
45
|
+
}) {
|
|
46
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
chunkJFGLA6DT_cjs.CronSchedulerProvider,
|
|
48
|
+
{
|
|
49
|
+
value,
|
|
50
|
+
onChange,
|
|
51
|
+
defaultType,
|
|
52
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53
|
+
CronSchedulerInner,
|
|
54
|
+
{
|
|
55
|
+
showPreview,
|
|
56
|
+
showCronExpression,
|
|
57
|
+
allowCopy,
|
|
58
|
+
timeFormat,
|
|
59
|
+
disabled,
|
|
60
|
+
className
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
chunkWGEGR3DF_cjs.__name(CronScheduler, "CronScheduler");
|
|
67
|
+
var CronScheduler_client_default = CronScheduler;
|
|
68
|
+
|
|
69
|
+
exports.CronScheduler = CronScheduler;
|
|
70
|
+
exports.default = CronScheduler_client_default;
|
|
71
|
+
//# sourceMappingURL=CronScheduler.client-ZDNFXYWJ.cjs.map
|
|
72
|
+
//# sourceMappingURL=CronScheduler.client-ZDNFXYWJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tools/CronScheduler/CronScheduler.client.tsx"],"names":["useCronType","cn","jsx","ScheduleTypeSelector","TimeSelector","DayChips","MonthDayGrid","CustomInput","SchedulePreview","__name","CronSchedulerProvider"],"mappings":";;;;;;;;;AAmCA,SAAS,kBAAA,CAAmB;AAAA,EAC1B,WAAA;AAAA,EACA,kBAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAA4B;AAC1B,EAAA,MAAM,EAAE,IAAA,EAAK,GAAIA,6BAAA,EAAY;AAE7B,EAAA,uCACG,KAAA,EAAA,EAAI,SAAA,EAAWC,MAAA,CAAG,WAAA,EAAa,SAAS,CAAA,EAEvC,QAAA,EAAA;AAAA,oBAAAC,cAAA,CAACC,0CAAqB,QAAA,EAAoB,CAAA;AAAA,IAGzC,SAAS,QAAA,oBACRD,cAAA,CAACE,8BAAA,EAAA,EAAa,MAAA,EAAQ,YAAY,QAAA,EAAoB,CAAA;AAAA,IAIvD,SAAS,QAAA,oBACRF,cAAA,CAACG,0BAAA,EAAA,EAAS,QAAA,EAAoB,aAAW,IAAA,EAAC,CAAA;AAAA,IAI3C,SAAS,SAAA,oBACRH,cAAA,CAACI,8BAAA,EAAA,EAAa,QAAA,EAAoB,aAAW,IAAA,EAAC,CAAA;AAAA,IAI/C,IAAA,KAAS,QAAA,oBACRJ,cAAA,CAACK,6BAAA,EAAA,EAAY,QAAA,EAAoB,CAAA;AAAA,IAIlC,WAAA,oBACCL,cAAA;AAAA,MAACM,iCAAA;AAAA,MAAA;AAAA,QACC,kBAAA,EAAkB,IAAA;AAAA,QAClB;AAAA;AAAA;AACF,GAAA,EAEJ,CAAA;AAEJ;AA5CSC,wBAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA;AA2EF,SAAS,aAAA,CAAc;AAAA,EAC5B,KAAA;AAAA,EACA,QAAA;AAAA,EACA,WAAA,GAAc,OAAA;AAAA,EACd,WAAA,GAAc,IAAA;AAAA,EACd,kBAAA,GAAqB,KAAA;AAAA,EACrB,SAAA,GAAY,KAAA;AAAA,EACZ,UAAA,GAAa,KAAA;AAAA,EACb,QAAA,GAAW,KAAA;AAAA,EACX;AACF,CAAA,EAAuB;AACrB,EAAA,uBACEP,cAAA;AAAA,IAACQ,uCAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,MAEA,QAAA,kBAAAR,cAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,WAAA;AAAA,UACA,kBAAA;AAAA,UACA,SAAA;AAAA,UACA,UAAA;AAAA,UACA,QAAA;AAAA,UACA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;AA3BgBO,wBAAA,CAAA,aAAA,EAAA,eAAA,CAAA;AA6BhB,IAAO,4BAAA,GAAQ","file":"CronScheduler.client-ZDNFXYWJ.cjs","sourcesContent":["'use client';\n\n/**\n * CronScheduler Client Component\n *\n * Compact cron expression builder following Apple HIG principles.\n * Uses context-based architecture for state management.\n */\n\nimport { cn } from '@djangocfg/ui-core/lib';\nimport { CronSchedulerProvider } from './context/CronSchedulerContext';\nimport { useCronType } from './context/hooks';\nimport {\n ScheduleTypeSelector,\n TimeSelector,\n DayChips,\n MonthDayGrid,\n CustomInput,\n SchedulePreview,\n} from './components';\nimport type { CronSchedulerProps } from './types';\n\n// ============================================================================\n// Inner Component (uses context)\n// ============================================================================\n\ninterface CronSchedulerInnerProps {\n showPreview: boolean;\n showCronExpression: boolean;\n allowCopy: boolean;\n timeFormat: '12h' | '24h';\n disabled: boolean;\n className?: string;\n}\n\nfunction CronSchedulerInner({\n showPreview,\n showCronExpression,\n allowCopy,\n timeFormat,\n disabled,\n className,\n}: CronSchedulerInnerProps) {\n const { type } = useCronType();\n\n return (\n <div className={cn('space-y-3', className)}>\n {/* Schedule Type Selector */}\n <ScheduleTypeSelector disabled={disabled} />\n\n {/* Time Selector (shown for daily, weekly, monthly) */}\n {type !== 'custom' && (\n <TimeSelector format={timeFormat} disabled={disabled} />\n )}\n\n {/* Day Chips (weekly only) */}\n {type === 'weekly' && (\n <DayChips disabled={disabled} showPresets />\n )}\n\n {/* Month Day Grid (monthly only) */}\n {type === 'monthly' && (\n <MonthDayGrid disabled={disabled} showPresets />\n )}\n\n {/* Custom Input (custom only) */}\n {type === 'custom' && (\n <CustomInput disabled={disabled} />\n )}\n\n {/* Preview - always show cron expression */}\n {showPreview && (\n <SchedulePreview\n showCronExpression\n allowCopy={allowCopy}\n />\n )}\n </div>\n );\n}\n\n// ============================================================================\n// Main Component (with Provider)\n// ============================================================================\n\n/**\n * CronScheduler - Compact cron expression builder\n *\n * A user-friendly interface for creating cron schedules without\n * needing to know cron syntax. Follows Apple HIG design principles.\n *\n * @example\n * // Basic usage\n * <CronScheduler\n * value={cronExpression}\n * onChange={setCronExpression}\n * />\n *\n * @example\n * // With all options\n * <CronScheduler\n * value=\"0 9 * * 1-5\"\n * onChange={handleChange}\n * defaultType=\"weekly\"\n * showPreview\n * showCronExpression\n * allowCopy\n * timeFormat=\"24h\"\n * />\n */\nexport function CronScheduler({\n value,\n onChange,\n defaultType = 'daily',\n showPreview = true,\n showCronExpression = false,\n allowCopy = false,\n timeFormat = '24h',\n disabled = false,\n className,\n}: CronSchedulerProps) {\n return (\n <CronSchedulerProvider\n value={value}\n onChange={onChange}\n defaultType={defaultType}\n >\n <CronSchedulerInner\n showPreview={showPreview}\n showCronExpression={showCronExpression}\n allowCopy={allowCopy}\n timeFormat={timeFormat}\n disabled={disabled}\n className={className}\n />\n </CronSchedulerProvider>\n );\n}\n\nexport default CronScheduler;\n"]}
|