rangeflow 1.0.4 → 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.
Files changed (2) hide show
  1. package/dist/index.js +209 -203
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,46 +1,46 @@
1
- import { createContext as e, createElement as t, memo as n, startTransition as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
2
- import u from "dayjs";
3
- import { immer as d } from "zustand/middleware/immer";
4
- import { createStore as f } from "zustand/vanilla";
5
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
6
- import { RestrictToHorizontalAxis as h, restrictShapeToBoundingRectangle as g } from "@dnd-kit/abstract/modifiers";
7
- import { DragDropProvider as _, DragOverlay as v, useDragDropMonitor as ee, useDraggable as te } from "@dnd-kit/react";
8
- import y, { clsx as b } from "clsx";
9
- import { AnimatePresence as ne, motion as x } from "motion/react";
10
- import { useStore as re } from "zustand";
11
- import { KeyboardSensor as ie, PointerSensor as ae } from "@dnd-kit/dom";
12
- import { Group as oe, Panel as S, Separator as C } from "react-resizable-panels";
13
- import { Modifier as w, configurator as T } from "@dnd-kit/abstract";
1
+ import { createContext as e, createElement as t, memo as n, startTransition as r, useCallback as i, useContext as a, useEffect as o, useId as s, useMemo as c, useRef as l, useState as u } from "react";
2
+ import d from "dayjs";
3
+ import { immer as f } from "zustand/middleware/immer";
4
+ import { createStore as p } from "zustand/vanilla";
5
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
6
+ import { RestrictToHorizontalAxis as g, restrictShapeToBoundingRectangle as _ } from "@dnd-kit/abstract/modifiers";
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
14
  import { Rectangle as E } from "@dnd-kit/geometry";
15
- import { effect as se, signal as D } from "@dnd-kit/state";
16
- import { DayPicker as ce } from "react-day-picker";
15
+ import { effect as ce, signal as D } from "@dnd-kit/state";
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
19
- var le = [
19
+ var ue = [
20
20
  {
21
21
  label: "2 Weeks",
22
- from: u().subtract(1, "weeks").toDate(),
23
- to: u().add(1, "weeks").toDate()
22
+ from: d().subtract(1, "weeks").toDate(),
23
+ to: d().add(1, "weeks").toDate()
24
24
  },
25
25
  {
26
26
  label: "30 Days",
27
- from: u().subtract(15, "day").toDate(),
28
- to: u().add(15, "day").toDate()
27
+ from: d().subtract(15, "day").toDate(),
28
+ to: d().add(15, "day").toDate()
29
29
  },
30
30
  {
31
31
  label: "90 Days",
32
- from: u().subtract(45, "day").toDate(),
33
- to: u().add(45, "day").toDate()
32
+ from: d().subtract(45, "day").toDate(),
33
+ to: d().add(45, "day").toDate()
34
34
  },
35
35
  {
36
36
  label: "6 Months",
37
- from: u().subtract(3, "months").toDate(),
38
- to: u().add(3, "months").toDate()
37
+ from: d().subtract(3, "months").toDate(),
38
+ to: d().add(3, "months").toDate()
39
39
  },
40
40
  {
41
41
  label: "1 Year",
42
- from: u().subtract(6, "months").toDate(),
43
- to: u().add(6, "months").toDate()
42
+ from: d().subtract(6, "months").toDate(),
43
+ to: d().add(6, "months").toDate()
44
44
  }
45
45
  ], k = "left-spacer", A = "right-spacer", j = "slider-track-thumb";
46
46
  //#endregion
@@ -60,11 +60,11 @@ function N(e, t) {
60
60
  //#region src/package/rangeflow/utils/create-slider-values.ts
61
61
  var P = N([1, 100], [5, 100]);
62
62
  function F(e, t) {
63
- let n = u(e.from).startOf("day"), r = u(e.to).startOf("day").diff(n, "day"), i = u(t.from).startOf("day"), a = u(t.to).startOf("day"), o = Math.max(i.diff(n, "day"), 0), s = Math.max(a.diff(i, "day"), 0) * 100 / r, c = o * 100 / r, l = Math.max(P(s), 5), d = M(c - (l - s), 0, Math.max(100 - l, 0));
63
+ let n = d(e.from).startOf("day"), r = d(e.to).startOf("day").diff(n, "day"), i = d(t.from).startOf("day"), a = d(t.to).startOf("day"), o = Math.max(i.diff(n, "day"), 0), s = Math.max(a.diff(i, "day"), 0) * 100 / r, c = o * 100 / r, l = Math.max(P(s), 5), u = M(c - (l - s), 0, Math.max(100 - l, 0));
64
64
  return {
65
65
  size: l,
66
- left: d,
67
- right: Math.max(100 - d - l, 0)
66
+ left: u,
67
+ right: Math.max(100 - u - l, 0)
68
68
  };
69
69
  }
70
70
  //#endregion
@@ -85,33 +85,33 @@ function I(e, t, n) {
85
85
  //#endregion
86
86
  //#region src/package/rangeflow/context/hooks/use-context-events.ts
87
87
  function L({ onChange: e }) {
88
- let t = c({ onChange: e });
88
+ let t = l({ onChange: e });
89
89
  return o(() => {
90
90
  t.current.onChange = e;
91
- }), s(() => ({ onChange: (e) => t.current.onChange?.(e) }), []);
91
+ }), c(() => ({ onChange: (e) => t.current.onChange?.(e) }), []);
92
92
  }
93
93
  //#endregion
94
94
  //#region src/package/rangeflow/context/hooks/use-context-refs.ts
95
95
  function R() {
96
- let e = c(null);
97
- return s(() => ({ slider: { root: e } }), []);
96
+ let e = l(null);
97
+ return c(() => ({ slider: { root: e } }), []);
98
98
  }
99
99
  //#endregion
100
100
  //#region src/package/rangeflow/context/hooks/use-context-slots.ts
101
101
  function z(e) {
102
- return s(() => ({ ...e }), [e]);
102
+ return c(() => ({ ...e }), [e]);
103
103
  }
104
104
  //#endregion
105
105
  //#region src/package/rangeflow/context/root.ts
106
- var B = (e) => f()(d((t) => ({
106
+ var B = (e) => p()(f((t) => ({
107
107
  ...e,
108
108
  update: (e) => t(e),
109
109
  reset: () => t(() => structuredClone(e))
110
110
  }))), V = e(null);
111
111
  //#endregion
112
112
  //#region src/package/rangeflow/context/ContextProvider.tsx
113
- function H({ children: e, defaultRange: t, defaultSelected: n, disabled: r, duration: i, calendar: a = !0, ranges: o = le, CalendarProps: c, Slots: u, api: d, onChange: f }) {
114
- let m = R(), h = L({ onChange: f }), g = z(u), [_] = l(() => B({
113
+ function H({ children: e, defaultRange: t, defaultSelected: n, disabled: r, duration: i, calendar: a = !0, ranges: o = ue, CalendarProps: s, Slots: l, api: d, onChange: f }) {
114
+ let p = R(), h = L({ onChange: f }), g = z(l), [_] = u(() => B({
115
115
  ranges: o,
116
116
  disabled: r,
117
117
  duration: i,
@@ -120,40 +120,40 @@ function H({ children: e, defaultRange: t, defaultSelected: n, disabled: r, dura
120
120
  default_range: t,
121
121
  selected_date: n,
122
122
  slider: F(t, n),
123
- CalendarProps: c
123
+ CalendarProps: s
124
124
  }));
125
- I(_, m, d);
126
- let v = s(() => ({
125
+ I(_, p, d);
126
+ let v = c(() => ({
127
127
  store: _,
128
128
  events: h,
129
- refs: m,
129
+ refs: p,
130
130
  slots: g
131
131
  }), [
132
132
  _,
133
133
  h,
134
- m,
134
+ p,
135
135
  g
136
136
  ]);
137
- return /* @__PURE__ */ p(V.Provider, {
137
+ return /* @__PURE__ */ m(V.Provider, {
138
138
  value: v,
139
139
  children: e
140
140
  });
141
141
  }
142
142
  //#endregion
143
143
  //#region src/package/rangeflow/animations/OdometerText.tsx
144
- var U = n(({ children: e, className: t }) => /* @__PURE__ */ p("span", {
145
- className: y("inline-flex tabular-nums", t),
144
+ var U = n(({ children: e, className: t }) => /* @__PURE__ */ m("span", {
145
+ className: x("inline-flex tabular-nums", t),
146
146
  children: [...e].map((e, t) => {
147
147
  let n = e === " " ? "\xA0" : e;
148
- return /* @__PURE__ */ m("span", {
148
+ return /* @__PURE__ */ h("span", {
149
149
  className: "relative inline-block overflow-hidden leading-none",
150
- children: [/* @__PURE__ */ p("span", {
150
+ children: [/* @__PURE__ */ m("span", {
151
151
  className: "invisible",
152
152
  children: n
153
- }), /* @__PURE__ */ p(ne, {
153
+ }), /* @__PURE__ */ m(te, {
154
154
  initial: !1,
155
155
  mode: "popLayout",
156
- children: /* @__PURE__ */ p(x.span, {
156
+ children: /* @__PURE__ */ m(C.span, {
157
157
  animate: {
158
158
  y: 0,
159
159
  filter: "blur(0px)",
@@ -189,7 +189,7 @@ var U = n(({ children: e, className: t }) => /* @__PURE__ */ p("span", {
189
189
  //#endregion
190
190
  //#region src/package/rangeflow/hooks/use-days-in-range.ts
191
191
  function W(e) {
192
- return s(() => u(e.to).diff(u(e.from), "day"), [e.from, e.to]);
192
+ return c(() => d(e.to).diff(d(e.from), "day"), [e.from, e.to]);
193
193
  }
194
194
  //#endregion
195
195
  //#region src/package/rangeflow/hooks/use-rangeflow-slots.ts
@@ -199,19 +199,19 @@ function G() {
199
199
  //#endregion
200
200
  //#region src/package/rangeflow/hooks/use-rangeflow-store.ts
201
201
  function K(e) {
202
- return re(a(V).store, e);
202
+ return ne(a(V).store, e);
203
203
  }
204
204
  //#endregion
205
205
  //#region src/package/rangeflow/components/DateSlider/DateLabelsTrack.tsx
206
- function ue(e) {
206
+ function de(e) {
207
207
  return e > 120 ? "MMM YYYY" : e > 7 ? "MMM DD" : "ddd DD";
208
208
  }
209
- function de(e) {
209
+ function fe(e) {
210
210
  return e > 120 ? 8 : e > 30 ? 10 : e > 7 ? 8 : Math.min(e + 1, 8);
211
211
  }
212
- var fe = n(() => {
213
- let e = K((e) => e.range), n = W(e), { DateLabelsTrack: r } = G(), i = s(() => {
214
- let t = ue(n), r = de(n), i = u(e.from), a = u(e.to).diff(i);
212
+ var pe = n(() => {
213
+ let e = K((e) => e.range), n = W(e), { DateLabelsTrack: r } = G(), i = c(() => {
214
+ let t = de(n), r = fe(n), i = d(e.from), a = d(e.to).diff(i);
215
215
  return Array.from({ length: r }, (e, n) => {
216
216
  let o = n / (r - 1);
217
217
  return i.add(a * o, "ms").format(t);
@@ -221,24 +221,29 @@ var fe = n(() => {
221
221
  e.to,
222
222
  n
223
223
  ]);
224
- return r ? t(r) : /* @__PURE__ */ p("div", {
225
- className: y("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
- children: i.map((e, t) => /* @__PURE__ */ p(U, {
227
- className: y("rangeflow-label", { "font-medium text-(--rangeflow-text-muted)": t === 0 || t === i.length - 1 }),
224
+ return r ? t(r) : /* @__PURE__ */ m("div", {
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
+ children: i.map((e, t) => /* @__PURE__ */ m(U, {
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
- function pe() {
235
- return /* @__PURE__ */ p("svg", {
239
+ function me() {
240
+ return /* @__PURE__ */ m("svg", {
236
241
  fill: "none",
237
242
  height: "15",
238
243
  viewBox: "0 0 15 15",
239
244
  width: "15",
240
245
  xmlns: "http://www.w3.org/2000/svg",
241
- children: /* @__PURE__ */ p("path", {
246
+ children: /* @__PURE__ */ m("path", {
242
247
  clipRule: "evenodd",
243
248
  d: "M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z",
244
249
  fill: "currentColor",
@@ -248,14 +253,14 @@ function pe() {
248
253
  }
249
254
  //#endregion
250
255
  //#region src/package/rangeflow/icons/DoubleChevronRightIcon.tsx
251
- function me() {
252
- return /* @__PURE__ */ p("svg", {
256
+ function he() {
257
+ return /* @__PURE__ */ m("svg", {
253
258
  fill: "none",
254
259
  height: "15",
255
260
  viewBox: "0 0 15 15",
256
261
  width: "15",
257
262
  xmlns: "http://www.w3.org/2000/svg",
258
- children: /* @__PURE__ */ p("path", {
263
+ children: /* @__PURE__ */ m("path", {
259
264
  clipRule: "evenodd",
260
265
  d: "M2.14645 11.1464C1.95118 11.3417 1.95118 11.6583 2.14645 11.8536C2.34171 12.0488 2.65829 12.0488 2.85355 11.8536L6.85355 7.85355C7.04882 7.65829 7.04882 7.34171 6.85355 7.14645L2.85355 3.14645C2.65829 2.95118 2.34171 2.95118 2.14645 3.14645C1.95118 3.34171 1.95118 3.65829 2.14645 3.85355L5.79289 7.5L2.14645 11.1464ZM8.14645 11.1464C7.95118 11.3417 7.95118 11.6583 8.14645 11.8536C8.34171 12.0488 8.65829 12.0488 8.85355 11.8536L12.8536 7.85355C13.0488 7.65829 13.0488 7.34171 12.8536 7.14645L8.85355 3.14645C8.65829 2.95118 8.34171 2.95118 8.14645 3.14645C7.95118 3.34171 7.95118 3.65829 8.14645 3.85355L11.7929 7.5L8.14645 11.1464Z",
261
266
  fill: "currentColor",
@@ -265,20 +270,20 @@ function me() {
265
270
  }
266
271
  //#endregion
267
272
  //#region src/package/rangeflow/components/DateSlider/DateTickers.tsx
268
- var he = n(() => {
273
+ var J = n(() => {
269
274
  let { DateTickers: e } = G(), n = Math.min(Math.max(70, W(K((e) => e.range))), 100);
270
- return e ? t(e) : /* @__PURE__ */ p("div", {
275
+ return e ? t(e) : /* @__PURE__ */ m("div", {
271
276
  className: "rangeflow-tickers flex items-center gap-2",
272
- children: /* @__PURE__ */ p("div", {
277
+ children: /* @__PURE__ */ m("div", {
273
278
  className: "flex w-full justify-between",
274
- children: Array.from({ length: n }).map((e, t) => /* @__PURE__ */ p("div", { className: "rangeflow-ticker h-3 w-0.5 rounded-xs bg-(--rangeflow-ticker)" }, t))
279
+ children: Array.from({ length: n }).map((e, t) => /* @__PURE__ */ m("div", { className: "rangeflow-ticker h-3 w-0.5 rounded-xs bg-(--rangeflow-ticker)" }, t))
275
280
  })
276
281
  });
277
282
  });
278
283
  //#endregion
279
284
  //#region src/package/rangeflow/components/DateSlider/RangeStepButton.tsx
280
- function q({ children: e, onClick: t }) {
281
- return /* @__PURE__ */ p(x.span, {
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,
@@ -289,24 +294,24 @@ function q({ children: e, onClick: t }) {
289
294
  //#region src/package/rangeflow/utils/derive-selection-from-layout.ts
290
295
  var ge = N([5, 100], [1, 100]);
291
296
  function _e(e, t) {
292
- let n = e[j], r = e[k], i = e[A], a = u(t.from).startOf("day"), o = u(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), d = M(Math.round(c * o / 100), 0, Math.max(o - l, 0));
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,
296
301
  right: i,
297
- from: a.add(d, "day").toDate(),
298
- to: a.add(d + l, "day").toDate()
302
+ from: a.add(u, "day").toDate(),
303
+ to: a.add(u + l, "day").toDate()
299
304
  };
300
305
  }
301
306
  //#endregion
302
307
  //#region src/package/rangeflow/hooks/use-rangeflow-store-api.ts
303
- function J() {
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 Y() {
309
- let e = J();
313
+ function Z() {
314
+ let e = X();
310
315
  return i((t) => {
311
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) => {
@@ -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
327
  function ve() {
328
- let e = K((e) => e.slider.left), [t] = l(() => e);
329
- return /* @__PURE__ */ p(S, {
328
+ let e = K((e) => e.slider.left), [t] = u(() => e);
329
+ return /* @__PURE__ */ m(w, {
330
330
  className: "focus:outline-none",
331
331
  defaultSize: `${t}%`,
332
332
  id: k,
@@ -337,8 +337,8 @@ function ve() {
337
337
  //#endregion
338
338
  //#region src/package/rangeflow/components/DateSlider/Slider/SliderRightSpacer.tsx
339
339
  function ye() {
340
- let e = K((e) => e.slider.right), [t] = l(() => e);
341
- return /* @__PURE__ */ p(S, {
340
+ let e = K((e) => e.slider.right), [t] = u(() => e);
341
+ return /* @__PURE__ */ m(w, {
342
342
  className: "focus:outline-none",
343
343
  defaultSize: `${t}%`,
344
344
  id: A,
@@ -349,32 +349,32 @@ function ye() {
349
349
  //#endregion
350
350
  //#region src/package/rangeflow/components/DateSlider/SliderValue.tsx
351
351
  var be = n(() => {
352
- let { SliderValueLabel: e } = G(), n = K((e) => e.slider.size), r = K((e) => e.selected_date), i = s(() => {
353
- let e = Math.max(u(r.to).diff(r.from, "day"), 1);
352
+ let { SliderValueLabel: e } = G(), n = K((e) => e.slider.size), r = K((e) => e.selected_date), i = c(() => {
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`;
355
355
  }, [
356
356
  r.from,
357
357
  r.to,
358
358
  n
359
359
  ]);
360
- return /* @__PURE__ */ p("div", {
360
+ return /* @__PURE__ */ m("div", {
361
361
  "data-track-handle": "true",
362
- className: y("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)"),
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
- }), Z = N([1, 100], [5, 100]);
365
+ }), Q = N([1, 100], [5, 100]);
366
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] = l(() => t), a = n?.min ? Math.min(Z(n.min * 100 / r), 100) : 5, o = n?.max ? Math.min(Z(n.max * 100 / r), 100) : 100;
368
- return /* @__PURE__ */ p(S, {
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,
372
372
  maxSize: `${o}%`,
373
373
  minSize: `${a}%`,
374
- children: /* @__PURE__ */ p("div", {
374
+ children: /* @__PURE__ */ m("div", {
375
375
  "data-track-handle-container": "",
376
- className: y("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__ */ p(be, {})
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
  }
@@ -382,11 +382,11 @@ function xe({ onHandleRef: e }) {
382
382
  //#region src/package/rangeflow/components/DateSlider/Slider/index.tsx
383
383
  var Se = (e, t, n) => !!e?.querySelector("[data-separator=\"active\"]") && t["slider-track-thumb"] === n["slider-track-thumb"];
384
384
  function Ce({ onHandleRef: e }) {
385
- let t = Y(), { slider: { root: n } } = X(), i = c(null), a = c(null), o = c(null), s = b("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: l } = te({
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: [ae.configure({ preventActivation: (e) => !(e.target instanceof HTMLDivElement) || !e.target.dataset.trackHandle }), ie]
387
+ sensors: [ie.configure({ preventActivation: (e) => !(e.target instanceof HTMLDivElement) || !e.target.dataset.trackHandle }), re]
388
388
  });
389
- return ee({
389
+ return b({
390
390
  onDragStart: () => {
391
391
  a.current = n.current?.getLayout() ?? null;
392
392
  },
@@ -402,10 +402,10 @@ function Ce({ onHandleRef: e }) {
402
402
  onDragEnd: () => {
403
403
  a.current = null;
404
404
  }
405
- }), /* @__PURE__ */ p("div", {
406
- ref: l,
407
- className: b("absolute top-[50%] left-0 z-1 -translate-y-[50%]", "h-7 w-full"),
408
- children: /* @__PURE__ */ m(oe, {
405
+ }), /* @__PURE__ */ m("div", {
406
+ ref: c,
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,
@@ -420,11 +420,11 @@ function Ce({ onHandleRef: e }) {
420
420
  });
421
421
  },
422
422
  children: [
423
- /* @__PURE__ */ p(ve, {}),
424
- /* @__PURE__ */ p(C, { className: s }),
425
- /* @__PURE__ */ p(xe, { onHandleRef: e }),
426
- /* @__PURE__ */ p(C, { className: s }),
427
- /* @__PURE__ */ p(ye, {})
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
  });
@@ -432,42 +432,48 @@ function Ce({ onHandleRef: e }) {
432
432
  //#endregion
433
433
  //#region src/package/rangeflow/components/DateSlider/SliderTrack.tsx
434
434
  function we({ onHandleRef: e }) {
435
- let t = K((e) => e.update), n = K((e) => e.range), r = W(n), i = K((e) => e.disabled?.before), a = K((e) => e.disabled?.after), o = s(() => !i || u(n.from).isAfter(i), [n.from, i]), c = s(() => !a || u(n.to).isBefore(a), [n.to, a]);
436
- return /* @__PURE__ */ m("div", {
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
+ };
442
+ return /* @__PURE__ */ h("div", {
437
443
  className: "flex items-center select-none",
438
444
  children: [
439
- o ? /* @__PURE__ */ p(q, {
445
+ s ? /* @__PURE__ */ m(Y, {
440
446
  onClick: () => {
441
447
  t((e) => {
442
- let t = u(e.range.from).subtract(r / 2, "day");
443
- e.range.from = i && t.isBefore(i) ? u(i).toDate() : t.toDate();
448
+ let t = d(e.range.from).subtract(r / 2, "day");
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
- children: /* @__PURE__ */ p(pe, {})
452
+ children: /* @__PURE__ */ m(me, {})
447
453
  }) : null,
448
- /* @__PURE__ */ m("div", {
454
+ /* @__PURE__ */ h("div", {
449
455
  className: "relative flex-1 px-2",
450
- children: [/* @__PURE__ */ p(Ce, { onHandleRef: e }), /* @__PURE__ */ p(he, {})]
456
+ children: [/* @__PURE__ */ m(Ce, { onHandleRef: e }), /* @__PURE__ */ m(J, {})]
451
457
  }),
452
- c ? /* @__PURE__ */ p(q, {
458
+ l ? /* @__PURE__ */ m(Y, {
453
459
  onClick: () => {
454
460
  t((e) => {
455
- let t = u(e.range.to).add(r / 2, "day");
456
- e.range.to = a && t.isAfter(a) ? u(a).toDate() : t.toDate();
461
+ let t = d(e.range.to).add(r / 2, "day");
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
- children: /* @__PURE__ */ p(me, {})
465
+ children: /* @__PURE__ */ m(he, {})
460
466
  }) : null
461
467
  ]
462
468
  });
463
469
  }
464
470
  //#endregion
465
471
  //#region src/package/rangeflow/components/DateSlider/utils/restrict-inner-to-element.ts
466
- var Te = class e extends w {
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 = se(() => {
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,26 +485,26 @@ var Te = class e extends w {
479
485
  }
480
486
  apply({ transform: e }) {
481
487
  let t = this.innerRect.value, n = this.containerRect.value;
482
- return !t || !n ? e : g(new E(t.left, t.top, t.width, t.height), e, n);
488
+ return !t || !n ? e : _(new E(t.left, t.top, t.width, t.height), e, n);
483
489
  }
484
- static configure = T(e);
490
+ static configure = se(e);
485
491
  };
486
492
  //#endregion
487
493
  //#region src/package/rangeflow/components/DateSlider/index.tsx
488
494
  function Ee() {
489
- let [e, t] = l(null), [n, r] = l(null);
490
- return /* @__PURE__ */ p("div", {
495
+ let [e, t] = u(null), [n, r] = u(null);
496
+ return /* @__PURE__ */ m("div", {
491
497
  ref: t,
492
498
  className: "rangeflow-slider relative my-8 h-3 w-full px-2",
493
- children: /* @__PURE__ */ m(_, {
499
+ children: /* @__PURE__ */ h(v, {
494
500
  modifiers: [Te.configure({
495
501
  inner: n,
496
502
  container: e
497
- }), h],
503
+ }), g],
498
504
  children: [
499
- /* @__PURE__ */ p(we, { onHandleRef: r }),
500
- /* @__PURE__ */ p(fe, {}),
501
- /* @__PURE__ */ p(v, { children: null })
505
+ /* @__PURE__ */ m(we, { onHandleRef: r }),
506
+ /* @__PURE__ */ m(pe, {}),
507
+ /* @__PURE__ */ m(y, { children: null })
502
508
  ]
503
509
  })
504
510
  });
@@ -506,7 +512,7 @@ function Ee() {
506
512
  //#endregion
507
513
  //#region src/package/rangeflow/components/RangeTabs/hooks/use-apply-slider-layout.ts
508
514
  function De() {
509
- let e = Y(), t = K((e) => e.range.from.getTime()), n = K((e) => e.range.to.getTime()), { slider: { root: i } } = X();
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());
@@ -522,60 +528,60 @@ function De() {
522
528
  //#region src/package/rangeflow/components/RangeTabs/index.tsx
523
529
  function Oe() {
524
530
  De();
525
- let e = K((e) => e.ranges), t = K((e) => e.update), n = K((e) => e.range.from), r = K((e) => e.range.to), i = K((e) => e.disabled?.before), a = K((e) => e.disabled?.after), o = s(() => e.filter((e) => !(i && u(e.from).isBefore(i, "day") || a && u(e.to).isAfter(a, "day"))), [
526
- e,
527
- i,
528
- a
529
- ]), c = s(() => o.findIndex((e) => u(e.from).isSame(n, "day") && u(e.to).isSame(r, "day")), [
530
- o,
531
- n,
532
- r
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"))), [
532
+ t,
533
+ a,
534
+ o
535
+ ]), u = c(() => l.findIndex((e) => d(e.from).isSame(r, "day") && d(e.to).isSame(i, "day")), [
536
+ l,
537
+ r,
538
+ i
533
539
  ]);
534
- return /* @__PURE__ */ p("div", {
540
+ return /* @__PURE__ */ m("div", {
535
541
  className: "rangeflow-tabs flex items-center justify-center select-none",
536
- children: /* @__PURE__ */ p("div", {
542
+ children: /* @__PURE__ */ m("div", {
537
543
  className: "relative flex items-center overflow-hidden",
538
- children: o.map((e, n) => /* @__PURE__ */ m("button", {
539
- "data-active": c === n || void 0,
540
- className: y("rangeflow-tab relative z-1 flex items-center px-1.5 py-1 focus:outline-none"),
544
+ children: l.map((t, r) => /* @__PURE__ */ h("button", {
545
+ "data-active": u === r || void 0,
546
+ className: x("rangeflow-tab relative z-1 flex items-center px-1.5 py-1 focus:outline-none"),
541
547
  onClick: () => {
542
- t((t) => {
543
- t.range.from = e.from, t.range.to = e.to;
548
+ n((e) => {
549
+ e.range.from = t.from, e.range.to = t.to;
544
550
  });
545
551
  },
546
- children: [/* @__PURE__ */ p("span", {
547
- className: y("relative z-1 text-xs tracking-tight text-(--rangeflow-text-muted)", { "font-medium text-(--rangeflow-text)": c === n }),
548
- children: e.label
549
- }), c === n && /* @__PURE__ */ p(x.div, {
552
+ children: [/* @__PURE__ */ m("span", {
553
+ className: x("relative z-1 text-xs tracking-tight text-(--rangeflow-text-muted)", { "font-medium text-(--rangeflow-text)": u === r }),
554
+ children: t.label
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
- layoutId: "tab-indicator",
558
+ layoutId: e,
553
559
  transition: {
554
560
  type: "spring",
555
561
  stiffness: 200,
556
562
  damping: 25
557
563
  }
558
564
  })]
559
- }, `${e.from.getTime()}_${e.to.getTime()}`))
565
+ }, `${t.from.getTime()}_${t.to.getTime()}`))
560
566
  })
561
567
  });
562
568
  }
563
569
  //#endregion
564
570
  //#region src/package/rangeflow/components/Calendar/CalendarDayButton.tsx
565
571
  function ke({ className: e, day: t, modifiers: n, ...r }) {
566
- let i = c(null);
572
+ let i = l(null);
567
573
  o(() => {
568
574
  n.focused && i.current?.focus();
569
575
  }, [n.focused]);
570
576
  let a = n.selected && !n.range_start && !n.range_middle && !n.range_end;
571
- return /* @__PURE__ */ p("button", {
577
+ return /* @__PURE__ */ m("button", {
572
578
  ref: i,
573
579
  "data-range-end": n.range_end || void 0,
574
580
  "data-range-middle": n.range_middle || void 0,
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: y("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),
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
  }
@@ -588,9 +594,9 @@ var Ae = {
588
594
  right: "-rotate-90"
589
595
  };
590
596
  function je({ className: e, orientation: t = "down", size: n = 16 }) {
591
- return /* @__PURE__ */ p("svg", {
597
+ return /* @__PURE__ */ m("svg", {
592
598
  "aria-hidden": "true",
593
- className: y("shrink-0", Ae[t], e),
599
+ className: x("shrink-0", Ae[t], e),
594
600
  fill: "none",
595
601
  height: n,
596
602
  stroke: "currentColor",
@@ -599,26 +605,26 @@ function je({ className: e, orientation: t = "down", size: n = 16 }) {
599
605
  strokeWidth: 2,
600
606
  viewBox: "0 0 24 24",
601
607
  width: n,
602
- children: /* @__PURE__ */ p("path", { d: "m6 9 6 6 6-6" })
608
+ children: /* @__PURE__ */ m("path", { d: "m6 9 6 6 6-6" })
603
609
  });
604
610
  }
605
611
  //#endregion
606
612
  //#region src/package/rangeflow/components/Calendar/index.tsx
607
613
  function Me({ captionLayout: e = "label", className: t, classNames: n, components: r, showOutsideDays: i = !0, ...a }) {
608
- return /* @__PURE__ */ p(ce, {
614
+ return /* @__PURE__ */ m(le, {
609
615
  captionLayout: e,
610
- className: y("rangeflow-calendar w-fit p-3 select-none", t),
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: y("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"),
617
- button_next: y("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"),
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: y("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)"),
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",
@@ -645,12 +651,12 @@ function Me({ 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 Ne = n(({ align: e = "center", className: t, sideOffset: n = 6, children: r, ...i }) => /* @__PURE__ */ p(O.Portal, { children: /* @__PURE__ */ p(O.Content, {
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__ */ p(x.div, {
659
+ children: /* @__PURE__ */ m(C.div, {
654
660
  animate: {
655
661
  opacity: 1,
656
662
  scale: 1,
@@ -668,17 +674,17 @@ var Ne = n(({ align: e = "center", className: t, sideOffset: n = 6, children: r,
668
674
  damping: 32,
669
675
  mass: .8
670
676
  },
671
- className: y("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),
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 Q({ children: e }) {
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 } } = X(), c = () => {
680
- let e = u(n.from), t = u(n.to);
681
- return u(r.from).isBefore(e) && (e = u(r.from).subtract(10, "day")), u(r.to).isAfter(t) && (t = u(r.to).add(10, "day")), {
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 = () => {
686
+ let e = d(n.from), t = d(n.to);
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(),
683
689
  to: t.toDate()
684
690
  };
@@ -692,18 +698,18 @@ function Q({ children: e }) {
692
698
  t.range = e;
693
699
  });
694
700
  };
695
- return /* @__PURE__ */ m(Pe, {
701
+ return /* @__PURE__ */ h(Pe, {
696
702
  modal: !0,
697
703
  onOpenChange: (e) => {
698
704
  e === !1 && l();
699
705
  },
700
- children: [/* @__PURE__ */ p(Fe, {
706
+ children: [/* @__PURE__ */ m(Fe, {
701
707
  className: "cursor-pointer",
702
708
  children: e
703
- }), /* @__PURE__ */ p(Ne, {
709
+ }), /* @__PURE__ */ m(Ne, {
704
710
  align: "start",
705
711
  sideOffset: 10,
706
- children: /* @__PURE__ */ p(Me, {
712
+ children: /* @__PURE__ */ m(Me, {
707
713
  defaultMonth: r.from,
708
714
  numberOfMonths: 2,
709
715
  showOutsideDays: !1,
@@ -715,7 +721,7 @@ function Q({ children: e }) {
715
721
  selected: r,
716
722
  onSelect: (e) => {
717
723
  if (!e?.from || !e?.to) return;
718
- let n = u(e.from).startOf("day"), r = u(e.to).startOf("day"), i = {
724
+ let n = d(e.from).startOf("day"), r = d(e.to).startOf("day"), i = {
719
725
  from: n.toDate(),
720
726
  to: r.toDate()
721
727
  };
@@ -729,14 +735,14 @@ function Q({ children: e }) {
729
735
  }
730
736
  //#endregion
731
737
  //#region src/package/rangeflow/icons/CalendarIcon.tsx
732
- function Ie() {
733
- return /* @__PURE__ */ p("svg", {
738
+ function Le() {
739
+ return /* @__PURE__ */ m("svg", {
734
740
  fill: "none",
735
741
  height: "15",
736
742
  viewBox: "0 0 15 15",
737
743
  width: "15",
738
744
  xmlns: "http://www.w3.org/2000/svg",
739
- children: /* @__PURE__ */ p("path", {
745
+ children: /* @__PURE__ */ m("path", {
740
746
  clipRule: "evenodd",
741
747
  d: "M4.5 1C4.77614 1 5 1.22386 5 1.5V2H10V1.5C10 1.22386 10.2239 1 10.5 1C10.7761 1 11 1.22386 11 1.5V2H12.5C13.3284 2 14 2.67157 14 3.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V3.5C1 2.67157 1.67157 2 2.5 2H4V1.5C4 1.22386 4.22386 1 4.5 1ZM10 3V3.5C10 3.77614 10.2239 4 10.5 4C10.7761 4 11 3.77614 11 3.5V3H12.5C12.7761 3 13 3.22386 13 3.5V5H2V3.5C2 3.22386 2.22386 3 2.5 3H4V3.5C4 3.77614 4.22386 4 4.5 4C4.77614 4 5 3.77614 5 3.5V3H10ZM2 6V12.5C2 12.7761 2.22386 13 2.5 13H12.5C12.7761 13 13 12.7761 13 12.5V6H2ZM7 7.5C7 7.22386 7.22386 7 7.5 7C7.77614 7 8 7.22386 8 7.5C8 7.77614 7.77614 8 7.5 8C7.22386 8 7 7.77614 7 7.5ZM9.5 7C9.22386 7 9 7.22386 9 7.5C9 7.77614 9.22386 8 9.5 8C9.77614 8 10 7.77614 10 7.5C10 7.22386 9.77614 7 9.5 7ZM11 7.5C11 7.22386 11.2239 7 11.5 7C11.7761 7 12 7.22386 12 7.5C12 7.77614 11.7761 8 11.5 8C11.2239 8 11 7.77614 11 7.5ZM11.5 9C11.2239 9 11 9.22386 11 9.5C11 9.77614 11.2239 10 11.5 10C11.7761 10 12 9.77614 12 9.5C12 9.22386 11.7761 9 11.5 9ZM9 9.5C9 9.22386 9.22386 9 9.5 9C9.77614 9 10 9.22386 10 9.5C10 9.77614 9.77614 10 9.5 10C9.22386 10 9 9.77614 9 9.5ZM7.5 9C7.22386 9 7 9.22386 7 9.5C7 9.77614 7.22386 10 7.5 10C7.77614 10 8 9.77614 8 9.5C8 9.22386 7.77614 9 7.5 9ZM5 9.5C5 9.22386 5.22386 9 5.5 9C5.77614 9 6 9.22386 6 9.5C6 9.77614 5.77614 10 5.5 10C5.22386 10 5 9.77614 5 9.5ZM3.5 9C3.22386 9 3 9.22386 3 9.5C3 9.77614 3.22386 10 3.5 10C3.77614 10 4 9.77614 4 9.5C4 9.22386 3.77614 9 3.5 9ZM3 11.5C3 11.2239 3.22386 11 3.5 11C3.77614 11 4 11.2239 4 11.5C4 11.7761 3.77614 12 3.5 12C3.22386 12 3 11.7761 3 11.5ZM5.5 11C5.22386 11 5 11.2239 5 11.5C5 11.7761 5.22386 12 5.5 12C5.77614 12 6 11.7761 6 11.5C6 11.2239 5.77614 11 5.5 11ZM7 11.5C7 11.2239 7.22386 11 7.5 11C7.77614 11 8 11.2239 8 11.5C8 11.7761 7.77614 12 7.5 12C7.22386 12 7 11.7761 7 11.5ZM9.5 11C9.22386 11 9 11.2239 9 11.5C9 11.7761 9.22386 12 9.5 12C9.77614 12 10 11.7761 10 11.5C10 11.2239 9.77614 11 9.5 11Z",
742
748
  fill: "currentColor",
@@ -747,8 +753,8 @@ function Ie() {
747
753
  //#endregion
748
754
  //#region src/package/rangeflow/components/PickerBar/SelectedDate.tsx
749
755
  function $() {
750
- let e = K((e) => e.selected_date), { SelectedDate: n } = G(), { from: r, to: i } = s(() => {
751
- let t = u(), n = u(e.from), r = u(e.to), i = n.isSame(r, "year") ? "DD MMM" : "DD MMM YYYY", a = {
756
+ let e = K((e) => e.selected_date), { SelectedDate: n } = G(), { from: r, to: i } = c(() => {
757
+ let t = d(), n = d(e.from), r = d(e.to), i = n.isSame(r, "year") ? "DD MMM" : "DD MMM YYYY", a = {
752
758
  from: n.format(i),
753
759
  to: r.format(i)
754
760
  };
@@ -757,12 +763,12 @@ function $() {
757
763
  return n ? t(n, {
758
764
  from: r,
759
765
  to: i
760
- }) : /* @__PURE__ */ m("div", {
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__ */ p(Ie, {}),
769
+ /* @__PURE__ */ m(Le, {}),
764
770
  r,
765
- /* @__PURE__ */ p("span", {
771
+ /* @__PURE__ */ m("span", {
766
772
  className: "text-(--rangeflow-text-faint)",
767
773
  children: "—"
768
774
  }),
@@ -772,52 +778,52 @@ function $() {
772
778
  }
773
779
  //#endregion
774
780
  //#region src/package/rangeflow/components/PickerBar/index.tsx
775
- function Le() {
781
+ function Re() {
776
782
  let e = K((e) => e.calendar), { RangeTabs: n } = G();
777
- return /* @__PURE__ */ m("div", {
783
+ return /* @__PURE__ */ h("div", {
778
784
  className: "flex h-full items-center justify-between px-2",
779
- children: [e ? /* @__PURE__ */ p(Q, { children: /* @__PURE__ */ p($, {}) }) : /* @__PURE__ */ p($, {}), n ? t(n) : /* @__PURE__ */ p(Oe, {})]
785
+ children: [e ? /* @__PURE__ */ m(Ie, { children: /* @__PURE__ */ m($, {}) }) : /* @__PURE__ */ m($, {}), n ? t(n) : /* @__PURE__ */ m(Oe, {})]
780
786
  });
781
787
  }
782
788
  //#endregion
783
789
  //#region src/package/rangeflow/hooks/use-rangeflow-events.ts
784
- function Re() {
790
+ function ze() {
785
791
  return a(V).events;
786
792
  }
787
793
  //#endregion
788
794
  //#region src/package/rangeflow/hooks/use-emit-date-change.ts
789
- function ze() {
790
- let e = J(), { onChange: t } = Re();
795
+ function Be() {
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]);
794
800
  }
795
801
  //#endregion
796
802
  //#region src/package/rangeflow/Root.tsx
797
- function Be() {
798
- return ze(), /* @__PURE__ */ m("div", {
803
+ function Ve() {
804
+ return Be(), /* @__PURE__ */ h("div", {
799
805
  className: "rangeflow-date-picker rangeflow-root h-35 w-140 rounded-lg border border-(--rangeflow-border) bg-(--rangeflow-bg) text-(--rangeflow-text) shadow-md shadow-(color:--rangeflow-shadow-color)",
800
- children: [/* @__PURE__ */ p("div", {
806
+ children: [/* @__PURE__ */ m("div", {
801
807
  className: "rangeflow-header h-10 border-b border-(--rangeflow-border) p-2",
802
- children: /* @__PURE__ */ p(Le, {})
803
- }), /* @__PURE__ */ p("div", {
808
+ children: /* @__PURE__ */ m(Re, {})
809
+ }), /* @__PURE__ */ m("div", {
804
810
  className: "rangeflow-body mx-2",
805
- children: /* @__PURE__ */ p(Ee, {})
811
+ children: /* @__PURE__ */ m(Ee, {})
806
812
  })]
807
813
  });
808
814
  }
809
815
  //#endregion
810
816
  //#region src/package/rangeflow/index.tsx
811
- function Ve(e) {
812
- return /* @__PURE__ */ p(H, {
817
+ function He(e) {
818
+ return /* @__PURE__ */ m(H, {
813
819
  ...e,
814
- children: /* @__PURE__ */ p(Be, {})
820
+ children: /* @__PURE__ */ m(Ve, {})
815
821
  });
816
822
  }
817
823
  //#endregion
818
824
  //#region src/package/rangeflow/hooks/use-rangeflow.ts
819
- function He() {
820
- let e = c(null), t = c(null), n = i((n) => {
825
+ function Ue() {
826
+ let e = l(null), t = l(null), n = i((n) => {
821
827
  let r = e.current;
822
828
  if (!r) return;
823
829
  let { selected_date: i, update: a } = r.getState(), { size: o, left: s, right: c } = F(n, i);
@@ -852,4 +858,4 @@ function He() {
852
858
  };
853
859
  }
854
860
  //#endregion
855
- export { Ve as RangeFlow, He as useRangeflow };
861
+ export { He as RangeFlow, Ue as useRangeflow };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rangeflow",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "description": "A fancy date range picker built with React and Tailwind.",
6
6
  "license": "MIT",