rangeflow 1.0.5 → 1.0.6
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/index.js +109 -103
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,15 +4,15 @@ import { immer as f } from "zustand/middleware/immer";
|
|
|
4
4
|
import { createStore as p } from "zustand/vanilla";
|
|
5
5
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
6
6
|
import { RestrictToHorizontalAxis as g, restrictShapeToBoundingRectangle as _ } from "@dnd-kit/abstract/modifiers";
|
|
7
|
-
import { DragDropProvider as v, DragOverlay as y, useDragDropMonitor as
|
|
8
|
-
import
|
|
9
|
-
import { AnimatePresence as
|
|
10
|
-
import { useStore as
|
|
11
|
-
import { KeyboardSensor as
|
|
12
|
-
import { Group as
|
|
13
|
-
import { Modifier as
|
|
14
|
-
import { Rectangle as
|
|
15
|
-
import { effect as
|
|
7
|
+
import { DragDropProvider as v, DragOverlay as y, useDragDropMonitor as b, useDraggable as ee } from "@dnd-kit/react";
|
|
8
|
+
import x, { clsx as S } from "clsx";
|
|
9
|
+
import { AnimatePresence as te, motion as C } from "motion/react";
|
|
10
|
+
import { useStore as ne } from "zustand";
|
|
11
|
+
import { KeyboardSensor as re, PointerSensor as ie } from "@dnd-kit/dom";
|
|
12
|
+
import { Group as ae, Panel as w, Separator as T } from "react-resizable-panels";
|
|
13
|
+
import { Modifier as oe, configurator as se } from "@dnd-kit/abstract";
|
|
14
|
+
import { Rectangle as E } from "@dnd-kit/geometry";
|
|
15
|
+
import { effect as ce, signal as D } from "@dnd-kit/state";
|
|
16
16
|
import { DayPicker as le } from "react-day-picker";
|
|
17
17
|
import * as O from "@radix-ui/react-popover";
|
|
18
18
|
//#region src/package/rangeflow/constants/date-ranges.ts
|
|
@@ -142,7 +142,7 @@ function H({ children: e, defaultRange: t, defaultSelected: n, disabled: r, dura
|
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region src/package/rangeflow/animations/OdometerText.tsx
|
|
144
144
|
var U = n(({ children: e, className: t }) => /* @__PURE__ */ m("span", {
|
|
145
|
-
className:
|
|
145
|
+
className: x("inline-flex tabular-nums", t),
|
|
146
146
|
children: [...e].map((e, t) => {
|
|
147
147
|
let n = e === " " ? "\xA0" : e;
|
|
148
148
|
return /* @__PURE__ */ h("span", {
|
|
@@ -150,10 +150,10 @@ var U = n(({ children: e, className: t }) => /* @__PURE__ */ m("span", {
|
|
|
150
150
|
children: [/* @__PURE__ */ m("span", {
|
|
151
151
|
className: "invisible",
|
|
152
152
|
children: n
|
|
153
|
-
}), /* @__PURE__ */ m(
|
|
153
|
+
}), /* @__PURE__ */ m(te, {
|
|
154
154
|
initial: !1,
|
|
155
155
|
mode: "popLayout",
|
|
156
|
-
children: /* @__PURE__ */ m(
|
|
156
|
+
children: /* @__PURE__ */ m(C.span, {
|
|
157
157
|
animate: {
|
|
158
158
|
y: 0,
|
|
159
159
|
filter: "blur(0px)",
|
|
@@ -199,7 +199,7 @@ function G() {
|
|
|
199
199
|
//#endregion
|
|
200
200
|
//#region src/package/rangeflow/hooks/use-rangeflow-store.ts
|
|
201
201
|
function K(e) {
|
|
202
|
-
return
|
|
202
|
+
return ne(a(V).store, e);
|
|
203
203
|
}
|
|
204
204
|
//#endregion
|
|
205
205
|
//#region src/package/rangeflow/components/DateSlider/DateLabelsTrack.tsx
|
|
@@ -222,14 +222,19 @@ var pe = n(() => {
|
|
|
222
222
|
n
|
|
223
223
|
]);
|
|
224
224
|
return r ? t(r) : /* @__PURE__ */ m("div", {
|
|
225
|
-
className:
|
|
225
|
+
className: x("rangeflow-labels flex w-full items-center justify-between select-none", "absolute top-10 left-0 px-2", "text-xs tracking-tighter text-(--rangeflow-text-faint) uppercase"),
|
|
226
226
|
children: i.map((e, t) => /* @__PURE__ */ m(U, {
|
|
227
|
-
className:
|
|
227
|
+
className: x("rangeflow-label", { "font-medium text-(--rangeflow-text-muted)": t === 0 || t === i.length - 1 }),
|
|
228
228
|
children: e
|
|
229
229
|
}, t))
|
|
230
230
|
});
|
|
231
231
|
});
|
|
232
232
|
//#endregion
|
|
233
|
+
//#region src/package/rangeflow/hooks/use-rangeflow-refs.ts
|
|
234
|
+
function q() {
|
|
235
|
+
return a(V).refs;
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
233
238
|
//#region src/package/rangeflow/icons/DoubleChevronLeftIcon.tsx
|
|
234
239
|
function me() {
|
|
235
240
|
return /* @__PURE__ */ m("svg", {
|
|
@@ -265,7 +270,7 @@ function he() {
|
|
|
265
270
|
}
|
|
266
271
|
//#endregion
|
|
267
272
|
//#region src/package/rangeflow/components/DateSlider/DateTickers.tsx
|
|
268
|
-
var
|
|
273
|
+
var J = n(() => {
|
|
269
274
|
let { DateTickers: e } = G(), n = Math.min(Math.max(70, W(K((e) => e.range))), 100);
|
|
270
275
|
return e ? t(e) : /* @__PURE__ */ m("div", {
|
|
271
276
|
className: "rangeflow-tickers flex items-center gap-2",
|
|
@@ -277,8 +282,8 @@ var ge = n(() => {
|
|
|
277
282
|
});
|
|
278
283
|
//#endregion
|
|
279
284
|
//#region src/package/rangeflow/components/DateSlider/RangeStepButton.tsx
|
|
280
|
-
function
|
|
281
|
-
return /* @__PURE__ */ m(
|
|
285
|
+
function Y({ children: e, onClick: t }) {
|
|
286
|
+
return /* @__PURE__ */ m(C.span, {
|
|
282
287
|
className: "rangeflow-step-button shrink-0 cursor-pointer text-(--rangeflow-text) select-none hover:text-(--rangeflow-text-muted)",
|
|
283
288
|
whileHover: { scale: 1.1 },
|
|
284
289
|
onClick: t,
|
|
@@ -287,9 +292,9 @@ function q({ children: e, onClick: t }) {
|
|
|
287
292
|
}
|
|
288
293
|
//#endregion
|
|
289
294
|
//#region src/package/rangeflow/utils/derive-selection-from-layout.ts
|
|
290
|
-
var
|
|
291
|
-
function
|
|
292
|
-
let n = e[j], r = e[k], i = e[A], a = d(t.from).startOf("day"), o = d(t.to).startOf("day").diff(a, "day"), s =
|
|
295
|
+
var ge = N([5, 100], [1, 100]);
|
|
296
|
+
function _e(e, t) {
|
|
297
|
+
let n = e[j], r = e[k], i = e[A], a = d(t.from).startOf("day"), o = d(t.to).startOf("day").diff(a, "day"), s = ge(n), c = r + (n - s), l = Math.round(n) <= 5 ? 1 : Math.max(Math.round(s * o / 100), 1), u = M(Math.round(c * o / 100), 0, Math.max(o - l, 0));
|
|
293
298
|
return {
|
|
294
299
|
size: n,
|
|
295
300
|
left: r,
|
|
@@ -300,15 +305,15 @@ function ve(e, t) {
|
|
|
300
305
|
}
|
|
301
306
|
//#endregion
|
|
302
307
|
//#region src/package/rangeflow/hooks/use-rangeflow-store-api.ts
|
|
303
|
-
function
|
|
308
|
+
function X() {
|
|
304
309
|
return a(V).store;
|
|
305
310
|
}
|
|
306
311
|
//#endregion
|
|
307
312
|
//#region src/package/rangeflow/hooks/use-update-selected-date.ts
|
|
308
|
-
function
|
|
309
|
-
let e =
|
|
313
|
+
function Z() {
|
|
314
|
+
let e = X();
|
|
310
315
|
return i((t) => {
|
|
311
|
-
let { range: n, update: r } = e.getState(), { size: i, left: a, right: o, from: s, to: c } =
|
|
316
|
+
let { range: n, update: r } = e.getState(), { size: i, left: a, right: o, from: s, to: c } = _e(t, n);
|
|
312
317
|
r((e) => {
|
|
313
318
|
e.slider.size = i, e.slider.left = a, e.slider.right = o, e.selected_date = {
|
|
314
319
|
from: s,
|
|
@@ -318,15 +323,10 @@ function Y() {
|
|
|
318
323
|
}, [e]);
|
|
319
324
|
}
|
|
320
325
|
//#endregion
|
|
321
|
-
//#region src/package/rangeflow/hooks/use-rangeflow-refs.ts
|
|
322
|
-
function X() {
|
|
323
|
-
return a(V).refs;
|
|
324
|
-
}
|
|
325
|
-
//#endregion
|
|
326
326
|
//#region src/package/rangeflow/components/DateSlider/Slider/SliderLeftSpacer.tsx
|
|
327
|
-
function
|
|
327
|
+
function ve() {
|
|
328
328
|
let e = K((e) => e.slider.left), [t] = u(() => e);
|
|
329
|
-
return /* @__PURE__ */ m(
|
|
329
|
+
return /* @__PURE__ */ m(w, {
|
|
330
330
|
className: "focus:outline-none",
|
|
331
331
|
defaultSize: `${t}%`,
|
|
332
332
|
id: k,
|
|
@@ -336,9 +336,9 @@ function ye() {
|
|
|
336
336
|
}
|
|
337
337
|
//#endregion
|
|
338
338
|
//#region src/package/rangeflow/components/DateSlider/Slider/SliderRightSpacer.tsx
|
|
339
|
-
function
|
|
339
|
+
function ye() {
|
|
340
340
|
let e = K((e) => e.slider.right), [t] = u(() => e);
|
|
341
|
-
return /* @__PURE__ */ m(
|
|
341
|
+
return /* @__PURE__ */ m(w, {
|
|
342
342
|
className: "focus:outline-none",
|
|
343
343
|
defaultSize: `${t}%`,
|
|
344
344
|
id: A,
|
|
@@ -348,7 +348,7 @@ function be() {
|
|
|
348
348
|
}
|
|
349
349
|
//#endregion
|
|
350
350
|
//#region src/package/rangeflow/components/DateSlider/SliderValue.tsx
|
|
351
|
-
var
|
|
351
|
+
var be = n(() => {
|
|
352
352
|
let { SliderValueLabel: e } = G(), n = K((e) => e.slider.size), r = K((e) => e.selected_date), i = c(() => {
|
|
353
353
|
let e = Math.max(d(r.to).diff(r.from, "day"), 1);
|
|
354
354
|
return n < 10 ? `${e}D` : e === 1 ? "1 Day" : `${e} Days`;
|
|
@@ -359,13 +359,13 @@ var xe = n(() => {
|
|
|
359
359
|
]);
|
|
360
360
|
return /* @__PURE__ */ m("div", {
|
|
361
361
|
"data-track-handle": "true",
|
|
362
|
-
className:
|
|
362
|
+
className: x("rangeflow-thumb-label flex h-full w-full items-center justify-center", "mx-[clamp(0.5rem,5vw,5%)] cursor-grab", "text-xs font-medium text-nowrap text-(--rangeflow-text)"),
|
|
363
363
|
children: e ? t(e, { label: i }) : i
|
|
364
364
|
});
|
|
365
|
-
}),
|
|
366
|
-
function
|
|
367
|
-
let t = K((e) => e.slider.size), n = K((e) => e.duration), r = W(K((e) => e.range)), [i] = u(() => t), a = n?.min ? Math.min(
|
|
368
|
-
return /* @__PURE__ */ m(
|
|
365
|
+
}), Q = N([1, 100], [5, 100]);
|
|
366
|
+
function xe({ onHandleRef: e }) {
|
|
367
|
+
let t = K((e) => e.slider.size), n = K((e) => e.duration), r = W(K((e) => e.range)), [i] = u(() => t), a = n?.min ? Math.min(Q(n.min * 100 / r), 100) : 5, o = n?.max ? Math.min(Q(n.max * 100 / r), 100) : 100;
|
|
368
|
+
return /* @__PURE__ */ m(w, {
|
|
369
369
|
defaultSize: `${i}%`,
|
|
370
370
|
elementRef: e,
|
|
371
371
|
id: j,
|
|
@@ -373,20 +373,20 @@ function Se({ onHandleRef: e }) {
|
|
|
373
373
|
minSize: `${a}%`,
|
|
374
374
|
children: /* @__PURE__ */ m("div", {
|
|
375
375
|
"data-track-handle-container": "",
|
|
376
|
-
className:
|
|
377
|
-
children: /* @__PURE__ */ m(
|
|
376
|
+
className: x("rangeflow-thumb flex items-center justify-center", "h-full rounded-sm border border-(--rangeflow-border-strong) inset-shadow-sm shadow-(color:--rangeflow-shadow-color)", "backdrop-blur-[2.5px]", "cursor-default select-none"),
|
|
377
|
+
children: /* @__PURE__ */ m(be, {})
|
|
378
378
|
})
|
|
379
379
|
});
|
|
380
380
|
}
|
|
381
381
|
//#endregion
|
|
382
382
|
//#region src/package/rangeflow/components/DateSlider/Slider/index.tsx
|
|
383
|
-
var
|
|
384
|
-
function
|
|
385
|
-
let t =
|
|
383
|
+
var Se = (e, t, n) => !!e?.querySelector("[data-separator=\"active\"]") && t["slider-track-thumb"] === n["slider-track-thumb"];
|
|
384
|
+
function Ce({ onHandleRef: e }) {
|
|
385
|
+
let t = Z(), { slider: { root: n } } = q(), i = l(null), a = l(null), o = l(null), s = S("rangeflow-separator h-3/4 w-0.75 self-center rounded-full transition-[background-color,opacity] duration-150", "bg-(--rangeflow-separator) hover:bg-(--rangeflow-separator-active) focus:outline-none", "data-[separator=active]:bg-(--rangeflow-separator-active)", "opacity-0 group-has-[[data-track-handle-container]:hover]:opacity-100", "hover:opacity-100 data-[separator=active]:opacity-100 data-[separator=focus]:opacity-100"), { ref: c } = ee({
|
|
386
386
|
id: "track-handle-draggable",
|
|
387
|
-
sensors: [
|
|
387
|
+
sensors: [ie.configure({ preventActivation: (e) => !(e.target instanceof HTMLDivElement) || !e.target.dataset.trackHandle }), re]
|
|
388
388
|
});
|
|
389
|
-
return
|
|
389
|
+
return b({
|
|
390
390
|
onDragStart: () => {
|
|
391
391
|
a.current = n.current?.getLayout() ?? null;
|
|
392
392
|
},
|
|
@@ -404,14 +404,14 @@ function we({ onHandleRef: e }) {
|
|
|
404
404
|
}
|
|
405
405
|
}), /* @__PURE__ */ m("div", {
|
|
406
406
|
ref: c,
|
|
407
|
-
className:
|
|
408
|
-
children: /* @__PURE__ */ h(
|
|
407
|
+
className: S("absolute top-[50%] left-0 z-1 -translate-y-[50%]", "h-7 w-full"),
|
|
408
|
+
children: /* @__PURE__ */ h(ae, {
|
|
409
409
|
className: "group h-full w-full",
|
|
410
410
|
elementRef: i,
|
|
411
411
|
groupRef: n,
|
|
412
412
|
onLayoutChange: (e) => {
|
|
413
413
|
let a = o.current;
|
|
414
|
-
if (a &&
|
|
414
|
+
if (a && Se(i.current, a, e)) {
|
|
415
415
|
n.current?.setLayout(a);
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
@@ -420,40 +420,46 @@ function we({ onHandleRef: e }) {
|
|
|
420
420
|
});
|
|
421
421
|
},
|
|
422
422
|
children: [
|
|
423
|
-
/* @__PURE__ */ m(
|
|
424
|
-
/* @__PURE__ */ m(
|
|
425
|
-
/* @__PURE__ */ m(
|
|
426
|
-
/* @__PURE__ */ m(
|
|
427
|
-
/* @__PURE__ */ m(
|
|
423
|
+
/* @__PURE__ */ m(ve, {}),
|
|
424
|
+
/* @__PURE__ */ m(T, { className: s }),
|
|
425
|
+
/* @__PURE__ */ m(xe, { onHandleRef: e }),
|
|
426
|
+
/* @__PURE__ */ m(T, { className: s }),
|
|
427
|
+
/* @__PURE__ */ m(ye, {})
|
|
428
428
|
]
|
|
429
429
|
})
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
432
|
//#endregion
|
|
433
433
|
//#region src/package/rangeflow/components/DateSlider/SliderTrack.tsx
|
|
434
|
-
function
|
|
435
|
-
let t = K((e) => e.update), n = K((e) => e.range), r = W(n), i = K((e) => e.disabled?.before),
|
|
434
|
+
function we({ onHandleRef: e }) {
|
|
435
|
+
let t = K((e) => e.update), n = K((e) => e.range), r = W(n), { slider: { root: i } } = q(), a = K((e) => e.disabled?.before), o = K((e) => e.disabled?.after), s = c(() => !a || d(n.from).isAfter(a), [n.from, a]), l = c(() => !o || d(n.to).isBefore(o), [n.to, o]), u = ({ left: e, right: t, size: n }) => {
|
|
436
|
+
i.current?.setLayout({
|
|
437
|
+
[k]: e,
|
|
438
|
+
[j]: n,
|
|
439
|
+
[A]: t
|
|
440
|
+
});
|
|
441
|
+
};
|
|
436
442
|
return /* @__PURE__ */ h("div", {
|
|
437
443
|
className: "flex items-center select-none",
|
|
438
444
|
children: [
|
|
439
|
-
|
|
445
|
+
s ? /* @__PURE__ */ m(Y, {
|
|
440
446
|
onClick: () => {
|
|
441
447
|
t((e) => {
|
|
442
448
|
let t = d(e.range.from).subtract(r / 2, "day");
|
|
443
|
-
e.range.from =
|
|
449
|
+
e.range.from = a && t.isBefore(a) ? d(a).toDate() : t.toDate(), e.slider = F(e.range, e.selected_date), u(e.slider);
|
|
444
450
|
});
|
|
445
451
|
},
|
|
446
452
|
children: /* @__PURE__ */ m(me, {})
|
|
447
453
|
}) : null,
|
|
448
454
|
/* @__PURE__ */ h("div", {
|
|
449
455
|
className: "relative flex-1 px-2",
|
|
450
|
-
children: [/* @__PURE__ */ m(
|
|
456
|
+
children: [/* @__PURE__ */ m(Ce, { onHandleRef: e }), /* @__PURE__ */ m(J, {})]
|
|
451
457
|
}),
|
|
452
|
-
|
|
458
|
+
l ? /* @__PURE__ */ m(Y, {
|
|
453
459
|
onClick: () => {
|
|
454
460
|
t((e) => {
|
|
455
461
|
let t = d(e.range.to).add(r / 2, "day");
|
|
456
|
-
e.range.to =
|
|
462
|
+
e.range.to = o && t.isAfter(o) ? d(o).toDate() : t.toDate(), e.slider = F(e.range, e.selected_date), u(e.slider);
|
|
457
463
|
});
|
|
458
464
|
},
|
|
459
465
|
children: /* @__PURE__ */ m(he, {})
|
|
@@ -463,11 +469,11 @@ function Te({ onHandleRef: e }) {
|
|
|
463
469
|
}
|
|
464
470
|
//#endregion
|
|
465
471
|
//#region src/package/rangeflow/components/DateSlider/utils/restrict-inner-to-element.ts
|
|
466
|
-
var
|
|
472
|
+
var Te = class e extends oe {
|
|
467
473
|
innerRect = D(null);
|
|
468
474
|
containerRect = D(null);
|
|
469
475
|
constructor(e, t) {
|
|
470
|
-
super(e, t), this.destroy =
|
|
476
|
+
super(e, t), this.destroy = ce(() => {
|
|
471
477
|
if (!this.options) return;
|
|
472
478
|
let { dragOperation: t } = e;
|
|
473
479
|
if (!t.status.initialized) return;
|
|
@@ -479,24 +485,24 @@ var Ee = class e extends se {
|
|
|
479
485
|
}
|
|
480
486
|
apply({ transform: e }) {
|
|
481
487
|
let t = this.innerRect.value, n = this.containerRect.value;
|
|
482
|
-
return !t || !n ? e : _(new
|
|
488
|
+
return !t || !n ? e : _(new E(t.left, t.top, t.width, t.height), e, n);
|
|
483
489
|
}
|
|
484
|
-
static configure =
|
|
490
|
+
static configure = se(e);
|
|
485
491
|
};
|
|
486
492
|
//#endregion
|
|
487
493
|
//#region src/package/rangeflow/components/DateSlider/index.tsx
|
|
488
|
-
function
|
|
494
|
+
function Ee() {
|
|
489
495
|
let [e, t] = u(null), [n, r] = u(null);
|
|
490
496
|
return /* @__PURE__ */ m("div", {
|
|
491
497
|
ref: t,
|
|
492
498
|
className: "rangeflow-slider relative my-8 h-3 w-full px-2",
|
|
493
499
|
children: /* @__PURE__ */ h(v, {
|
|
494
|
-
modifiers: [
|
|
500
|
+
modifiers: [Te.configure({
|
|
495
501
|
inner: n,
|
|
496
502
|
container: e
|
|
497
503
|
}), g],
|
|
498
504
|
children: [
|
|
499
|
-
/* @__PURE__ */ m(
|
|
505
|
+
/* @__PURE__ */ m(we, { onHandleRef: r }),
|
|
500
506
|
/* @__PURE__ */ m(pe, {}),
|
|
501
507
|
/* @__PURE__ */ m(y, { children: null })
|
|
502
508
|
]
|
|
@@ -505,8 +511,8 @@ function De() {
|
|
|
505
511
|
}
|
|
506
512
|
//#endregion
|
|
507
513
|
//#region src/package/rangeflow/components/RangeTabs/hooks/use-apply-slider-layout.ts
|
|
508
|
-
function
|
|
509
|
-
let e =
|
|
514
|
+
function De() {
|
|
515
|
+
let e = Z(), t = K((e) => e.range.from.getTime()), n = K((e) => e.range.to.getTime()), { slider: { root: i } } = q();
|
|
510
516
|
o(() => {
|
|
511
517
|
r(() => {
|
|
512
518
|
e(i.current.getLayout());
|
|
@@ -520,8 +526,8 @@ function Oe() {
|
|
|
520
526
|
}
|
|
521
527
|
//#endregion
|
|
522
528
|
//#region src/package/rangeflow/components/RangeTabs/index.tsx
|
|
523
|
-
function
|
|
524
|
-
|
|
529
|
+
function Oe() {
|
|
530
|
+
De();
|
|
525
531
|
let e = s(), t = K((e) => e.ranges), n = K((e) => e.update), r = K((e) => e.range.from), i = K((e) => e.range.to), a = K((e) => e.disabled?.before), o = K((e) => e.disabled?.after), l = c(() => t.filter((e) => !(a && d(e.from).isBefore(a, "day") || o && d(e.to).isAfter(o, "day"))), [
|
|
526
532
|
t,
|
|
527
533
|
a,
|
|
@@ -537,16 +543,16 @@ function ke() {
|
|
|
537
543
|
className: "relative flex items-center overflow-hidden",
|
|
538
544
|
children: l.map((t, r) => /* @__PURE__ */ h("button", {
|
|
539
545
|
"data-active": u === r || void 0,
|
|
540
|
-
className:
|
|
546
|
+
className: x("rangeflow-tab relative z-1 flex items-center px-1.5 py-1 focus:outline-none"),
|
|
541
547
|
onClick: () => {
|
|
542
548
|
n((e) => {
|
|
543
549
|
e.range.from = t.from, e.range.to = t.to;
|
|
544
550
|
});
|
|
545
551
|
},
|
|
546
552
|
children: [/* @__PURE__ */ m("span", {
|
|
547
|
-
className:
|
|
553
|
+
className: x("relative z-1 text-xs tracking-tight text-(--rangeflow-text-muted)", { "font-medium text-(--rangeflow-text)": u === r }),
|
|
548
554
|
children: t.label
|
|
549
|
-
}), u === r && /* @__PURE__ */ m(
|
|
555
|
+
}), u === r && /* @__PURE__ */ m(C.div, {
|
|
550
556
|
className: "rangeflow-tab-indicator absolute inset-0 rounded-sm bg-(--rangeflow-active-bg)",
|
|
551
557
|
initial: !1,
|
|
552
558
|
layoutId: e,
|
|
@@ -562,7 +568,7 @@ function ke() {
|
|
|
562
568
|
}
|
|
563
569
|
//#endregion
|
|
564
570
|
//#region src/package/rangeflow/components/Calendar/CalendarDayButton.tsx
|
|
565
|
-
function
|
|
571
|
+
function ke({ className: e, day: t, modifiers: n, ...r }) {
|
|
566
572
|
let i = l(null);
|
|
567
573
|
o(() => {
|
|
568
574
|
n.focused && i.current?.focus();
|
|
@@ -575,22 +581,22 @@ function Ae({ className: e, day: t, modifiers: n, ...r }) {
|
|
|
575
581
|
"data-range-start": n.range_start || void 0,
|
|
576
582
|
"data-selected": a || void 0,
|
|
577
583
|
"data-today": n.today || void 0,
|
|
578
|
-
className:
|
|
584
|
+
className: x("rangeflow-day flex h-9 w-9 items-center justify-center rounded-sm leading-none", "text-xs text-(--rangeflow-text-muted) transition-colors", "hover:bg-(--rangeflow-hover-bg)", "focus-visible:ring-1 focus-visible:ring-(--rangeflow-ring) focus-visible:outline-none", "data-[today=true]:font-bold data-[today=true]:text-(--rangeflow-today)", "data-[selected=true]:bg-(--rangeflow-accent-solid) data-[selected=true]:text-(--rangeflow-accent-contrast) data-[selected=true]:hover:bg-(--rangeflow-accent-solid-hover)", "data-[range-start=true]:bg-(--rangeflow-accent-solid) data-[range-start=true]:text-(--rangeflow-accent-contrast)", "data-[range-end=true]:bg-(--rangeflow-accent-solid) data-[range-end=true]:text-(--rangeflow-accent-contrast)", e),
|
|
579
585
|
...r
|
|
580
586
|
});
|
|
581
587
|
}
|
|
582
588
|
//#endregion
|
|
583
589
|
//#region src/package/rangeflow/components/Calendar/Chevron.tsx
|
|
584
|
-
var
|
|
590
|
+
var Ae = {
|
|
585
591
|
up: "rotate-180",
|
|
586
592
|
down: "",
|
|
587
593
|
left: "rotate-90",
|
|
588
594
|
right: "-rotate-90"
|
|
589
595
|
};
|
|
590
|
-
function
|
|
596
|
+
function je({ className: e, orientation: t = "down", size: n = 16 }) {
|
|
591
597
|
return /* @__PURE__ */ m("svg", {
|
|
592
598
|
"aria-hidden": "true",
|
|
593
|
-
className:
|
|
599
|
+
className: x("shrink-0", Ae[t], e),
|
|
594
600
|
fill: "none",
|
|
595
601
|
height: n,
|
|
596
602
|
stroke: "currentColor",
|
|
@@ -604,21 +610,21 @@ function Me({ className: e, orientation: t = "down", size: n = 16 }) {
|
|
|
604
610
|
}
|
|
605
611
|
//#endregion
|
|
606
612
|
//#region src/package/rangeflow/components/Calendar/index.tsx
|
|
607
|
-
function
|
|
613
|
+
function Me({ captionLayout: e = "label", className: t, classNames: n, components: r, showOutsideDays: i = !0, ...a }) {
|
|
608
614
|
return /* @__PURE__ */ m(le, {
|
|
609
615
|
captionLayout: e,
|
|
610
|
-
className:
|
|
616
|
+
className: x("rangeflow-calendar w-fit p-3 select-none", t),
|
|
611
617
|
showOutsideDays: i,
|
|
612
618
|
classNames: {
|
|
613
619
|
months: "relative flex flex-col gap-4 md:flex-row",
|
|
614
620
|
month: "flex w-full flex-col gap-4",
|
|
615
621
|
nav: "absolute inset-x-0 top-0 flex h-7 items-center justify-between",
|
|
616
|
-
button_previous:
|
|
617
|
-
button_next:
|
|
622
|
+
button_previous: x("inline-flex h-7 w-7 items-center justify-center rounded-sm", "text-(--rangeflow-text-subtle) transition-colors hover:bg-(--rangeflow-hover-bg) hover:text-(--rangeflow-text-muted)", "aria-disabled:pointer-events-none aria-disabled:opacity-40"),
|
|
623
|
+
button_next: x("inline-flex h-7 w-7 items-center justify-center rounded-sm", "text-(--rangeflow-text-subtle) transition-colors hover:bg-(--rangeflow-hover-bg) hover:text-(--rangeflow-text-muted)", "aria-disabled:pointer-events-none aria-disabled:opacity-40"),
|
|
618
624
|
month_caption: "flex h-7 items-center justify-center text-xs font-medium text-(--rangeflow-text-muted)",
|
|
619
625
|
caption_label: "text-xs font-medium",
|
|
620
626
|
dropdowns: "flex items-center gap-1 text-xs font-medium text-(--rangeflow-text-muted)",
|
|
621
|
-
dropdown_root:
|
|
627
|
+
dropdown_root: x("relative flex items-center gap-1 rounded-sm border border-(--rangeflow-border) px-1.5 py-0.5", "has-[:focus]:ring-1 has-[:focus]:ring-(--rangeflow-ring)"),
|
|
622
628
|
dropdown: "absolute inset-0 cursor-pointer opacity-0",
|
|
623
629
|
month_grid: "mt-2 w-full border-collapse",
|
|
624
630
|
weekdays: "flex",
|
|
@@ -636,8 +642,8 @@ function Ne({ captionLayout: e = "label", className: t, classNames: n, component
|
|
|
636
642
|
...n
|
|
637
643
|
},
|
|
638
644
|
components: {
|
|
639
|
-
DayButton:
|
|
640
|
-
Chevron:
|
|
645
|
+
DayButton: ke,
|
|
646
|
+
Chevron: je,
|
|
641
647
|
...r
|
|
642
648
|
},
|
|
643
649
|
...a
|
|
@@ -645,12 +651,12 @@ function Ne({ captionLayout: e = "label", className: t, classNames: n, component
|
|
|
645
651
|
}
|
|
646
652
|
//#endregion
|
|
647
653
|
//#region src/package/rangeflow/components/Popover/index.tsx
|
|
648
|
-
var
|
|
654
|
+
var Ne = n(({ align: e = "center", className: t, sideOffset: n = 6, children: r, ...i }) => /* @__PURE__ */ m(O.Portal, { children: /* @__PURE__ */ m(O.Content, {
|
|
649
655
|
asChild: !0,
|
|
650
656
|
align: e,
|
|
651
657
|
sideOffset: n,
|
|
652
658
|
...i,
|
|
653
|
-
children: /* @__PURE__ */ m(
|
|
659
|
+
children: /* @__PURE__ */ m(C.div, {
|
|
654
660
|
animate: {
|
|
655
661
|
opacity: 1,
|
|
656
662
|
scale: 1,
|
|
@@ -668,15 +674,15 @@ var Pe = n(({ align: e = "center", className: t, sideOffset: n = 6, children: r,
|
|
|
668
674
|
damping: 32,
|
|
669
675
|
mass: .8
|
|
670
676
|
},
|
|
671
|
-
className:
|
|
677
|
+
className: x("rangeflow-date-picker-portal rangeflow-popover z-50 rounded-lg border border-(--rangeflow-border) bg-(--rangeflow-bg) p-2 text-(--rangeflow-text) shadow-md shadow-(color:--rangeflow-shadow-color) backdrop-blur-[10px] outline-none", t),
|
|
672
678
|
children: r
|
|
673
679
|
})
|
|
674
|
-
}) })),
|
|
680
|
+
}) })), Pe = O.Root, Fe = O.Trigger;
|
|
675
681
|
O.Anchor;
|
|
676
682
|
//#endregion
|
|
677
683
|
//#region src/package/rangeflow/components/PickerBar/CalendarPopover.tsx
|
|
678
|
-
function
|
|
679
|
-
let t = K((e) => e.update), n = K((e) => e.range), r = K((e) => e.selected_date), i = K((e) => e.disabled), a = K((e) => e.duration), o = K((e) => e.CalendarProps), { slider: { root: s } } =
|
|
684
|
+
function Ie({ children: e }) {
|
|
685
|
+
let t = K((e) => e.update), n = K((e) => e.range), r = K((e) => e.selected_date), i = K((e) => e.disabled), a = K((e) => e.duration), o = K((e) => e.CalendarProps), { slider: { root: s } } = q(), c = () => {
|
|
680
686
|
let e = d(n.from), t = d(n.to);
|
|
681
687
|
return d(r.from).isBefore(e) && (e = d(r.from).subtract(10, "day")), d(r.to).isAfter(t) && (t = d(r.to).add(10, "day")), {
|
|
682
688
|
from: e.toDate(),
|
|
@@ -692,18 +698,18 @@ function Le({ children: e }) {
|
|
|
692
698
|
t.range = e;
|
|
693
699
|
});
|
|
694
700
|
};
|
|
695
|
-
return /* @__PURE__ */ h(
|
|
701
|
+
return /* @__PURE__ */ h(Pe, {
|
|
696
702
|
modal: !0,
|
|
697
703
|
onOpenChange: (e) => {
|
|
698
704
|
e === !1 && l();
|
|
699
705
|
},
|
|
700
|
-
children: [/* @__PURE__ */ m(
|
|
706
|
+
children: [/* @__PURE__ */ m(Fe, {
|
|
701
707
|
className: "cursor-pointer",
|
|
702
708
|
children: e
|
|
703
|
-
}), /* @__PURE__ */ m(
|
|
709
|
+
}), /* @__PURE__ */ m(Ne, {
|
|
704
710
|
align: "start",
|
|
705
711
|
sideOffset: 10,
|
|
706
|
-
children: /* @__PURE__ */ m(
|
|
712
|
+
children: /* @__PURE__ */ m(Me, {
|
|
707
713
|
defaultMonth: r.from,
|
|
708
714
|
numberOfMonths: 2,
|
|
709
715
|
showOutsideDays: !1,
|
|
@@ -729,7 +735,7 @@ function Le({ children: e }) {
|
|
|
729
735
|
}
|
|
730
736
|
//#endregion
|
|
731
737
|
//#region src/package/rangeflow/icons/CalendarIcon.tsx
|
|
732
|
-
function
|
|
738
|
+
function Le() {
|
|
733
739
|
return /* @__PURE__ */ m("svg", {
|
|
734
740
|
fill: "none",
|
|
735
741
|
height: "15",
|
|
@@ -760,7 +766,7 @@ function $() {
|
|
|
760
766
|
}) : /* @__PURE__ */ h("div", {
|
|
761
767
|
className: "rangeflow-selected-date flex items-center gap-2 text-xs font-medium text-(--rangeflow-accent-text) select-none hover:opacity-90",
|
|
762
768
|
children: [
|
|
763
|
-
/* @__PURE__ */ m(
|
|
769
|
+
/* @__PURE__ */ m(Le, {}),
|
|
764
770
|
r,
|
|
765
771
|
/* @__PURE__ */ m("span", {
|
|
766
772
|
className: "text-(--rangeflow-text-faint)",
|
|
@@ -776,7 +782,7 @@ function Re() {
|
|
|
776
782
|
let e = K((e) => e.calendar), { RangeTabs: n } = G();
|
|
777
783
|
return /* @__PURE__ */ h("div", {
|
|
778
784
|
className: "flex h-full items-center justify-between px-2",
|
|
779
|
-
children: [e ? /* @__PURE__ */ m(
|
|
785
|
+
children: [e ? /* @__PURE__ */ m(Ie, { children: /* @__PURE__ */ m($, {}) }) : /* @__PURE__ */ m($, {}), n ? t(n) : /* @__PURE__ */ m(Oe, {})]
|
|
780
786
|
});
|
|
781
787
|
}
|
|
782
788
|
//#endregion
|
|
@@ -787,7 +793,7 @@ function ze() {
|
|
|
787
793
|
//#endregion
|
|
788
794
|
//#region src/package/rangeflow/hooks/use-emit-date-change.ts
|
|
789
795
|
function Be() {
|
|
790
|
-
let e =
|
|
796
|
+
let e = X(), { onChange: t } = ze();
|
|
791
797
|
o(() => e.subscribe((e, n) => {
|
|
792
798
|
e.selected_date !== n.selected_date && t(e.selected_date);
|
|
793
799
|
}), [e, t]);
|
|
@@ -802,7 +808,7 @@ function Ve() {
|
|
|
802
808
|
children: /* @__PURE__ */ m(Re, {})
|
|
803
809
|
}), /* @__PURE__ */ m("div", {
|
|
804
810
|
className: "rangeflow-body mx-2",
|
|
805
|
-
children: /* @__PURE__ */ m(
|
|
811
|
+
children: /* @__PURE__ */ m(Ee, {})
|
|
806
812
|
})]
|
|
807
813
|
});
|
|
808
814
|
}
|