@pos-360/horizon 0.27.0 → 0.27.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/dist/{chunk-HM5GFDXY.mjs → chunk-2LATCE3V.mjs} +89 -42
- package/dist/chunk-2LATCE3V.mjs.map +1 -0
- package/dist/{chunk-ZXSNRAGZ.js → chunk-JP5BJYYD.js} +89 -42
- package/dist/chunk-JP5BJYYD.js.map +1 -0
- package/dist/index.js +103 -103
- package/dist/index.mjs +1 -1
- package/dist/primitives.js +103 -103
- package/dist/primitives.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-HM5GFDXY.mjs.map +0 -1
- package/dist/chunk-ZXSNRAGZ.js.map +0 -1
|
@@ -2272,27 +2272,33 @@ function DateRangePicker({
|
|
|
2272
2272
|
from: void 0,
|
|
2273
2273
|
to: void 0
|
|
2274
2274
|
});
|
|
2275
|
+
const [draft, setDraft] = React10.useState({
|
|
2276
|
+
from: void 0,
|
|
2277
|
+
to: void 0
|
|
2278
|
+
});
|
|
2275
2279
|
const [hoverDate, setHoverDate] = React10.useState();
|
|
2276
2280
|
const [leftMonth, setLeftMonth] = React10.useState(
|
|
2277
2281
|
() => startOfMonth(value?.from ?? /* @__PURE__ */ new Date())
|
|
2278
2282
|
);
|
|
2279
2283
|
const [activePreset, setActivePreset] = React10.useState();
|
|
2280
|
-
const
|
|
2284
|
+
const committedRange = value ?? internalRange;
|
|
2285
|
+
const handleOpenChange = (newOpen) => {
|
|
2286
|
+
if (newOpen) {
|
|
2287
|
+
setDraft(committedRange);
|
|
2288
|
+
if (committedRange.from) setLeftMonth(startOfMonth(committedRange.from));
|
|
2289
|
+
}
|
|
2290
|
+
setOpen(newOpen);
|
|
2291
|
+
};
|
|
2281
2292
|
const handleDayClick = (date) => {
|
|
2282
|
-
const { from, to } =
|
|
2293
|
+
const { from, to } = draft;
|
|
2283
2294
|
if (!from || from && to) {
|
|
2284
|
-
|
|
2295
|
+
setDraft({ from: date, to: void 0 });
|
|
2285
2296
|
setActivePreset(void 0);
|
|
2286
|
-
if (onChange) onChange(newRange2);
|
|
2287
|
-
else setInternalRange(newRange2);
|
|
2288
2297
|
return;
|
|
2289
2298
|
}
|
|
2290
2299
|
const [start, end] = isBefore(from, date) ? [from, date] : [date, from];
|
|
2291
|
-
|
|
2292
|
-
if (onChange) onChange(newRange);
|
|
2293
|
-
else setInternalRange(newRange);
|
|
2300
|
+
setDraft({ from: start, to: end });
|
|
2294
2301
|
setHoverDate(void 0);
|
|
2295
|
-
setOpen(false);
|
|
2296
2302
|
};
|
|
2297
2303
|
const handlePreset = (preset) => {
|
|
2298
2304
|
const newRange = preset.getRange();
|
|
@@ -2302,8 +2308,21 @@ function DateRangePicker({
|
|
|
2302
2308
|
if (newRange.from) setLeftMonth(startOfMonth(newRange.from));
|
|
2303
2309
|
setOpen(false);
|
|
2304
2310
|
};
|
|
2311
|
+
const handleApply = () => {
|
|
2312
|
+
if (draft.from && !draft.to) return;
|
|
2313
|
+
const newRange = draft.from && draft.to ? draft : void 0;
|
|
2314
|
+
if (onChange) onChange(newRange);
|
|
2315
|
+
else setInternalRange(newRange ?? { from: void 0, to: void 0 });
|
|
2316
|
+
setOpen(false);
|
|
2317
|
+
};
|
|
2318
|
+
const handleClear = () => {
|
|
2319
|
+
setDraft({ from: void 0, to: void 0 });
|
|
2320
|
+
setActivePreset(void 0);
|
|
2321
|
+
};
|
|
2322
|
+
const canClear = !!(draft.from || committedRange.from);
|
|
2323
|
+
const canApply = !(draft.from && !draft.to) && !!(draft.from || committedRange.from);
|
|
2305
2324
|
const rightMonth = addMonths(leftMonth, 1);
|
|
2306
|
-
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange:
|
|
2325
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
2307
2326
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2308
2327
|
"button",
|
|
2309
2328
|
{
|
|
@@ -2313,12 +2332,12 @@ function DateRangePicker({
|
|
|
2313
2332
|
"hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",
|
|
2314
2333
|
"dark:border-neutral-600 dark:bg-neutral-800 dark:hover:bg-neutral-700",
|
|
2315
2334
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
2316
|
-
|
|
2335
|
+
committedRange.from ? "text-gray-900 dark:text-gray-100" : "text-gray-400 dark:text-gray-500",
|
|
2317
2336
|
className
|
|
2318
2337
|
),
|
|
2319
2338
|
children: [
|
|
2320
2339
|
/* @__PURE__ */ jsx(CalendarIcon, { className: "w-4 h-4 shrink-0 text-gray-400 dark:text-gray-500" }),
|
|
2321
|
-
/* @__PURE__ */ jsx("span", { children: formatDateRange(
|
|
2340
|
+
/* @__PURE__ */ jsx("span", { children: formatDateRange(committedRange, placeholder) })
|
|
2322
2341
|
]
|
|
2323
2342
|
}
|
|
2324
2343
|
) }),
|
|
@@ -2339,34 +2358,62 @@ function DateRangePicker({
|
|
|
2339
2358
|
preset.label
|
|
2340
2359
|
))
|
|
2341
2360
|
] }, section.title)) }),
|
|
2342
|
-
/* @__PURE__ */ jsxs("div", { className: "flex
|
|
2343
|
-
/* @__PURE__ */
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2361
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
2362
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-4 p-4", children: [
|
|
2363
|
+
/* @__PURE__ */ jsx(
|
|
2364
|
+
CalendarMonth,
|
|
2365
|
+
{
|
|
2366
|
+
month: leftMonth,
|
|
2367
|
+
range: draft,
|
|
2368
|
+
hoverDate,
|
|
2369
|
+
onDayClick: handleDayClick,
|
|
2370
|
+
onDayHover: setHoverDate,
|
|
2371
|
+
onPrevMonth: () => setLeftMonth(subMonths(leftMonth, 1)),
|
|
2372
|
+
showPrevNav: true,
|
|
2373
|
+
showNextNav: false
|
|
2374
|
+
}
|
|
2375
|
+
),
|
|
2376
|
+
/* @__PURE__ */ jsx("div", { className: "w-px bg-gray-100 dark:bg-neutral-700 self-stretch" }),
|
|
2377
|
+
/* @__PURE__ */ jsx(
|
|
2378
|
+
CalendarMonth,
|
|
2379
|
+
{
|
|
2380
|
+
month: rightMonth,
|
|
2381
|
+
range: draft,
|
|
2382
|
+
hoverDate,
|
|
2383
|
+
onDayClick: handleDayClick,
|
|
2384
|
+
onDayHover: setHoverDate,
|
|
2385
|
+
onNextMonth: () => setLeftMonth(addMonths(leftMonth, 1)),
|
|
2386
|
+
showPrevNav: false,
|
|
2387
|
+
showNextNav: true
|
|
2388
|
+
}
|
|
2389
|
+
)
|
|
2390
|
+
] }),
|
|
2391
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2 px-4 py-3 border-t border-gray-100 dark:border-neutral-700", children: [
|
|
2392
|
+
/* @__PURE__ */ jsx(
|
|
2393
|
+
"button",
|
|
2394
|
+
{
|
|
2395
|
+
onClick: handleClear,
|
|
2396
|
+
disabled: !canClear,
|
|
2397
|
+
className: cn(
|
|
2398
|
+
"px-3 py-1.5 rounded-md text-sm transition-colors",
|
|
2399
|
+
canClear ? "text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-neutral-700" : "text-gray-300 dark:text-gray-600 cursor-not-allowed"
|
|
2400
|
+
),
|
|
2401
|
+
children: "Clear"
|
|
2402
|
+
}
|
|
2403
|
+
),
|
|
2404
|
+
/* @__PURE__ */ jsx(
|
|
2405
|
+
"button",
|
|
2406
|
+
{
|
|
2407
|
+
onClick: handleApply,
|
|
2408
|
+
disabled: !canApply,
|
|
2409
|
+
className: cn(
|
|
2410
|
+
"px-3 py-1.5 rounded-md text-sm font-medium transition-colors",
|
|
2411
|
+
canApply ? "bg-blue-600 text-white hover:bg-blue-700 dark:hover:bg-blue-500" : "bg-blue-100 text-blue-300 cursor-not-allowed dark:bg-blue-950/30 dark:text-blue-800"
|
|
2412
|
+
),
|
|
2413
|
+
children: "Apply"
|
|
2414
|
+
}
|
|
2415
|
+
)
|
|
2416
|
+
] })
|
|
2370
2417
|
] })
|
|
2371
2418
|
] }) })
|
|
2372
2419
|
] });
|
|
@@ -2448,5 +2495,5 @@ function PeriodComparisonSelector({
|
|
|
2448
2495
|
}
|
|
2449
2496
|
|
|
2450
2497
|
export { Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, ColumnSelection, DEFAULT_COMPARISON_PERIODS, DEFAULT_PRESETS, DateRangePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Form, FormControl, FormDescription, FormField, FormLabel, FormMessage, PeriodComparisonSelector, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, SegmentedControl, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Skeleton, SkeletonAvatar, SkeletonBadge, SkeletonButton, SkeletonCard, SkeletonIcon, SkeletonInput, SkeletonSubtitle, SkeletonTableRow, SkeletonTableRows, SkeletonText, SkeletonTitle, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableRowCheckbox, TableSelectAll, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, buttonVariants, segmentedControlItemVariants, segmentedControlVariants, separatorVariants, switchLabelVariants, switchThumbVariants, switchTrackVariants, toggleGroupVariants, toggleItemVariants, useColumnVisibility, useFormContext, useFormFieldContext, useTableSelection };
|
|
2451
|
-
//# sourceMappingURL=chunk-
|
|
2452
|
-
//# sourceMappingURL=chunk-
|
|
2498
|
+
//# sourceMappingURL=chunk-2LATCE3V.mjs.map
|
|
2499
|
+
//# sourceMappingURL=chunk-2LATCE3V.mjs.map
|